44 $this->numero = 94160;
46 $this->family =
"srm";
47 $this->module_position =
'40';
49 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
53 $this->version =
'dolibarr';
55 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
56 $this->picto =
"dollyrevert";
59 $this->dirs = array(
"/reception/receipt",
60 "/reception/receipt/temp",
61 "/doctemplates/receptions"
65 $this->config_page_url = array(
"reception_setup.php");
68 $this->depends = array(
"modFournisseur");
69 $this->requiredby = array();
70 $this->conflictwith = array();
71 $this->langfiles = array(
'receptions');
74 $this->
const = array();
77 $this->
const[$r][0] =
"RECEPTION_ADDON_PDF";
78 $this->
const[$r][1] =
"chaine";
79 $this->
const[$r][2] =
"squille";
80 $this->
const[$r][3] =
'Nom du gestionnaire de generation des bons receptions en PDF';
81 $this->
const[$r][4] = 0;
84 $this->
const[$r][0] =
"RECEPTION_ADDON_NUMBER";
85 $this->
const[$r][1] =
"chaine";
86 $this->
const[$r][2] =
"mod_reception_beryl";
87 $this->
const[$r][3] =
'Name for numbering manager for receptions';
88 $this->
const[$r][4] = 0;
91 $this->
const[$r][0] =
"RECEPTION_ADDON_PDF_ODT_PATH";
92 $this->
const[$r][1] =
"chaine";
93 $this->
const[$r][2] =
"DOL_DATA_ROOT/doctemplates/receptions";
94 $this->
const[$r][3] =
"";
95 $this->
const[$r][4] = 0;
98 $this->
const[$r][0] =
"MAIN_SUBMODULE_RECEPTION";
99 $this->
const[$r][1] =
"chaine";
100 $this->
const[$r][2] =
"1";
101 $this->
const[$r][3] =
"Enable receptions";
102 $this->
const[$r][4] = 0;
106 $this->boxes = array();
109 $this->rights = array();
110 $this->rights_class =
'reception';
114 $this->rights[$r][0] = $this->numero.$r;
115 $this->rights[$r][1] =
'Lire les receptions';
116 $this->rights[$r][2] =
'r';
117 $this->rights[$r][3] = 0;
118 $this->rights[$r][4] =
'lire';
121 $this->rights[$r][0] = $this->numero.$r;
122 $this->rights[$r][1] =
'Creer modifier les receptions';
123 $this->rights[$r][2] =
'w';
124 $this->rights[$r][3] = 0;
125 $this->rights[$r][4] =
'creer';
128 $this->rights[$r][0] = $this->numero.$r;
129 $this->rights[$r][1] =
'Valider les receptions';
130 $this->rights[$r][2] =
'd';
131 $this->rights[$r][3] = 0;
132 $this->rights[$r][4] =
'reception_advance';
133 $this->rights[$r][5] =
'validate';
136 $this->rights[$r][0] = $this->numero.$r;
137 $this->rights[$r][1] =
'Envoyer les receptions aux clients';
138 $this->rights[$r][2] =
'd';
139 $this->rights[$r][3] = 0;
140 $this->rights[$r][4] =
'reception_advance';
141 $this->rights[$r][5] =
'send';
144 $this->rights[$r][0] = $this->numero.$r;
145 $this->rights[$r][1] =
'Exporter les receptions';
146 $this->rights[$r][2] =
'r';
147 $this->rights[$r][3] = 0;
148 $this->rights[$r][4] =
'reception';
149 $this->rights[$r][5] =
'export';
152 $this->rights[$r][0] = $this->numero.$r;
153 $this->rights[$r][1] =
'Supprimer les receptions';
154 $this->rights[$r][2] =
'd';
155 $this->rights[$r][3] = 0;
156 $this->rights[$r][4] =
'supprimer';
168 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
170 $contact_arrays = $shipment->liste_type_contact(
'external',
'', 0, 0,
'');
171 if (is_array($contact_arrays) && count($contact_arrays) > 0) {
172 $idcontacts = join(
',', array_keys($shipment->liste_type_contact(
'external',
'', 0, 0,
'')));
179 $this->export_code[$r] = $this->rights_class.
'_'.$r;
180 $this->export_label[$r] =
'Receptions';
181 $this->export_permission[$r] = array(array(
"reception",
"reception",
"export"));
182 $this->export_fields_array[$r] = array(
183 's.rowid'=>
"IdCompany",
's.nom'=>
'ThirdParty',
's.address'=>
'Address',
's.zip'=>
'Zip',
's.town'=>
'Town',
184 'd.nom'=>
'State',
'co.label'=>
'Country',
'co.code'=>
'CountryCode',
's.phone'=>
'Phone',
's.siren'=>
'ProfId1',
's.siret'=>
'ProfId2',
's.ape'=>
'ProfId3',
's.idprof4'=>
'ProfId4',
's.idprof5'=>
'ProfId5',
's.idprof6'=>
'ProfId6',
185 'c.rowid'=>
"Id",
'c.ref'=>
"Ref",
'c.ref_supplier'=>
"RefSupplier",
'c.fk_soc'=>
"IdCompany",
'c.date_creation'=>
"DateCreation",
'c.date_delivery'=>
"DateDeliveryPlanned",
'c.tracking_number'=>
"TrackingNumber",
'c.height'=>
"Height",
'c.width'=>
"Width",
'c.size'=>
"Depth",
'c.size_units'=>
'SizeUnits',
'c.weight'=>
"Weight",
'c.weight_units'=>
"WeightUnits",
'c.fk_statut'=>
'Status',
'c.note_public'=>
"NotePublic",
'ed.rowid'=>
'LineId',
186 'ed.comment'=>
'Description',
'ed.qty'=>
"Qty",
187 'p.rowid'=>
'ProductId',
'p.ref'=>
'ProductRef',
'p.label'=>
'ProductLabel',
'p.weight'=>
'ProductWeight',
'p.weight_units'=>
'WeightUnits',
'p.volume'=>
'ProductVolume',
'p.volume_units'=>
'VolumeUnits'
189 if ($idcontacts && !empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) {
190 $this->export_fields_array[$r] += array(
'sp.rowid'=>
'IdContact',
'sp.lastname'=>
'Lastname',
'sp.firstname'=>
'Firstname',
'sp.note_public'=>
'NotePublic');
193 $this->export_TypeFields_array[$r] = array(
194 's.nom'=>
'Text',
's.address'=>
'Text',
's.zip'=>
'Text',
's.town'=>
'Text',
195 'co.label'=>
'List:c_country:label:label',
'co.code'=>
'Text',
's.phone'=>
'Text',
's.siren'=>
'Text',
's.siret'=>
'Text',
's.ape'=>
'Text',
's.idprof4'=>
'Text',
196 'c.ref'=>
"Text",
'c.ref_supplier'=>
"Text",
'c.date_creation'=>
"Date",
'c.date_delivery'=>
"Date",
'c.tracking_number'=>
"Numeric",
'c.height'=>
"Numeric",
'c.width'=>
"Numeric",
'c.weight'=>
"Numeric",
'c.fk_statut'=>
'Status',
'c.note_public'=>
"Text",
197 'ed.qty'=>
"Numeric",
'd.nom'=>
'Text'
199 $this->export_entities_array[$r] = array(
200 's.rowid'=>
"company",
's.nom'=>
'company',
's.address'=>
'company',
's.zip'=>
'company',
's.town'=>
'company',
201 'd.nom'=>
'company',
'co.label'=>
'company',
'co.code'=>
'company',
's.fk_pays'=>
'company',
's.phone'=>
'company',
's.siren'=>
'company',
's.ape'=>
'company',
's.siret'=>
'company',
's.idprof4'=>
'company',
's.idprof5'=>
'company',
's.idprof6'=>
'company',
202 'c.rowid'=>
"reception",
'c.ref'=>
"reception",
'c.ref_supplier'=>
"reception",
'c.fk_soc'=>
"reception",
'c.date_creation'=>
"reception",
'c.date_delivery'=>
"reception",
'c.tracking_number'=>
'reception',
'c.height'=>
"reception",
'c.width'=>
"reception",
'c.size'=>
'reception',
'c.size_units'=>
'reception',
'c.weight'=>
"reception",
'c.weight_units'=>
'reception',
'c.fk_statut'=>
"reception",
'c.note_public'=>
"reception",
203 'ed.rowid'=>
'reception_line',
'ed.comment'=>
'reception_line',
'ed.qty'=>
"reception_line",
204 'p.rowid'=>
'product',
'p.ref'=>
'product',
'p.label'=>
'product',
'p.weight'=>
'product',
'p.weight_units'=>
'product',
'p.volume'=>
'product',
'p.volume_units'=>
'product'
206 if ($idcontacts && !empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) {
207 $this->export_entities_array[$r] += array(
'sp.rowid'=>
'contact',
'sp.lastname'=>
'contact',
'sp.firstname'=>
'contact',
'sp.note_public'=>
'contact');
209 $this->export_dependencies_array[$r] = array(
'reception_line'=>
'ed.rowid',
'product'=>
'ed.rowid');
210 if ($idcontacts && !empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) {
211 $keyforselect =
'socpeople';
212 $keyforelement =
'contact';
213 $keyforaliasextra =
'extra3';
214 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
216 $keyforselect =
'reception';
217 $keyforelement =
'reception';
218 $keyforaliasextra =
'extra';
219 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
220 $keyforselect =
'commande_fournisseur_dispatch';
221 $keyforelement =
'reception_line';
222 $keyforaliasextra =
'extra2';
223 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
225 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
226 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'reception as c';
227 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'reception_extrafields as extra ON c.rowid = extra.fk_object,';
228 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'societe as s';
229 if (empty($user->rights->societe->client->voir)) {
230 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
232 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_departements as d ON s.fk_departement = d.rowid';
233 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as co ON s.fk_pays = co.rowid,';
234 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'commande_fournisseur_dispatch as ed';
235 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseur_dispatch_extrafields as extra2 ON ed.rowid = extra2.fk_object';
236 $this->export_sql_end[$r] .=
' , '.MAIN_DB_PREFIX.
'commande_fournisseurdet as cd';
237 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as p on cd.fk_product = p.rowid';
238 if ($idcontacts && !empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) {
239 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$this->db->sanitize($idcontacts).
')';
240 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'socpeople as sp ON sp.rowid = ee.fk_socpeople';
241 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object';
243 $this->export_sql_end[$r] .=
' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_reception AND ed.fk_commandefourndet = cd.rowid';
244 $this->export_sql_end[$r] .=
' AND c.entity IN ('.getEntity(
'reception').
')';
245 if (empty($user->rights->societe->client->voir)) {
246 $this->export_sql_end[$r] .=
' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);