ContactFormType::class, 'civility' => ContactFormCivility::class ]; /** * The database connection that should be used by the model. * * @var string */ protected $connection = null; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'civility', 'lastname', 'firstname', 'address', 'email', 'postal', 'town', 'phone', 'type', 'onepagesubject', 'message', 'joinFile', 'productName', 'productCode', 'buyPlace', 'lotNumberName', 'limitDateDay', 'limitDateMonth', 'limitDateYear', 'consumptionDateDay', 'consumptionDateMonth', 'consumptionDateYear' ]; protected $attributes = [ 'productName' => '', 'productCode' => '', 'buyPlace' => '', 'lotNumberName' => 0, 'limitDateDay' => '00', 'limitDateMonth' => '00', 'limitDateYear' => '0000', 'consumptionDateDay' => '00', 'consumptionDateMonth' => '00', 'consumptionDateYear' => '0000', ]; /** * Export the model data to a Formatted Arcadia Data array * * @return array */ public function exportToArcadiaDataArray(): array { return [ date("Ymd"), date("Gis"), $this->civility->value, $this->lastname, $this->firstname, $this->address, $this->postal, $this->town, $this->email, $this->type->equals(ContactFormType::onepage()) ? $this->onepagesubject : $this->type->value, // Pansement à cause d'archadia, à retirer quand ils auront réparé leur merde trim(preg_replace('/\s+/', ' ', $this->message)), '0', '0', '0', '0' ]; } /** * Export the model data to a Formatted Passerelle Data array * * @return array */ /** * Removed * 'EMETTEUR_OBJETDEMANDE' => "objet de la reclamation string", * 'EMETTEUR_OPT_IN' => '', * 'REPONSE_ETAT' => 0, * 'TYPE_REPONSE' => 'mail', */ public function exportToPasserelleDataArray(): array { // CF PAsserrelle fields .csv return [ // Marque le Gaulois (Obligatoire) 'EMETTEUR_MARQUE' => 1, // Obligatoire 'EMETTEUR_DATE' => date("Y-m-d"), // Obligatoire 'EMETTEUR_HEURE' => date("h:i:s"), 'EMETTEUR_CIVILITE' => $this->civility->value, // Obligatoire 'EMETTEUR_NOM' => $this->lastname, // Obligatoire 'EMETTEUR_PRENOM' => $this->firstname, 'EMETTEUR_ADRESSE1' => $this->address, 'EMETTEUR_ADRESSE2' => '', 'EMETTEUR_CP' => $this->postal, // Obligatoire 'EMETTEUR_VILLE' => $this->town, 'EMETTEUR_EMAIL' => $this->email, 'EMETTEUR_TELEPHONE' => $this->phone, 'EMETTEUR_PAYS' => 'France', 'EMETTEUR_NOM_PRODUIT' => $this->productName, // Obligatoire 'EMETTEUR_EAN13' => $this->productCode, 'EMETTEUR_DATE_LIMITE_CONSO' => sprintf( '%s/%s/%s', $this->limitDateDay ?? '00', $this->limitDateMonth ?? '00', $this->limitDateYear ?? '0000' ), 'EMETTEUR_NUM_LOT' => $this->lotNumberName, 'EMETTEUR_MESSAGE' => $this->type->equals(ContactFormType::onepage()) ? sprintf('%s \n %s', $this->onepagesubject, $this->message) : $this->message, 'EMETTEUR_PJ' => $this->joinFile, 'DATE_CONSO' => sprintf( '%s/%s/%s', $this->consumptionDateDay ?? '00', $this->consumptionDateMonth ?? '00', $this->consumptionDateYear ?? '0000' ), 'LIEU_ACHAT' => $this->buyPlace, // FUCK passerelle et leur DTD qui n'existe pas cf: resources/documents 'EMETTEUR_OBJETDEMANDE' => 3, // Recla conso ? 'EMETTEUR_OPT_IN' => '', // doit être vide ? 'REPONSE_ETAT' => 0, // c'est quoi ça ? 'TYPE_REPONSE' => 'mail' // ok ]; } }