31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
41$langs->loadLangs(array(
"sendings",
"receptions",
"deliveries",
'companies',
'bills',
'orders'));
43$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'shipmentlist';
47$action =
GETPOST(
'action',
'alpha');
48$massaction =
GETPOST(
'massaction',
'alpha');
49$toselect =
GETPOST(
'toselect',
'array');
50$optioncss =
GETPOST(
'optioncss',
'alpha');
51$mode =
GETPOST(
'mode',
'alpha');
54$search_ref_rcp =
GETPOST(
"search_ref_rcp");
55$search_ref_liv =
GETPOST(
'search_ref_liv');
56$search_ref_supplier =
GETPOST(
'search_ref_supplier');
57$search_company =
GETPOST(
"search_company");
58$search_town =
GETPOST(
'search_town',
'alpha');
59$search_zip =
GETPOST(
'search_zip',
'alpha');
60$search_state =
GETPOST(
"search_state");
61$search_country =
GETPOST(
"search_country",
'aZ09');
62$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
63$search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
64$search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
65$search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
66$search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
67$search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
68$search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
69$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
70$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
71$search_date_create_startday =
GETPOSTINT(
'search_date_create_startday');
72$search_date_create_startmonth =
GETPOSTINT(
'search_date_create_startmonth');
73$search_date_create_startyear =
GETPOSTINT(
'search_date_create_startyear');
74$search_date_create_endday =
GETPOSTINT(
'search_date_create_endday');
75$search_date_create_endmonth =
GETPOSTINT(
'search_date_create_endmonth');
76$search_date_create_endyear =
GETPOSTINT(
'search_date_create_endyear');
77$search_date_create_start =
dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear);
78$search_date_create_end =
dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear);
79$search_billed =
GETPOST(
"search_billed",
'intcomma');
80$search_status =
GETPOST(
'search_status',
'intcomma');
81$search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
84$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
85$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
93if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
97$offset = $limit * $page;
101$diroutputmassaction = $conf->reception->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
105$hookmanager->initHooks(array(
'receptionlist'));
109$extrafields->fetch_name_optionals_label(
$object->table_element);
110$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
113$fieldstosearchall = array(
115 'e.ref_supplier'=>
"RefSupplier",
116 's.nom' =>
"ThirdParty",
117 'e.note_public' =>
'NotePublic',
119if (empty($user->socid)) {
120 $fieldstosearchall[
"e.note_private"] =
"NotePrivate";
123$checkedtypetiers = 0;
125 'e.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1),
126 'e.ref_supplier' => array(
'label' => $langs->trans(
"RefSupplier"),
'checked' => 1),
127 's.nom' => array(
'label' => $langs->trans(
"ThirdParty"),
'checked' => 1),
128 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' => 1),
129 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' => 1),
130 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' => 0),
131 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' => 0),
132 'typent.code' => array(
'label' => $langs->trans(
"ThirdPartyType"),
'checked' => $checkedtypetiers),
133 'e.date_delivery' => array(
'label' => $langs->trans(
"DateDeliveryPlanned"),
'checked' => 1),
134 'e.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0,
'position' => 500),
135 'e.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' => 0,
'position' => 500),
136 'e.fk_statut' => array(
'label' => $langs->trans(
"Status"),
'checked' => 1,
'position' => 1000),
137 'e.billed' => array(
'label' => $langs->trans(
"Billed"),
'checked' => 1,
'position' => 1000,
'enabled' =>
'getDolGlobalString("WORKFLOW_BILL_ON_RECEPTION") !== "0"')
141include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
145'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
152 $socid = $user->socid;
161if (
GETPOST(
'cancel',
'alpha')) {
165if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_createbills') {
169$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
170$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
175include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
178if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
179 $search_ref_supplier =
'';
180 $search_ref_rcp =
'';
181 $search_ref_liv =
'';
182 $search_company =
'';
186 $search_country =
'';
187 $search_type_thirdparty =
'';
188 $search_date_delivery_startday =
'';
189 $search_date_delivery_startmonth =
'';
190 $search_date_delivery_startyear =
'';
191 $search_date_delivery_endday =
'';
192 $search_date_delivery_endmonth =
'';
193 $search_date_delivery_endyear =
'';
194 $search_date_delivery_start =
'';
195 $search_date_delivery_end =
'';
196 $search_date_create_startday =
'';
197 $search_date_create_startmonth =
'';
198 $search_date_create_startyear =
'';
199 $search_date_create_endday =
'';
200 $search_date_create_endmonth =
'';
201 $search_date_create_endyear =
'';
202 $search_date_create_start =
'';
203 $search_date_create_end =
'';
207 $search_array_options = array();
210if (empty($reshook)) {
212 $objectclass =
'Reception';
213 $objectlabel =
'Receptions';
214 $permissiontoread = $user->hasRight(
'reception',
'lire');
215 $permissiontoadd = $user->hasRight(
'reception',
'creer');
216 $permissiontodelete = $user->hasRight(
'reception',
'supprimer');
217 $uploaddir = $conf->reception->multidir_output[$conf->entity];
218 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
220 if ($massaction ==
'confirm_createbills' && ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"))) {
221 $receptions =
GETPOST(
'toselect',
'array');
222 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
223 $validate_invoices =
GETPOSTINT(
'validate_invoices');
228 $TFactThird = array();
229 $TFactThirdNbLines = array();
231 $nb_bills_created = 0;
239 foreach ($receptions as $id_reception) {
242 if ($rcp->fetch($id_reception) <= 0 || $rcp->statut == $rcp::STATUS_DRAFT) {
243 $errors[] = $langs->trans(
'StatusOfRefMustBe', $rcp->ref, $langs->transnoentities(
"StatusReceptionValidatedShort"));
249 if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
251 $objecttmp = $TFactThird[$rcp->socid];
254 $objecttmp->fetchObjectLinked();
255 $rcp->fetchObjectLinked();
256 if (count($rcp->linkedObjectsIds[
'order_supplier']) > 0) {
257 foreach ($rcp->linkedObjectsIds[
'order_supplier'] as $key => $value) {
258 if (empty($objecttmp->linkedObjectsIds[
'order_supplier']) || !in_array($value, $objecttmp->linkedObjectsIds[
'order_supplier'])) {
259 $objecttmp->add_object_linked(
'order_supplier', $value);
264 $cond_reglement_id = 0;
265 $mode_reglement_id = 0;
267 $transport_mode_id = 0;
268 $multicurrency_code =
null;
270 if (!empty($rcp->cond_reglement_id)) {
271 $cond_reglement_id = $rcp->cond_reglement_id;
273 if (!empty($rcp->mode_reglement_id)) {
274 $mode_reglement_id = $rcp->mode_reglement_id;
276 if (!empty($rcp->fk_account)) {
277 $fk_account = $rcp->fk_account;
279 if (!empty($rcp->transport_mode_id)) {
280 $transport_mode_id = $rcp->transport_mode_id;
282 if (!empty($rcp->multicurrency_code)) {
283 $multicurrency_code = $rcp->multicurrency_code;
286 if (empty($cond_reglement_id)
287 || empty($mode_reglement_id)
288 || empty($fk_account)
289 || empty($transport_mode_id)
290 || empty($multicurrency_code)
292 if (!isset($rcp->supplier_order)) {
293 $rcp->fetch_origin();
297 if (!empty($rcp->origin_object)) {
298 $supplierOrder = $rcp->origin_object;
299 if (empty($cond_reglement_id) && !empty($supplierOrder->cond_reglement_id)) {
300 $cond_reglement_id = $supplierOrder->cond_reglement_id;
302 if (empty($mode_reglement_id) && !empty($supplierOrder->mode_reglement_id)) {
303 $mode_reglement_id = $supplierOrder->mode_reglement_id;
305 if (empty($fk_account) && !empty($supplierOrder->fk_account)) {
306 $fk_account = $supplierOrder->fk_account;
308 if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) {
309 $transport_mode_id = $supplierOrder->transport_mode_id;
311 if (empty($multicurrency_code) && !empty($supplierOrder->multicurrency_code)) {
312 $multicurrency_code = $supplierOrder->multicurrency_code;
317 if (!empty($rcp->thirdparty)) {
318 $soc = $rcp->thirdparty;
319 if (empty($cond_reglement_id) && !empty($soc->cond_reglement_supplier_id)) {
320 $cond_reglement_id = $soc->cond_reglement_supplier_id;
322 if (empty($mode_reglement_id) && !empty($soc->mode_reglement_supplier_id)) {
323 $mode_reglement_id = $soc->mode_reglement_supplier_id;
325 if (empty($fk_account) && !empty($soc->fk_account)) {
326 $fk_account = $soc->fk_account;
328 if (empty($transport_mode_id) && !empty($soc->transport_mode_id)) {
329 $transport_mode_id = $soc->transport_mode_id;
331 if (empty($multicurrency_code) && !empty($soc->multicurrency_code)) {
332 $multicurrency_code = $soc->multicurrency_code;
338 $objecttmp->socid = $rcp->socid;
339 $objecttmp->type = $objecttmp::TYPE_STANDARD;
340 $objecttmp->cond_reglement_id = $cond_reglement_id;
341 $objecttmp->mode_reglement_id = $mode_reglement_id;
342 $objecttmp->fk_account = $fk_account;
343 $objecttmp->transport_mode_id = $transport_mode_id;
344 $objecttmp->multicurrency_code = $multicurrency_code;
347 $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge;
349 $objecttmp->fk_project = $rcp->fk_project;
351 if (empty($createbills_onebythird)) {
352 $objecttmp->ref_supplier = $rcp->ref;
355 $objecttmp->ref_supplier = $langs->trans(
"Reception").
' '.
dol_print_date(
dol_now(),
'dayhourlog').
'-'.$rcp->socid;
359 if (empty($datefacture)) {
363 $objecttmp->date = $datefacture;
364 $objecttmp->origin =
'reception';
365 $objecttmp->origin_id = $id_reception;
368 if (empty($objecttmp->date_echeance)) {
369 $objecttmp->date_echeance = $objecttmp->calculate_date_lim_reglement();
372 $objecttmp->array_options = $rcp->array_options;
375 $rcp->fetchObjectLinked();
376 if (count($rcp->linkedObjectsIds[
'order_supplier']) > 0) {
377 foreach ($rcp->linkedObjectsIds[
'order_supplier'] as $key => $value) {
378 $objecttmp->linked_objects[
'order_supplier'] = $value;
382 $res = $objecttmp->create($user);
387 $lastref = $objecttmp->ref;
388 $lastid = $objecttmp->id;
390 $TFactThird[$rcp->socid] = $objecttmp;
391 $TFactThirdNbLines[$rcp->socid] = 0;
393 $langs->load(
"errors");
394 $errors[] = $rcp->ref.
' : '.$langs->trans($objecttmp->error);
399 if ($objecttmp->id > 0) {
400 if (!isset($rcp->origin_object)) {
401 $rcp->fetch_origin();
403 if ($rcp->origin_object->multicurrency_code != $objecttmp->multicurrency_code) {
404 $errors[] = $rcp->ref.
" : ".$langs->trans(
"ReceptionMustBeInTheSameCurrencyThanOther");
407 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_reception);
410 $errors[] = $objecttmp->error;
415 $lines = $rcp->lines;
416 if (empty($lines) && method_exists($rcp,
'fetch_lines')) {
418 $lines = $rcp->lines;
422 $num = count($lines);
424 for ($i = 0; $i < $num; $i++) {
425 $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
427 if (!empty($createbills_onebythird)) {
431 if ($lines[$i]->subprice < 0) {
434 $discount->fk_soc = $objecttmp->socid;
435 $discount->socid = $objecttmp->socid;
436 $discount->amount_ht = abs($lines[$i]->total_ht);
437 $discount->amount_tva = abs($lines[$i]->total_tva);
438 $discount->amount_ttc = abs($lines[$i]->total_ttc);
439 $discount->tva_tx = $lines[$i]->tva_tx;
440 $discount->fk_user = $user->id;
441 $discount->description = $desc;
442 $discountid = $discount->create($user);
443 if ($discountid > 0) {
444 $result = $objecttmp->insert_discount($discountid);
453 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
456 if ($lines[$i]->date_debut_prevue) {
457 $date_start = $lines[$i]->date_debut_prevue;
459 if ($lines[$i]->date_debut_reel) {
460 $date_start = $lines[$i]->date_debut_reel;
462 if ($lines[$i]->date_start) {
463 $date_start = $lines[$i]->date_start;
467 if ($lines[$i]->date_fin_prevue) {
468 $date_end = $lines[$i]->date_fin_prevue;
470 if ($lines[$i]->date_fin_reel) {
471 $date_end = $lines[$i]->date_fin_reel;
473 if ($lines[$i]->date_end) {
474 $date_end = $lines[$i]->date_end;
477 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
482 if (method_exists($lines[$i],
'fetch_optionals')) {
483 $lines[$i]->fetch_optionals();
484 $array_options = $lines[$i]->array_options;
487 $objecttmp->context[
'createfromclone'] =
'createfromclone';
491 if (!empty($createbills_onebythird)) {
492 $rang = $TFactThirdNbLines[$rcp->socid];
495 $result = $objecttmp->addline(
497 $lines[$i]->subprice,
499 $lines[$i]->localtax1_tx,
500 $lines[$i]->localtax2_tx,
502 $lines[$i]->fk_product,
503 $lines[$i]->remise_percent,
507 $lines[$i]->info_bits,
515 $lines[$i]->multicurrency_subprice,
516 $lines[$i]->ref_supplier
519 $rcp->add_object_linked(
'facture_fourn_det', $result);
523 if (!empty($createbills_onebythird)) {
524 $TFactThirdNbLines[$rcp->socid]++;
532 if ($result > 0 && $lines[$i]->product_type == 9) {
533 $fk_parent_line = $result;
542 if (!empty($createbills_onebythird) && empty($TFactThird[$rcp->socid])) {
543 $TFactThird[$rcp->socid] = $objecttmp;
545 $TFact[$objecttmp->id] = $objecttmp;
550 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
553 if (!$error && $validate_invoices) {
554 $massaction = $action =
'builddoc';
555 foreach ($TAllFact as &$objecttmp) {
556 $result = $objecttmp->validate($user);
563 $id = $objecttmp->id;
564 $lastref = $objecttmp->ref;
569 $upload_dir = $conf->fournisseur->facture->dir_output;
570 $permissiontoadd = ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer'));
575 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
579 $massaction = $action =
'confirm_createbills';
585 if ($nb_bills_created == 1) {
586 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
587 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
590 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
596 $_GET[
"origin"] = $_POST[
"origin"];
597 $_GET[
"originid"] = $_POST[
"originid"];
611$form =
new Form($db);
612$companystatic =
new Societe($db);
618$helpurl =
'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
619llxHeader(
'', $langs->trans(
'ListOfReceptions'), $helpurl,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-reception page-list');
621$sql =
"SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut as status, e.billed,";
622$sql .=
" s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,";
623$sql .=
" typent.code as typent_code,";
624$sql .=
" state.code_departement as state_code, state.nom as state_name,";
625$sql .=
" e.date_creation as date_creation, e.tms as date_modification";
627if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
628 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
629 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
633$parameters = array();
634$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
635$sql .= $hookmanager->resPrint;
639$sql .=
" FROM ".MAIN_DB_PREFIX.
"reception as e";
640if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
641 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (e.rowid = ef.fk_object)";
643$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
644$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
645$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
646$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
647$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'reception' AND ee.targettype = 'delivery'";
648$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"delivery as l ON l.rowid = ee.fk_target";
650$parameters = array();
651$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
652$sql .= $hookmanager->resPrint;
653$sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
655 $sql .=
" AND e.fk_soc = ".((int) $socid);
657if ($search_status !=
'' && $search_status >= 0) {
658 $sql .=
" AND e.fk_statut = ".((int) $search_status);
660if ($search_billed !=
'' && $search_billed >= 0) {
661 $sql .=
' AND e.billed = '.((int) $search_billed);
672if ($search_country) {
673 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
675if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
676 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
678if ($search_date_delivery_start) {
679 $sql .=
" AND e.date_delivery >= '".$db->idate($search_date_delivery_start).
"'";
681if ($search_date_delivery_end) {
682 $sql .=
" AND e.date_delivery <= '".$db->idate($search_date_delivery_end).
"'";
684if ($search_date_create_start) {
685 $sql .=
" AND e.date_creation >= '".$db->idate($search_date_create_start).
"'";
687if ($search_date_create_end) {
688 $sql .=
" AND e.date_creation <= '".$db->idate($search_date_create_end).
"'";
690if ($search_ref_rcp) {
693if ($search_ref_liv) {
696if ($search_company) {
699if ($search_ref_supplier) {
703 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
716include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
718$parameters = array();
719$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
720$sql .= $hookmanager->resPrint;
723$parameters = array();
724$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
725$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
727$nbtotalofrecords =
'';
730 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
731 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
732 $resql = $db->query($sqlforcount);
734 $objforcount = $db->fetch_object($resql);
735 $nbtotalofrecords = $objforcount->nbtotalofrecords;
740 if (($page * $limit) > $nbtotalofrecords) {
748$sql .= $db->order($sortfield, $sortorder);
750 $sql .= $db->plimit($limit + 1, $offset);
754$resql = $db->query($sql);
760$num = $db->num_rows($resql);
764$arrayofselected = is_array($toselect) ? $toselect : array();
768 $param .=
'&mode='.urlencode($mode);
770if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
771 $param .=
'&contextpage='.urlencode($contextpage);
773if ($limit > 0 && $limit != $conf->liste_limit) {
774 $param .=
'&limit='.((int) $limit);
777 $param .=
"&search_all=".urlencode($search_all);
779if ($search_ref_rcp) {
780 $param .=
"&search_ref_rcp=".urlencode($search_ref_rcp);
782if ($search_ref_liv) {
783 $param .=
"&search_ref_liv=".urlencode($search_ref_liv);
785if ($search_company) {
786 $param .=
"&search_company=".urlencode($search_company);
788if ($optioncss !=
'') {
789 $param .=
'&optioncss='.urlencode($optioncss);
791if ($search_billed !=
'' && $search_billed >= 0) {
792 $param .=
"&search_billed=".urlencode((
string) ($search_billed));
795 $param .=
"&search_town=".urlencode($search_town);
798 $param .=
"&search_zip=".urlencode($search_zip);
801 $param .=
"&search_state=".urlencode($search_state);
803if ($search_status !=
'') {
804 $param .=
"&search_status=".urlencode($search_status);
806if ($search_country) {
807 $param .=
"&search_country=".urlencode((
string) ($search_country));
809if ($search_type_thirdparty) {
810 $param .=
"&search_type_thirdparty=".urlencode((
string) ($search_type_thirdparty));
812if ($search_date_delivery_startday) {
813 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
815if ($search_date_delivery_startmonth) {
816 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
818if ($search_date_delivery_startyear) {
819 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
821if ($search_date_delivery_endday) {
822 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
824if ($search_date_delivery_endmonth) {
825 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
827if ($search_date_delivery_endyear) {
828 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
830if ($search_date_create_startday) {
831 $param .=
'&search_date_create_startday='.urlencode((
string) ($search_date_create_startday));
833if ($search_date_create_startmonth) {
834 $param .=
'&search_date_create_startmonth='.urlencode((
string) ($search_date_create_startmonth));
836if ($search_date_create_startyear) {
837 $param .=
'&search_date_create_startyear='.urlencode((
string) ($search_date_create_startyear));
839if ($search_date_create_endday) {
840 $param .=
'&search_date_create_endday='.urlencode((
string) ($search_date_create_endday));
842if ($search_date_create_endmonth) {
843 $param .=
'&search_date_create_endmonth='.urlencode((
string) ($search_date_create_endmonth));
845if ($search_date_create_endyear) {
846 $param .=
'&search_date_create_endyear='.urlencode((
string) ($search_date_create_endyear));
848if ($search_ref_supplier) {
849 $param .=
"&search_ref_supplier=".urlencode($search_ref_supplier);
852if ($search_array_options) {
853 foreach ($search_array_options as $key => $val) {
855 $tmpkey = preg_replace(
'/search_options_/',
'', $key);
856 if (is_array($val) && array_key_exists(
'start', $val) && array_key_exists(
'end', $val)) {
859 $param .=
'&search_options_'.$tmpkey.
'_startyear='.
dol_print_date($val[
'start'],
'%Y');
860 $param .=
'&search_options_'.$tmpkey.
'_startmonth='.
dol_print_date($val[
'start'],
'%m');
861 $param .=
'&search_options_'.$tmpkey.
'_startday='.
dol_print_date($val[
'start'],
'%d');
862 $param .=
'&search_options_'.$tmpkey.
'_starthour='.
dol_print_date($val[
'start'],
'%H');
863 $param .=
'&search_options_'.$tmpkey.
'_startmin='.
dol_print_date($val[
'start'],
'%M');
865 $param .=
'&search_options_'.$tmpkey.
'_endyear='.
dol_print_date($val[
'end'],
'%Y');
866 $param .=
'&search_options_'.$tmpkey.
'_endmonth='.
dol_print_date($val[
'end'],
'%m');
867 $param .=
'&search_options_'.$tmpkey.
'_endday='.
dol_print_date($val[
'end'],
'%d');
868 $param .=
'&search_options_'.$tmpkey.
'_endhour='.
dol_print_date($val[
'end'],
'%H');
869 $param .=
'&search_options_'.$tmpkey.
'_endmin='.
dol_print_date($val[
'end'],
'%M');
873 $param .=
'&search_options_'.$tmpkey.
'='.urlencode($val);
879$arrayofmassactions = array(
880 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
884if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer')) {
885 $arrayofmassactions[
'createbills'] = $langs->trans(
"CreateInvoiceForThisReceptions");
887if (in_array($massaction, array(
'presend',
'createbills'))) {
888 $arrayofmassactions = array();
890$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
897$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
898$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
900$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewReception'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/reception/card.php?action=create2',
'', $user->hasRight(
'reception',
'creer'));
903print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
904if ($optioncss !=
'') {
905 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
907print
'<input type="hidden" name="token" value="'.newToken().
'">';
908print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
909print
'<input type="hidden" name="action" value="list">';
910print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
911print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
912print
'<input type="hidden" name="mode" value="'.$mode.
'">';
915print_barre_liste($langs->trans(
'ListOfReceptions'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'dollyrevert', 0, $newcardbutton,
'', $limit, 0, 0, 1);
917if ($massaction ==
'createbills') {
919 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
921 print
'<table class="noborder" width="100%" >';
923 print
'<td class="titlefieldmiddle">';
924 print $langs->trans(
'DateInvoice');
927 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
932 print $langs->trans(
'CreateOneBillByThird');
935 print $form->selectyesno(
'createbills_onebythird',
'', 1);
940 print $langs->trans(
'ValidateInvoices');
944 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
945 print
' ('.$langs->trans(
"AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").
')';
947 print $form->selectyesno(
'validate_invoices', 0, 1);
954 print
'<div class="center">';
955 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisReceptions').
'"> ';
956 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
962 foreach ($fieldstosearchall as $key => $val) {
963 $fieldstosearchall[$key] = $langs->trans($val);
965 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
970if (!empty($moreforfilter)) {
971 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
972 print $moreforfilter;
973 $parameters = array(
'type' => $type);
974 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
975 print $hookmanager->resPrint;
979$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
980$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
981if ($massactionbutton) {
982 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
985print
'<div class="div-table-responsive">';
986print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
990print
'<tr class="liste_titre_filter">';
993 print
'<td class="liste_titre center maxwidthsearch">';
994 $searchpicto = $form->showFilterButtons(
'left');
999if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1000 print
'<td class="liste_titre">';
1001 print
'<input class="flat" size="6" type="text" name="search_ref_rcp" value="'.$search_ref_rcp.
'">';
1005if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
1006 print
'<td class="liste_titre">';
1007 print
'<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.
'">';
1011if (!empty($arrayfields[
's.nom'][
'checked'])) {
1012 print
'<td class="liste_titre left">';
1013 print
'<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1017if (!empty($arrayfields[
's.town'][
'checked'])) {
1018 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
1021if (!empty($arrayfields[
's.zip'][
'checked'])) {
1022 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.
'"></td>';
1025if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1026 print
'<td class="liste_titre">';
1027 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1031if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1032 print
'<td class="liste_titre center">';
1033 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1037if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1038 print
'<td class="liste_titre maxwidthonsmartphone center">';
1039 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
1043if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
1044 print
'<td class="liste_titre center">';
1045 print
'<div class="nowrapfordate">';
1046 print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1,
'search_date_delivery_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1048 print
'<div class="nowrapfordate">';
1049 print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1,
'search_date_delivery_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1053if (!empty($arrayfields[
'l.ref'][
'checked'])) {
1055 print
'<td class="liste_titre">';
1056 print
'<input class="flat" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).
'"';
1059if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
1061 print
'<td class="liste_titre center"> </td>';
1064include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1067$parameters = array(
'arrayfields' => $arrayfields);
1068$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1069print $hookmanager->resPrint;
1071if (!empty($arrayfields[
'e.datec'][
'checked'])) {
1072 print
'<td class="liste_titre center">';
1073 print
'<div class="nowrapfordate">';
1074 print $form->selectDate($search_date_create_start ? $search_date_create_start : -1,
'search_date_create_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1076 print
'<div class="nowrapfordate">';
1077 print $form->selectDate($search_date_create_end ? $search_date_create_end : -1,
'search_date_create_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1082if (!empty($arrayfields[
'e.tms'][
'checked'])) {
1083 print
'<td class="liste_titre">';
1087if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
1088 print
'<td class="liste_titre right parentonrightofpage">';
1089 print $form->selectarray(
'search_status', array(
'0' => $langs->trans(
'StatusReceptionDraftShort'),
'1' => $langs->trans(
'StatusReceptionValidatedShort'),
'2' => $langs->trans(
'StatusReceptionProcessedShort')), $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
1093if (!empty($arrayfields[
'e.billed'][
'checked'])) {
1094 print
'<td class="liste_titre maxwidthonsmartphone center">';
1095 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1);
1100 print
'<td class="liste_titre middle">';
1101 $searchpicto = $form->showFilterButtons();
1107$totalarray = array();
1108$totalarray[
'nbfield'] = 0;
1112print
'<tr class="liste_titre">';
1115 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1116 $totalarray[
'nbfield']++;
1118if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1119 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
'', $sortfield, $sortorder);
1120 $totalarray[
'nbfield']++;
1122if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
1123 print_liste_field_titre($arrayfields[
'e.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref_supplier",
"", $param,
'', $sortfield, $sortorder);
1124 $totalarray[
'nbfield']++;
1126if (!empty($arrayfields[
's.nom'][
'checked'])) {
1127 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder,
'left ');
1128 $totalarray[
'nbfield']++;
1130if (!empty($arrayfields[
's.town'][
'checked'])) {
1131 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1132 $totalarray[
'nbfield']++;
1134if (!empty($arrayfields[
's.zip'][
'checked'])) {
1135 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1136 $totalarray[
'nbfield']++;
1138if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1139 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1140 $totalarray[
'nbfield']++;
1142if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1143 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1144 $totalarray[
'nbfield']++;
1146if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1147 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1148 $totalarray[
'nbfield']++;
1150if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
1151 print_liste_field_titre($arrayfields[
'e.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
"e.date_delivery",
"", $param,
'', $sortfield, $sortorder,
'center ');
1152 $totalarray[
'nbfield']++;
1154if (!empty($arrayfields[
'l.ref'][
'checked'])) {
1155 print_liste_field_titre($arrayfields[
'l.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"l.ref",
"", $param,
'', $sortfield, $sortorder);
1156 $totalarray[
'nbfield']++;
1158if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
1159 print_liste_field_titre($arrayfields[
'l.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
"l.date_delivery",
"", $param,
'', $sortfield, $sortorder,
'center ');
1160 $totalarray[
'nbfield']++;
1163include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1165$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'$totalarray' => &$totalarray);
1166$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1167print $hookmanager->resPrint;
1168if (!empty($arrayfields[
'e.datec'][
'checked'])) {
1169 print_liste_field_titre($arrayfields[
'e.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"e.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1170 $totalarray[
'nbfield']++;
1172if (!empty($arrayfields[
'e.tms'][
'checked'])) {
1173 print_liste_field_titre($arrayfields[
'e.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"e.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1174 $totalarray[
'nbfield']++;
1176if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
1177 print_liste_field_titre($arrayfields[
'e.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"e.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
1178 $totalarray[
'nbfield']++;
1180if (!empty($arrayfields[
'e.billed'][
'checked'])) {
1181 print_liste_field_titre($arrayfields[
'e.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"e.billed",
"", $param,
'', $sortfield, $sortorder,
'center ');
1182 $totalarray[
'nbfield']++;
1186 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1187 $totalarray[
'nbfield']++;
1195$savnbfield = $totalarray[
'nbfield'];
1196$totalarray = array();
1197$totalarray[
'nbfield'] = 0;
1198$imaxinloop = ($limit ? min($num, $limit) : $num);
1199while ($i < $imaxinloop) {
1200 $obj = $db->fetch_object($resql);
1205 $reception->id = $obj->rowid;
1206 $reception->ref = $obj->ref;
1208 $reception->statut = $obj->status;
1209 $reception->status = $obj->status;
1210 $reception->socid = $obj->socid;
1211 $reception->billed = $obj->billed;
1213 $reception->fetch_thirdparty();
1217 $companystatic->id = $obj->socid;
1218 $companystatic->ref = $obj->name;
1219 $companystatic->name = $obj->name;
1221 if ($mode ==
'kanban') {
1223 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1224 print
'<div class="box-flex-container kanban">';
1226 $object->date_delivery = $obj->delivery_date;
1231 if ($massactionbutton || $massaction) {
1233 if (in_array(
$object->id, $arrayofselected)) {
1237 print
$object->getKanbanView(
'', array(
'thirdparty' => $companystatic->getNomUrl(1),
'selected' => $selected));
1238 if ($i == min($num, $limit) - 1) {
1243 print
'<tr class="oddeven">';
1247 print
'<td class="nowrap center">';
1248 if ($massactionbutton || $massaction) {
1250 if (in_array($obj->rowid, $arrayofselected)) {
1253 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1258 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1259 print
'<td class="nowraponall">';
1260 print $reception->getNomUrl(1);
1263 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$reception->id;
1264 print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
1268 $totalarray[
'nbfield']++;
1273 if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
1274 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).
'">';
1278 $totalarray[
'nbfield']++;
1283 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1284 print
'<td class="tdoverflowmax150">';
1285 print $companystatic->getNomUrl(1);
1288 $totalarray[
'nbfield']++;
1292 if (!empty($arrayfields[
's.town'][
'checked'])) {
1293 print
'<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).
'">';
1297 $totalarray[
'nbfield']++;
1301 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1302 print
'<td class="nocellnopadd center"">';
1306 $totalarray[
'nbfield']++;
1310 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1311 print
"<td>".dol_escape_htmltag($obj->state_name).
"</td>\n";
1313 $totalarray[
'nbfield']++;
1317 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1318 print
'<td class="center">';
1319 $tmparray =
getCountry($obj->fk_pays,
'all');
1323 $totalarray[
'nbfield']++;
1327 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1328 print
'<td class="center">';
1329 if (!isset($typenArray) || empty($typenArray)) {
1330 $typenArray = $formcompany->typent_array(1);
1332 if (isset($typenArray[$obj->typent_code])) {
1333 print $typenArray[$obj->typent_code];
1337 $totalarray[
'nbfield']++;
1342 if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
1343 print
'<td class="center">';
1351 $totalarray[
'nbfield']++;
1355 if (!empty($arrayfields[
'l.ref'][
'checked']) || !empty($arrayfields[
'l.date_delivery'][
'checked'])) {
1356 $reception->fetchObjectLinked($reception->id, $reception->element);
1358 if (count($reception->linkedObjects[
'delivery']) > 0) {
1359 $receiving = reset($reception->linkedObjects[
'delivery']);
1362 if (!empty($arrayfields[
'l.ref'][
'checked'])) {
1365 print !empty($receiving) ? $receiving->getNomUrl($db) :
'';
1369 if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
1371 print
'<td class="center">';
1378 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1381 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1382 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1383 print $hookmanager->resPrint;
1385 if (!empty($arrayfields[
'e.datec'][
'checked'])) {
1386 print
'<td class="center nowraponall">';
1387 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuserrel');
1390 $totalarray[
'nbfield']++;
1394 if (!empty($arrayfields[
'e.tms'][
'checked'])) {
1395 print
'<td class="center nowraponall">';
1396 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
1399 $totalarray[
'nbfield']++;
1403 if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
1404 print
'<td class="right nowrap">'.$reception->LibStatut($obj->status, 5).
'</td>';
1406 $totalarray[
'nbfield']++;
1410 if (!empty($arrayfields[
'e.billed'][
'checked'])) {
1411 print
'<td class="center">'.yn($obj->billed).
'</td>';
1413 $totalarray[
'nbfield']++;
1419 print
'<td class="nowrap center">';
1420 if ($massactionbutton || $massaction) {
1423 if (in_array($obj->rowid, $arrayofselected)) {
1426 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1431 $totalarray[
'nbfield']++;
1442 foreach ($arrayfields as $key => $val) {
1443 if (!empty($val[
'checked'])) {
1447 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
1451include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1453$parameters = array(
'arrayfields' => $arrayfields,
'totalarray' => $totalarray,
'sql' => $sql);
1454$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1455print $hookmanager->resPrint;
1463$hidegeneratedfilelistifempty = 1;
1464if ($massaction ==
'builddoc' || $action ==
'remove_file' || !empty($show_files)) {
1465 $hidegeneratedfilelistifempty = 0;
1469$urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1470$urlsource .= str_replace(
'&',
'&', $param);
1472$filedir = $diroutputmassaction;
1473$genallowed = $user->hasRight(
'reception',
'lire');
1474$delallowed = $user->hasRight(
'reception',
'creer');
1477print $formfile->showdocuments(
'massfilesarea_receipts',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage absolute discounts.
Class to manage suppliers invoices.
Class to manage receptions.
Class to manage third parties objects (customers, suppliers, prospects...)
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.