33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
51$langs->loadLangs(array(
"sendings",
"receptions",
'companies',
'bills',
'orders'));
53$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'shipmentlist';
57$action =
GETPOST(
'action',
'alpha');
58$massaction =
GETPOST(
'massaction',
'alpha');
59$toselect =
GETPOST(
'toselect',
'array:int');
61$optioncss =
GETPOST(
'optioncss',
'alpha');
62$mode =
GETPOST(
'mode',
'alpha');
65$search_ref_rcp =
GETPOST(
"search_ref_rcp");
66$search_ref_liv =
GETPOST(
'search_ref_liv');
67$search_ref_supplier =
GETPOST(
'search_ref_supplier');
68$search_company =
GETPOST(
"search_company");
69$search_town =
GETPOST(
'search_town',
'alpha');
70$search_zip =
GETPOST(
'search_zip',
'alpha');
71$search_state =
GETPOST(
"search_state");
72$search_country =
GETPOST(
"search_country",
'aZ09');
73$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
74$search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
75$search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
76$search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
77$search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
78$search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
79$search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
80$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
81$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
82$search_date_create_startday =
GETPOSTINT(
'search_date_create_startday');
83$search_date_create_startmonth =
GETPOSTINT(
'search_date_create_startmonth');
84$search_date_create_startyear =
GETPOSTINT(
'search_date_create_startyear');
85$search_date_create_endday =
GETPOSTINT(
'search_date_create_endday');
86$search_date_create_endmonth =
GETPOSTINT(
'search_date_create_endmonth');
87$search_date_create_endyear =
GETPOSTINT(
'search_date_create_endyear');
88$search_date_create_start =
dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear);
89$search_date_create_end =
dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear);
90$search_billed =
GETPOST(
"search_billed",
'intcomma');
91$search_status =
GETPOST(
'search_status',
'intcomma');
92$search_all =
GETPOST(
'search_all',
'alphanohtml');
93$search_note_private =
GETPOST(
'search_note_private',
'alpha');
94$search_note_public =
GETPOST(
'search_note_public',
'alpha');
97$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
98$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
101 $sortfield =
"e.ref";
106if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
110$offset = $limit * $page;
111$pageprev = $page - 1;
112$pagenext = $page + 1;
114$diroutputmassaction = $conf->reception->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
118$hookmanager->initHooks(array(
'receptionlist'));
122$extrafields->fetch_name_optionals_label(
$object->table_element);
123$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
126$fieldstosearchall = array(
128 'e.ref_supplier' =>
"RefSupplier",
129 's.nom' =>
"ThirdParty",
130 'e.note_public' =>
'NotePublic',
132if (empty($user->socid)) {
133 $fieldstosearchall[
"e.note_private"] =
"NotePrivate";
136$checkedtypetiers =
'0';
138 'e.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' =>
'1'),
139 'e.ref_supplier' => array(
'label' => $langs->trans(
"RefSupplier"),
'checked' =>
'1'),
140 's.nom' => array(
'label' => $langs->trans(
"ThirdParty"),
'checked' =>
'1'),
141 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' =>
'1'),
142 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' =>
'1'),
143 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' =>
'0'),
144 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' =>
'0'),
145 'typent.code' => array(
'label' => $langs->trans(
"ThirdPartyType"),
'checked' => $checkedtypetiers),
146 'e.date_delivery' => array(
'label' => $langs->trans(
"DateDeliveryPlanned"),
'checked' =>
'1'),
147 'e.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0',
'position' => 500),
148 'e.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' =>
'0',
'position' => 500),
149 'e.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES') ?
'0' :
'1')),
150 'e.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES') ?
'0' :
'1')),
151 'e.fk_statut' => array(
'label' => $langs->trans(
"Status"),
'checked' =>
'1',
'position' => 1000),
152 'e.billed' => array(
'label' => $langs->trans(
"Billed"),
'checked' =>
'1',
'position' => 1000,
'enabled' =>
'getDolGlobalString("WORKFLOW_BILL_ON_RECEPTION") !== "0"')
156include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
166 $socid = $user->socid;
175if (
GETPOST(
'cancel',
'alpha')) {
179if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_createbills') {
183$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
184$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
189include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
192if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
193 $search_ref_supplier =
'';
194 $search_ref_rcp =
'';
195 $search_ref_liv =
'';
196 $search_company =
'';
200 $search_country =
'';
201 $search_type_thirdparty =
'';
202 $search_date_delivery_startday =
'';
203 $search_date_delivery_startmonth =
'';
204 $search_date_delivery_startyear =
'';
205 $search_date_delivery_endday =
'';
206 $search_date_delivery_endmonth =
'';
207 $search_date_delivery_endyear =
'';
208 $search_date_delivery_start =
'';
209 $search_date_delivery_end =
'';
210 $search_date_create_startday =
'';
211 $search_date_create_startmonth =
'';
212 $search_date_create_startyear =
'';
213 $search_date_create_endday =
'';
214 $search_date_create_endmonth =
'';
215 $search_date_create_endyear =
'';
216 $search_date_create_start =
'';
217 $search_date_create_end =
'';
221 $search_array_options = array();
224if (empty($reshook)) {
226 $objectclass =
'Reception';
227 $objectlabel =
'Receptions';
228 $permissiontoread = $user->hasRight(
'reception',
'lire');
229 $permissiontoadd = $user->hasRight(
'reception',
'creer');
230 $permissiontodelete = $user->hasRight(
'reception',
'supprimer');
231 $uploaddir = $conf->reception->multidir_output[$conf->entity];
232 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
234 if ($massaction ==
'confirm_createbills' && ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"))) {
235 $receptions =
GETPOST(
'toselect',
'array:int');
236 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
237 $validate_invoices =
GETPOSTINT(
'validate_invoices');
242 $TFactThird = array();
243 '@phan-var FactureFournisseur[] $TFactThird';
244 $TFactThirdNbLines = array();
246 $nb_bills_created = 0;
254 foreach ($receptions as $id_reception) {
258 if ($rcp->fetch($id_reception) <= 0 || $rcp->statut == $rcp::STATUS_DRAFT) {
259 $errors[] = $langs->trans(
'StatusOfRefMustBe', $rcp->ref, $langs->transnoentities(
"StatusReceptionValidatedShort"));
265 if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
267 $objecttmp = $TFactThird[$rcp->socid];
270 $objecttmp->fetchObjectLinked();
271 $rcp->fetchObjectLinked();
272 if (!empty($rcp->linkedObjectsIds[
'order_supplier']) && is_array($rcp->linkedObjectsIds[
'order_supplier'])) {
273 foreach ($rcp->linkedObjectsIds[
'order_supplier'] as $key => $value) {
274 if (empty($objecttmp->linkedObjectsIds[
'order_supplier']) || !in_array($value, $objecttmp->linkedObjectsIds[
'order_supplier'])) {
275 $objecttmp->add_object_linked(
'order_supplier', $value);
280 $cond_reglement_id = 0;
281 $mode_reglement_id = 0;
283 $transport_mode_id = 0;
284 $multicurrency_code =
null;
286 if (!empty($rcp->cond_reglement_id)) {
287 $cond_reglement_id = $rcp->cond_reglement_id;
289 if (!empty($rcp->mode_reglement_id)) {
290 $mode_reglement_id = $rcp->mode_reglement_id;
292 if (!empty($rcp->fk_account)) {
293 $fk_account = $rcp->fk_account;
295 if (!empty($rcp->transport_mode_id)) {
296 $transport_mode_id = $rcp->transport_mode_id;
298 if (!empty($rcp->multicurrency_code)) {
299 $multicurrency_code = $rcp->multicurrency_code;
302 if (empty($cond_reglement_id)
303 || empty($mode_reglement_id)
304 || empty($fk_account)
305 || empty($transport_mode_id)
306 || empty($multicurrency_code)
308 if (!isset($rcp->supplier_order)) {
309 $rcp->fetch_origin();
313 if (!empty($rcp->origin_object)) {
314 $supplierOrder = $rcp->origin_object;
315 if (empty($cond_reglement_id) && !empty($supplierOrder->cond_reglement_id)) {
316 $cond_reglement_id = $supplierOrder->cond_reglement_id;
318 if (empty($mode_reglement_id) && !empty($supplierOrder->mode_reglement_id)) {
319 $mode_reglement_id = $supplierOrder->mode_reglement_id;
321 if (empty($fk_account) && !empty($supplierOrder->fk_account)) {
322 $fk_account = $supplierOrder->fk_account;
324 if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) {
325 $transport_mode_id = $supplierOrder->transport_mode_id;
327 if (empty($multicurrency_code) && !empty($supplierOrder->multicurrency_code)) {
328 $multicurrency_code = $supplierOrder->multicurrency_code;
333 if (!empty($rcp->thirdparty)) {
334 $soc = $rcp->thirdparty;
335 if (empty($cond_reglement_id) && !empty($soc->cond_reglement_supplier_id)) {
336 $cond_reglement_id = $soc->cond_reglement_supplier_id;
338 if (empty($mode_reglement_id) && !empty($soc->mode_reglement_supplier_id)) {
339 $mode_reglement_id = $soc->mode_reglement_supplier_id;
341 if (empty($fk_account) && !empty($soc->fk_account)) {
342 $fk_account = $soc->fk_account;
344 if (empty($transport_mode_id) && !empty($soc->transport_mode_id)) {
345 $transport_mode_id = $soc->transport_mode_id;
347 if (empty($multicurrency_code) && !empty($soc->multicurrency_code)) {
348 $multicurrency_code = $soc->multicurrency_code;
354 $objecttmp->socid = $rcp->socid;
355 $objecttmp->type = $objecttmp::TYPE_STANDARD;
356 $objecttmp->cond_reglement_id = $cond_reglement_id;
357 $objecttmp->mode_reglement_id = $mode_reglement_id;
358 $objecttmp->fk_account = $fk_account;
359 $objecttmp->transport_mode_id = $transport_mode_id;
360 $objecttmp->multicurrency_code = $multicurrency_code;
363 if (is_object($soc)) {
364 $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge;
367 $objecttmp->fk_project = $rcp->fk_project;
369 if (empty($createbills_onebythird)) {
370 $objecttmp->ref_supplier = $rcp->ref;
373 $objecttmp->ref_supplier = $langs->trans(
"Reception").
' '.
dol_print_date(
dol_now(),
'dayhourlog').
'-'.$rcp->socid;
377 if (empty($datefacture)) {
381 $objecttmp->date = $datefacture;
382 $objecttmp->origin =
'reception';
383 $objecttmp->origin_id = (int) $id_reception;
386 if (empty($objecttmp->date_echeance)) {
387 $objecttmp->date_echeance = $objecttmp->calculate_date_lim_reglement();
390 $objecttmp->array_options = $rcp->array_options;
393 $rcp->fetchObjectLinked();
394 if (count($rcp->linkedObjectsIds[
'order_supplier']) > 0) {
395 foreach ($rcp->linkedObjectsIds[
'order_supplier'] as $key => $value) {
396 $objecttmp->linked_objects[
'order_supplier'] = $value;
400 $res = $objecttmp->create($user);
405 $lastref = $objecttmp->ref;
406 $lastid = $objecttmp->id;
408 $TFactThird[$rcp->socid] = $objecttmp;
409 $TFactThirdNbLines[$rcp->socid] = 0;
411 $langs->load(
"errors");
412 $errors[] = $rcp->ref.
' : '.$langs->trans($objecttmp->error);
417 if ($objecttmp->id > 0) {
418 if (!isset($rcp->origin_object)) {
419 $rcp->fetch_origin();
421 if ($rcp->origin_object->multicurrency_code != $objecttmp->multicurrency_code) {
422 $errors[] = $rcp->ref.
" : ".$langs->trans(
"ReceptionMustBeInTheSameCurrencyThanOther");
425 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_reception);
428 $errors[] = $objecttmp->error;
433 $lines = $rcp->lines;
434 if (empty($lines) && method_exists($rcp,
'fetch_lines')) {
436 $lines = $rcp->lines;
440 $num = count($lines);
442 for ($i = 0; $i < $num; $i++) {
443 $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
445 if (!empty($createbills_onebythird)) {
446 $desc =
dol_concatdesc($desc, $langs->trans(
"Reception").
' '.$rcp->ref);
447 $desc .= (!empty($rcp->date_reception) ?
' - '.dol_print_date($rcp->date_reception,
'day') :
'');
450 if ($lines[$i]->subprice < 0) {
453 $discount->fk_soc = $objecttmp->socid;
454 $discount->socid = $objecttmp->socid;
455 $discount->amount_ht = abs($lines[$i]->total_ht);
456 $discount->amount_tva = abs($lines[$i]->total_tva);
457 $discount->amount_ttc = abs($lines[$i]->total_ttc);
458 $discount->tva_tx = $lines[$i]->tva_tx;
459 $discount->fk_user = $user->id;
460 $discount->description = $desc;
461 $discountid = $discount->create($user);
462 if ($discountid > 0) {
463 $result = $objecttmp->insert_discount($discountid);
472 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
475 if ($lines[$i]->date_debut_prevue) {
476 $date_start = $lines[$i]->date_debut_prevue;
478 if ($lines[$i]->date_debut_reel) {
479 $date_start = $lines[$i]->date_debut_reel;
481 if ($lines[$i]->date_start) {
482 $date_start = $lines[$i]->date_start;
486 if ($lines[$i]->date_fin_prevue) {
487 $date_end = $lines[$i]->date_fin_prevue;
489 if ($lines[$i]->date_fin_reel) {
490 $date_end = $lines[$i]->date_fin_reel;
492 if ($lines[$i]->date_end) {
493 $date_end = $lines[$i]->date_end;
496 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
501 if (method_exists($lines[$i],
'fetch_optionals')) {
502 $lines[$i]->fetch_optionals();
503 $array_options = $lines[$i]->array_options;
506 $objecttmp->context[
'createfromclone'] =
'createfromclone';
510 if (!empty($createbills_onebythird)) {
511 $rang = $TFactThirdNbLines[$rcp->socid];
514 $result = $objecttmp->addline(
516 $lines[$i]->subprice,
518 $lines[$i]->localtax1_tx,
519 $lines[$i]->localtax2_tx,
521 $lines[$i]->fk_product,
522 $lines[$i]->remise_percent,
526 (
int) $lines[$i]->info_bits,
534 $lines[$i]->multicurrency_subprice,
535 $lines[$i]->ref_supplier
538 $rcp->add_object_linked(
'facture_fourn_det', $result);
542 if (!empty($createbills_onebythird)) {
543 $TFactThirdNbLines[$rcp->socid]++;
551 if ($result > 0 && $lines[$i]->product_type == 9) {
552 $fk_parent_line = $result;
561 if (!empty($createbills_onebythird) && empty($TFactThird[$rcp->socid])) {
562 $TFactThird[$rcp->socid] = $objecttmp;
564 $TFact[$objecttmp->id] = $objecttmp;
569 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
572 if (!$error && $validate_invoices) {
573 $massaction = $action =
'builddoc';
574 foreach ($TAllFact as &$objecttmp) {
575 $result = $objecttmp->validate($user);
582 $id = $objecttmp->id;
583 $lastref = $objecttmp->ref;
588 $upload_dir = $conf->fournisseur->facture->dir_output;
589 $permissiontoadd = ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer'));
594 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
598 $massaction = $action =
'confirm_createbills';
604 if ($nb_bills_created == 1) {
605 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
606 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
609 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
615 $_GET[
"origin"] = $_POST[
"origin"];
616 $_GET[
"originid"] = $_POST[
"originid"];
630$form =
new Form($db);
631$companystatic =
new Societe($db);
636$title = $langs->trans(
'Receptions');
637$helpurl =
'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
638llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-reception page-list');
640$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,e.note_private, e.note_public,";
641$sql .=
" s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,";
642$sql .=
" typent.code as typent_code,";
643$sql .=
" state.code_departement as state_code, state.nom as state_name,";
644$sql .=
" e.date_creation as date_creation, e.tms as date_modification";
646if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
647 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
648 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
652$parameters = array();
653$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
654$sql .= $hookmanager->resPrint;
658$sql .=
" FROM ".MAIN_DB_PREFIX.
"reception as e";
659if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
660 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (e.rowid = ef.fk_object)";
662$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
663$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
664$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
665$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
666$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'reception' AND ee.targettype = 'delivery'";
667$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"delivery as l ON l.rowid = ee.fk_target";
669$parameters = array();
671$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
672$sql .= $hookmanager->resPrint;
673$sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
675 $sql .=
" AND e.fk_soc = ".((int) $socid);
677if ($search_status !=
'' && $search_status >= 0) {
678 $sql .=
" AND e.fk_statut = ".((int) $search_status);
680if ($search_billed !=
'' && $search_billed >= 0) {
681 $sql .=
' AND e.billed = '.((int) $search_billed);
692if ($search_country) {
693 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
695if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
696 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
698if ($search_date_delivery_start) {
699 $sql .=
" AND e.date_delivery >= '".$db->idate($search_date_delivery_start).
"'";
701if ($search_date_delivery_end) {
702 $sql .=
" AND e.date_delivery <= '".$db->idate($search_date_delivery_end).
"'";
704if ($search_date_create_start) {
705 $sql .=
" AND e.date_creation >= '".$db->idate($search_date_create_start).
"'";
708if ($search_note_public) {
709 $sql .=
" AND e.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
711if ($search_note_private) {
712 $sql .=
" AND e.note_private LIKE '%".$db->escape($db->escapeforlike($search_note_private)).
"%'";
714if ($search_date_create_end) {
715 $sql .=
" AND e.date_creation <= '".$db->idate($search_date_create_end).
"'";
717if ($search_ref_rcp) {
720if ($search_ref_liv) {
723if ($search_company) {
726if ($search_ref_supplier) {
730 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
743include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
745$parameters = array();
746$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
747$sql .= $hookmanager->resPrint;
750$parameters = array();
751$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
752if (empty($reshook)) {
753 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
755 $sql = $hookmanager->resPrint;
758$nbtotalofrecords =
'';
761 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
762 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
763 $resql = $db->query($sqlforcount);
765 $objforcount = $db->fetch_object($resql);
766 $nbtotalofrecords = $objforcount->nbtotalofrecords;
771 if (($page * $limit) > (
int) $nbtotalofrecords) {
779$sql .= $db->order($sortfield, $sortorder);
781 $sql .= $db->plimit($limit + 1, $offset);
785$resql = $db->query($sql);
791$num = $db->num_rows($resql);
795$arrayofselected = is_array($toselect) ? $toselect : array();
799 $param .=
'&mode='.urlencode($mode);
801if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
802 $param .=
'&contextpage='.urlencode($contextpage);
804if ($limit > 0 && $limit != $conf->liste_limit) {
805 $param .=
'&limit='.((int) $limit);
808 $param .=
"&search_all=".urlencode($search_all);
810if ($search_ref_rcp) {
811 $param .=
"&search_ref_rcp=".urlencode($search_ref_rcp);
813if ($search_ref_liv) {
814 $param .=
"&search_ref_liv=".urlencode($search_ref_liv);
816if ($search_company) {
817 $param .=
"&search_company=".urlencode($search_company);
819if ($optioncss !=
'') {
820 $param .=
'&optioncss='.urlencode($optioncss);
822if ($search_billed !=
'' && $search_billed >= 0) {
823 $param .=
"&search_billed=".urlencode((
string) ($search_billed));
826 $param .=
"&search_town=".urlencode($search_town);
829 $param .=
"&search_zip=".urlencode($search_zip);
832 $param .=
"&search_state=".urlencode($search_state);
834if ($search_status !=
'') {
835 $param .=
"&search_status=".urlencode($search_status);
837if ($search_country) {
838 $param .=
"&search_country=".urlencode((
string) ($search_country));
840if ($search_type_thirdparty) {
841 $param .=
"&search_type_thirdparty=".urlencode((
string) ($search_type_thirdparty));
843if ($search_date_delivery_startday) {
844 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
846if ($search_date_delivery_startmonth) {
847 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
849if ($search_date_delivery_startyear) {
850 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
852if ($search_date_delivery_endday) {
853 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
855if ($search_date_delivery_endmonth) {
856 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
858if ($search_date_delivery_endyear) {
859 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
861if ($search_date_create_startday) {
862 $param .=
'&search_date_create_startday='.urlencode((
string) ($search_date_create_startday));
864if ($search_date_create_startmonth) {
865 $param .=
'&search_date_create_startmonth='.urlencode((
string) ($search_date_create_startmonth));
867if ($search_date_create_startyear) {
868 $param .=
'&search_date_create_startyear='.urlencode((
string) ($search_date_create_startyear));
870if ($search_date_create_endday) {
871 $param .=
'&search_date_create_endday='.urlencode((
string) ($search_date_create_endday));
873if ($search_date_create_endmonth) {
874 $param .=
'&search_date_create_endmonth='.urlencode((
string) ($search_date_create_endmonth));
876if ($search_date_create_endyear) {
877 $param .=
'&search_date_create_endyear='.urlencode((
string) ($search_date_create_endyear));
879if ($search_ref_supplier) {
880 $param .=
"&search_ref_supplier=".urlencode($search_ref_supplier);
883if ($search_array_options) {
884 foreach ($search_array_options as $key => $val) {
886 $tmpkey = preg_replace(
'/search_options_/',
'', $key);
887 if (is_array($val) && array_key_exists(
'start', $val) && array_key_exists(
'end', $val)) {
890 $param .=
'&search_options_'.$tmpkey.
'_startyear='.
dol_print_date($val[
'start'],
'%Y');
891 $param .=
'&search_options_'.$tmpkey.
'_startmonth='.
dol_print_date($val[
'start'],
'%m');
892 $param .=
'&search_options_'.$tmpkey.
'_startday='.
dol_print_date($val[
'start'],
'%d');
893 $param .=
'&search_options_'.$tmpkey.
'_starthour='.
dol_print_date($val[
'start'],
'%H');
894 $param .=
'&search_options_'.$tmpkey.
'_startmin='.
dol_print_date($val[
'start'],
'%M');
896 $param .=
'&search_options_'.$tmpkey.
'_endyear='.
dol_print_date($val[
'end'],
'%Y');
897 $param .=
'&search_options_'.$tmpkey.
'_endmonth='.
dol_print_date($val[
'end'],
'%m');
898 $param .=
'&search_options_'.$tmpkey.
'_endday='.
dol_print_date($val[
'end'],
'%d');
899 $param .=
'&search_options_'.$tmpkey.
'_endhour='.
dol_print_date($val[
'end'],
'%H');
900 $param .=
'&search_options_'.$tmpkey.
'_endmin='.
dol_print_date($val[
'end'],
'%M');
904 $param .=
'&search_options_'.$tmpkey.
'='.urlencode($val);
910$arrayofmassactions = array(
911 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
915if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer')) {
916 $arrayofmassactions[
'createbills'] = $langs->trans(
"CreateInvoiceForThisReceptions");
918if (in_array($massaction, array(
'presend',
'createbills'))) {
919 $arrayofmassactions = array();
921$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
928$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'));
929$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'));
931$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewReception'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/reception/card.php?action=create2',
'', $user->hasRight(
'reception',
'creer'));
934print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
935if ($optioncss !=
'') {
936 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
938print
'<input type="hidden" name="token" value="'.newToken().
'">';
939print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
940print
'<input type="hidden" name="action" value="list">';
941print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
942print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
943print
'<input type="hidden" name="mode" value="'.$mode.
'">';
946print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'dollyrevert', 0, $newcardbutton,
'', $limit, 0, 0, 1);
948if ($massaction ==
'createbills') {
950 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
952 print
'<table class="noborder centpercent">';
954 print
'<td class="titlefieldmiddle">';
955 print $langs->trans(
'DateInvoice');
958 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
963 print $langs->trans(
'CreateOneBillByThird');
966 print $form->selectyesno(
'createbills_onebythird',
'', 1);
971 print $langs->trans(
'ValidateInvoices');
975 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
976 print
' ('.$langs->trans(
"AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").
')';
978 print $form->selectyesno(
'validate_invoices', 0, 1);
985 print
'<div class="center">';
986 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisReceptions').
'"> ';
987 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
993 foreach ($fieldstosearchall as $key => $val) {
994 $fieldstosearchall[$key] = $langs->trans($val);
996 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1001if (!empty($moreforfilter)) {
1002 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1003 print $moreforfilter;
1004 $parameters = array(
'type' => $type);
1005 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1006 print $hookmanager->resPrint;
1010$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1011$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1012if ($massactionbutton) {
1013 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1016print
'<div class="div-table-responsive">';
1017print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1021print
'<tr class="liste_titre_filter">';
1024 print
'<td class="liste_titre center maxwidthsearch">';
1025 $searchpicto = $form->showFilterButtons(
'left');
1030if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1031 print
'<td class="liste_titre">';
1032 print
'<input class="flat" size="6" type="text" name="search_ref_rcp" value="'.$search_ref_rcp.
'">';
1036if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
1037 print
'<td class="liste_titre">';
1038 print
'<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.
'">';
1042if (!empty($arrayfields[
's.nom'][
'checked'])) {
1043 print
'<td class="liste_titre left">';
1044 print
'<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1048if (!empty($arrayfields[
's.town'][
'checked'])) {
1049 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
1052if (!empty($arrayfields[
's.zip'][
'checked'])) {
1053 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.
'"></td>';
1056if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1057 print
'<td class="liste_titre">';
1058 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1062if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1063 print
'<td class="liste_titre center">';
1064 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1068if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1069 print
'<td class="liste_titre maxwidthonsmartphone center">';
1070 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);
1074if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
1075 print
'<td class="liste_titre center">';
1076 print
'<div class="nowrapfordate">';
1077 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'));
1079 print
'<div class="nowrapfordate">';
1080 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'));
1084if (!empty($arrayfields[
'l.ref'][
'checked'])) {
1086 print
'<td class="liste_titre">';
1087 print
'<input class="flat" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).
'"';
1090if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
1092 print
'<td class="liste_titre center"> </td>';
1095include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1098$parameters = array(
'arrayfields' => $arrayfields);
1099$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1100print $hookmanager->resPrint;
1102if (!empty($arrayfields[
'e.datec'][
'checked'])) {
1103 print
'<td class="liste_titre center">';
1104 print
'<div class="nowrapfordate">';
1105 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'));
1107 print
'<div class="nowrapfordate">';
1108 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'));
1113if (!empty($arrayfields[
'e.tms'][
'checked'])) {
1114 print
'<td class="liste_titre">';
1117if (!empty($arrayfields[
'e.note_public'][
'checked'])) {
1119 print
'<td class="liste_titre">';
1120 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1123if (!empty($arrayfields[
'e.note_private'][
'checked'])) {
1125 print
'<td class="liste_titre">';
1126 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1130if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
1131 print
'<td class="liste_titre right parentonrightofpage">';
1132 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');
1136if (!empty($arrayfields[
'e.billed'][
'checked'])) {
1137 print
'<td class="liste_titre maxwidthonsmartphone center">';
1138 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1);
1143 print
'<td class="liste_titre middle">';
1144 $searchpicto = $form->showFilterButtons();
1155print
'<tr class="liste_titre">';
1158 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1161if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1163 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
'', $sortfield, $sortorder);
1166if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
1167 print_liste_field_titre($arrayfields[
'e.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref_supplier",
"", $param,
'', $sortfield, $sortorder);
1170if (!empty($arrayfields[
's.nom'][
'checked'])) {
1171 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder,
'left ');
1174if (!empty($arrayfields[
's.town'][
'checked'])) {
1175 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1178if (!empty($arrayfields[
's.zip'][
'checked'])) {
1179 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1182if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1183 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1186if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1187 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1190if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1191 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1194if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
1195 print_liste_field_titre($arrayfields[
'e.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
"e.date_delivery",
"", $param,
'', $sortfield, $sortorder,
'center ');
1198if (!empty($arrayfields[
'l.ref'][
'checked'])) {
1199 print_liste_field_titre($arrayfields[
'l.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"l.ref",
"", $param,
'', $sortfield, $sortorder);
1202if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
1203 print_liste_field_titre($arrayfields[
'l.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
"l.date_delivery",
"", $param,
'', $sortfield, $sortorder,
'center ');
1207include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1209$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'$totalarray' => &$totalarray);
1210$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1211print $hookmanager->resPrint;
1212if (!empty($arrayfields[
'e.datec'][
'checked'])) {
1213 print_liste_field_titre($arrayfields[
'e.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"e.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1216if (!empty($arrayfields[
'e.tms'][
'checked'])) {
1217 print_liste_field_titre($arrayfields[
'e.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"e.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1220if (!empty($arrayfields[
'e.note_public'][
'checked'])) {
1221 print_liste_field_titre($arrayfields[
'e.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"e.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1224if (!empty($arrayfields[
'e.note_private'][
'checked'])) {
1225 print_liste_field_titre($arrayfields[
'e.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"e.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1228if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
1229 print_liste_field_titre($arrayfields[
'e.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"e.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
1232if (!empty($arrayfields[
'e.billed'][
'checked'])) {
1233 print_liste_field_titre($arrayfields[
'e.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"e.billed",
"", $param,
'', $sortfield, $sortorder,
'center ');
1238 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1250$imaxinloop = ($limit ? min($num, $limit) : $num);
1251while ($i < $imaxinloop) {
1252 $obj = $db->fetch_object($resql);
1257 $reception->id = $obj->rowid;
1258 $reception->ref = $obj->ref;
1260 $reception->statut = $obj->status;
1261 $reception->status = $obj->status;
1262 $reception->socid = $obj->socid;
1263 $reception->billed = $obj->billed;
1264 $reception->note_public = $obj->note_public;
1265 $reception->note_private = $obj->note_private;
1267 $reception->fetch_thirdparty();
1271 $companystatic->id = $obj->socid;
1272 $companystatic->ref = $obj->name;
1273 $companystatic->name = $obj->name;
1275 if ($mode ==
'kanban') {
1277 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1278 print
'<div class="box-flex-container kanban">';
1280 $object->date_delivery = $obj->delivery_date;
1285 if ($massactionbutton || $massaction) {
1287 if (in_array(
$object->id, $arrayofselected)) {
1291 print
$object->getKanbanView(
'', array(
'thirdparty' => $companystatic->getNomUrl(1),
'selected' => $selected));
1292 if ($i == min($num, $limit) - 1) {
1297 print
'<tr class="oddeven">';
1301 print
'<td class="nowrap center">';
1302 if ($massactionbutton || $massaction) {
1304 if (in_array($obj->rowid, $arrayofselected)) {
1307 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1312 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
1313 print
'<td class="nowraponall">';
1314 print $reception->getNomUrl(1);
1317 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$reception->id;
1318 print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
1327 if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
1328 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).
'">';
1337 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1338 print
'<td class="tdoverflowmax150">';
1339 print $companystatic->getNomUrl(1);
1346 if (!empty($arrayfields[
's.town'][
'checked'])) {
1347 print
'<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).
'">';
1355 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1356 print
'<td class="nocellnopadd center"">';
1364 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1365 print
"<td>".dol_escape_htmltag($obj->state_name).
"</td>\n";
1371 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1372 print
'<td class="center">';
1373 $tmparray =
getCountry($obj->fk_pays,
'all');
1381 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1382 print
'<td class="center">';
1383 if (!isset($typenArray) || empty($typenArray)) {
1384 $typenArray = $formcompany->typent_array(1);
1386 if (isset($typenArray[$obj->typent_code])) {
1387 print $typenArray[$obj->typent_code];
1396 if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
1397 print
'<td class="center">';
1409 if (!empty($arrayfields[
'l.ref'][
'checked']) || !empty($arrayfields[
'l.date_delivery'][
'checked'])) {
1410 $reception->fetchObjectLinked($reception->id, $reception->element);
1412 if (count($reception->linkedObjects[
'delivery']) > 0) {
1413 $receiving = reset($reception->linkedObjects[
'delivery']);
1416 if (!empty($arrayfields[
'l.ref'][
'checked'])) {
1419 print !empty($receiving) ? $receiving->getNomUrl($db) :
'';
1423 if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
1425 print
'<td class="center">';
1432 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1435 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1436 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1437 print $hookmanager->resPrint;
1439 if (!empty($arrayfields[
'e.datec'][
'checked'])) {
1440 print
'<td class="center nowraponall">';
1441 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuserrel');
1448 if (!empty($arrayfields[
'e.tms'][
'checked'])) {
1449 print
'<td class="center nowraponall">';
1450 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
1457 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1458 print
'<td class="sensiblehtmlcontent center">';
1459 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
1466 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1467 print
'<td class="sensiblehtmlcontent center">';
1468 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
1475 if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
1476 print
'<td class="right nowrap">'.$reception->LibStatut($obj->status, 5).
'</td>';
1482 if (!empty($arrayfields[
'e.billed'][
'checked'])) {
1483 print
'<td class="center">'.yn($obj->billed).
'</td>';
1491 print
'<td class="nowrap center">';
1492 if ($massactionbutton || $massaction) {
1495 if (in_array($obj->rowid, $arrayofselected)) {
1498 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1514 foreach ($arrayfields as $key => $val) {
1515 if (!empty($val[
'checked'])) {
1519 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
1523include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1525$parameters = array(
'arrayfields' => $arrayfields,
'totalarray' => $totalarray,
'sql' => $sql);
1526$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1527print $hookmanager->resPrint;
1535$hidegeneratedfilelistifempty = 1;
1536if ($massaction ==
'builddoc' || $action ==
'remove_file') {
1537 $hidegeneratedfilelistifempty = 0;
1541$urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1542$urlsource .= str_replace(
'&',
'&', $param);
1544$filedir = $diroutputmassaction;
1545$genallowed = $user->hasRight(
'reception',
'lire');
1546$delallowed = $user->hasRight(
'reception',
'creer');
1549print $formfile->showdocuments(
'massfilesarea_receipts',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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_now($mode='gmt')
Return date for now.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.