38require
'../../main.inc.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formorder.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
62$langs->loadLangs(array(
"orders",
"sendings",
'companies',
'compta',
'bills',
'projects',
'suppliers',
'products'));
65$action =
GETPOST(
'action',
'aZ09');
66$massaction =
GETPOST(
'massaction',
'alpha');
68$confirm =
GETPOST(
'confirm',
'alpha');
69$toselect =
GETPOST(
'toselect',
'array:int');
70$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierorderlist';
71$mode =
GETPOST(
'mode',
'alpha');
74$search_date_order_startday =
GETPOSTINT(
'search_date_order_startday');
75$search_date_order_startmonth =
GETPOSTINT(
'search_date_order_startmonth');
76$search_date_order_startyear =
GETPOSTINT(
'search_date_order_startyear');
77$search_date_order_endday =
GETPOSTINT(
'search_date_order_endday');
78$search_date_order_endmonth =
GETPOSTINT(
'search_date_order_endmonth');
79$search_date_order_endyear =
GETPOSTINT(
'search_date_order_endyear');
80$search_date_order_start =
dol_mktime(0, 0, 0, $search_date_order_startmonth, $search_date_order_startday, $search_date_order_startyear);
81$search_date_order_end =
dol_mktime(23, 59, 59, $search_date_order_endmonth, $search_date_order_endday, $search_date_order_endyear);
83$search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
84$search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
85$search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
86$search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
87$search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
88$search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
89$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
90$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
92$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
93$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
94$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
95$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
96$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
97$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
98$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
99$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
101$search_date_approve_startday =
GETPOSTINT(
'search_date_approve_startday');
102$search_date_approve_startmonth =
GETPOSTINT(
'search_date_approve_startmonth');
103$search_date_approve_startyear =
GETPOSTINT(
'search_date_approve_startyear');
104$search_date_approve_endday =
GETPOSTINT(
'search_date_approve_endday');
105$search_date_approve_endmonth =
GETPOSTINT(
'search_date_approve_endmonth');
106$search_date_approve_endyear =
GETPOSTINT(
'search_date_approve_endyear');
107$search_date_approve_start =
dol_mktime(0, 0, 0, $search_date_approve_startmonth, $search_date_approve_startday, $search_date_approve_startyear);
108$search_date_approve_end =
dol_mktime(23, 59, 59, $search_date_approve_endmonth, $search_date_approve_endday, $search_date_approve_endyear);
110$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
112$searchCategorySupplierOrderList =
GETPOST(
'search_category_supplier_order_list',
'array:int');
113$searchCategorySupplierOrderOperator = 0;
115 $searchCategorySupplierOrderOperator =
GETPOSTINT(
'search_category_supplier_order_operator');
117 $searchCategorySupplierOrderOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
119$search_product_category =
GETPOSTINT(
'search_product_category');
120$search_ref =
GETPOST(
'search_ref',
'alpha');
121$search_refsupp =
GETPOST(
'search_refsupp',
'alpha');
122$search_company =
GETPOST(
'search_company',
'alpha');
123$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
124$search_town =
GETPOST(
'search_town',
'alpha');
125$search_zip =
GETPOST(
'search_zip',
'alpha');
126$search_state =
GETPOST(
"search_state",
'alpha');
127$search_country =
GETPOST(
"search_country",
'aZ09');
128$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
129$search_user =
GETPOST(
'search_user',
'intcomma');
130$search_request_author =
GETPOST(
'search_request_author',
'alpha');
131$optioncss =
GETPOST(
'optioncss',
'alpha');
133$search_sale =
GETPOST(
'search_sale',
'intcomma');
134$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
135$search_total_tva =
GETPOST(
'search_total_tva',
'alpha');
136$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
137$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
138$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
139$search_note_private =
GETPOST(
'search_note_private',
'alpha');
140$search_note_public =
GETPOST(
'search_note_public',
'alpha');
141$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
142$search_multicurrency_montant_tva =
GETPOST(
'search_multicurrency_montant_tva',
'alpha');
143$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
144$optioncss =
GETPOST(
'optioncss',
'alpha');
145$billed =
GETPOST(
'billed',
'int');
146$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
147$search_btn =
GETPOST(
'button_search',
'alpha');
148$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
151 $search_status = implode(
',',
GETPOST(
'search_status',
'array:intcomma'));
153 $search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') :
GETPOST(
'statut',
'intcomma'));
156$search_option =
GETPOST(
'search_option',
'alpha');
157if ($search_option ==
'late') {
158 $search_status =
'1,2';
160if ($search_option ==
'recv_late') {
161 $search_status =
'3,4';
166$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
167$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
169if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
173$offset = $limit * $page;
174$pageprev = $page - 1;
175$pagenext = $page + 1;
177 $sortfield =
'cf.ref';
185$hookmanager->initHooks(array(
'supplierorderlist'));
188$extrafields->fetch_name_optionals_label(
$object->table_element);
189$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
191$diroutputmassaction =
getMultidirTemp($object).
'/massgeneration/'.$user->id;
194$fieldstosearchall = array();
195foreach (
$object->fields as $key => $val) {
196 if (!empty($val[
'searchall'])) {
197 $fieldstosearchall[
'cf.'.$key] = $val[
'label'];
200$fieldstosearchall[
'pd.description'] =
'Description';
201$fieldstosearchall[
's.nom'] =
"ThirdParty";
202$fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
203$fieldstosearchall[
's.zip'] =
"Zip";
204$fieldstosearchall[
's.town'] =
"Town";
205if (empty($user->socid)) {
206 $fieldstosearchall[
"cf.note_private"] =
"NotePrivate";
209$enabledtypetiers = 0;
213 'u.login' => array(
'label' =>
"AuthorRequest",
'enabled' =>
'1',
'position' => 41),
214 's.name_alias' => array(
'label' =>
"AliasNameShort",
'position' => 51,
'checked' =>
'0'),
215 's.town' => array(
'label' =>
"Town",
'enabled' =>
'1',
'position' => 55,
'checked' =>
'0'),
216 's.zip' => array(
'label' =>
"Zip",
'enabled' =>
'1',
'position' => 56,
'checked' =>
'1'),
217 'state.nom' => array(
'label' =>
"StateShort",
'enabled' =>
'1',
'position' => 57),
218 'country.code_iso' => array(
'label' =>
"Country",
'enabled' =>
'1',
'position' => 58),
219 'typent.code' => array(
'label' =>
"ThirdPartyType",
'enabled' => $enabledtypetiers,
'position' => 59),
220 'cf.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
string) (
int) (
$mysoc->localtax1_assuj ==
"1"),
'position' => 140),
221 'cf.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
string) (
int) (
$mysoc->localtax2_assuj ==
"1"),
'position' => 145),
222 'cf.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 750),
223 'cf.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 760),
225foreach (
$object->fields as $key => $val) {
227 if (!empty($val[
'visible'])) {
228 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
229 $arrayfields[
'cf.'.$key] = array(
230 'label' => $val[
'label'],
231 'checked' => (($visible < 0) ?
'0' :
'1'),
232 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
233 'position' => $val[
'position'],
234 'help' => isset($val[
'help']) ? $val[
'help'] :
''
239include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
241$parameters = array(
'arrayfields' => &$arrayfields);
242$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
250if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
251 $search_sale = $user->isExternalUser();
256if ($user->isExternalUser()) {
257 $socid = $user->isExternalUser();
259$result =
restrictedArea($user,
'fournisseur', $orderid,
'',
'commande');
261$permissiontoread = ($user->hasRight(
"fournisseur",
"commande",
"lire") || $user->hasRight(
"supplier_order",
"lire"));
262$permissiontoadd = ($user->hasRight(
"fournisseur",
"commande",
"creer") || $user->hasRight(
"supplier_order",
"creer"));
263$permissiontodelete = ($user->hasRight(
"fournisseur",
"commande",
"supprimer") || $user->hasRight(
"supplier_order",
"supprimer"));
264$permissiontovalidate = $permissiontoadd;
265$permissiontoapprove = ($user->hasRight(
"fournisseur",
"commande",
"approuver") || $user->hasRight(
"supplier_order",
"approuver"));
272if (
GETPOST(
'cancel',
'alpha')) {
276if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createsupplierbills') {
280$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
281$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
283 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
286if (empty($reshook)) {
288 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
291 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
295 $search_product_category =
'';
296 $searchCategorySupplierOrderList = array();
298 $search_refsupp =
'';
299 $search_company =
'';
300 $search_company_alias =
'';
305 $search_country =
'';
306 $search_type_thirdparty =
'';
307 $search_request_author =
'';
308 $search_total_ht =
'';
309 $search_total_tva =
'';
310 $search_total_ttc =
'';
311 $search_multicurrency_code =
'';
312 $search_multicurrency_tx =
'';
313 $search_multicurrency_montant_ht =
'';
314 $search_multicurrency_montant_tva =
'';
315 $search_multicurrency_montant_ttc =
'';
316 $search_project_ref =
'';
319 $search_date_order_startday =
'';
320 $search_date_order_startmonth =
'';
321 $search_date_order_startyear =
'';
322 $search_date_order_endday =
'';
323 $search_date_order_endmonth =
'';
324 $search_date_order_endyear =
'';
325 $search_date_order_start =
'';
326 $search_date_order_end =
'';
327 $search_date_delivery_startday =
'';
328 $search_date_delivery_startmonth =
'';
329 $search_date_delivery_startyear =
'';
330 $search_date_delivery_endday =
'';
331 $search_date_delivery_endmonth =
'';
332 $search_date_delivery_endyear =
'';
333 $search_date_delivery_start =
'';
334 $search_date_delivery_end =
'';
335 $search_date_valid_startday =
'';
336 $search_date_valid_startmonth =
'';
337 $search_date_valid_startyear =
'';
338 $search_date_valid_endday =
'';
339 $search_date_valid_endmonth =
'';
340 $search_date_valid_endyear =
'';
341 $search_date_valid_start =
'';
342 $search_date_valid_end =
'';
343 $search_date_approve_startday =
'';
344 $search_date_approve_startmonth =
'';
345 $search_date_approve_startyear =
'';
346 $search_date_approve_endday =
'';
347 $search_date_approve_endmonth =
'';
348 $search_date_approve_endyear =
'';
349 $search_date_approve_start =
'';
350 $search_date_approve_end =
'';
353 $search_array_options = array();
355 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
356 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
361 $objectclass =
'CommandeFournisseur';
362 $objectlabel =
'SupplierOrders';
364 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
366 if ($action ==
'validate' && $permissiontovalidate) {
367 if (
GETPOST(
'confirm') ==
'yes') {
372 foreach ($toselect as $checked) {
373 if ($objecttmp->fetch($checked)) {
374 if ($objecttmp->statut == 0) {
375 $objecttmp->date_commande =
dol_now();
376 $result = $objecttmp->valid($user);
379 if (!
getDolGlobalString(
'SUPPLIER_ORDER_NO_DIRECT_APPROVE') && $permissiontoapprove && !(
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') && $objecttmp->hasProductsOrServices(1))) {
380 $result = $objecttmp->approve($user);
381 setEventMessages($langs->trans(
"SupplierOrderValidatedAndApproved"), array($objecttmp->ref));
383 setEventMessages($langs->trans(
"SupplierOrderValidated"), array($objecttmp->ref));
386 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
402 if ($massaction ==
'confirm_createsupplierbills') {
403 $orders =
GETPOST(
'toselect',
'array:int');
404 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
405 $validate_invoices =
GETPOSTINT(
'validate_invoices');
409 $TFactThird = array();
411 $nb_bills_created = 0;
419 foreach ($orders as $id_order) {
421 if ($cmd->fetch($id_order) <= 0) {
426 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
428 $objecttmp = $TFactThird[$cmd->socid];
431 if (!empty($cmd->socid) > 0) {
433 $societe->fetch($cmd->socid);
434 $objecttmp->vat_reverse_charge = $societe->vat_reverse_charge;
435 $objecttmp->thirdparty = $societe;
437 $objecttmp->socid = $cmd->socid;
438 $objecttmp->type = $objecttmp::TYPE_STANDARD;
439 $objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
440 $objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
441 $objecttmp->fk_project = $cmd->fk_project;
442 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
443 $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier;
444 $default_ref_supplier += 1;
447 if (empty($datefacture)) {
451 $objecttmp->date = $datefacture;
452 $objecttmp->origin =
'order_supplier';
453 $objecttmp->origin_id = (int) $id_order;
455 $res = $objecttmp->create($user);
459 $lastref = $objecttmp->ref;
460 $lastid = $objecttmp->id;
462 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
467 if ($objecttmp->id > 0) {
468 if (empty($objecttmp->note_public)) {
469 $objecttmp->note_public = $langs->transnoentities(
"Orders");
472 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"element_element (";
474 $sql .=
", sourcetype";
475 $sql .=
", fk_target";
476 $sql .=
", targettype";
477 $sql .=
") VALUES (";
478 $sql .= ((int) $id_order);
479 $sql .=
", '".$db->escape($objecttmp->origin).
"'";
480 $sql .=
", ".((int) $objecttmp->id);
481 $sql .=
", '".$db->escape($objecttmp->element).
"'";
484 if (!$db->query($sql)) {
489 $lines = $cmd->lines;
490 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
492 $lines = $cmd->lines;
496 $num = count($lines);
498 for ($i = 0; $i < $num; $i++) {
499 $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
501 if (!empty($createbills_onebythird)) {
504 if ($lines[$i]->subprice < 0) {
505 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
509 $discount->fk_soc = $objecttmp->socid;
510 $discount->socid = $objecttmp->socid;
511 $discount->amount_ht = abs($lines[$i]->total_ht);
512 $discount->amount_tva = abs($lines[$i]->total_tva);
513 $discount->amount_ttc = abs($lines[$i]->total_ttc);
514 $discount->tva_tx = $lines[$i]->tva_tx;
515 $discount->fk_user = $user->id;
516 $discount->description = $desc;
517 $discountid = $discount->create($user);
518 if ($discountid > 0) {
519 $result = $objecttmp->insert_discount($discountid);
522 setEventMessages($discount->error, $discount->errors,
'errors');
528 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
531 if ($lines[$i]->date_debut_prevue) {
534 if ($lines[$i]->date_debut_reel) {
537 if ($lines[$i]->date_start) {
542 if ($lines[$i]->date_fin_prevue) {
543 $date_end = $lines[$i]->date_fin_prevue;
545 if ($lines[$i]->date_fin_reel) {
546 $date_end = $lines[$i]->date_fin_reel;
548 if ($lines[$i]->date_end) {
549 $date_end = $lines[$i]->date_end;
552 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
556 $tva_tx = $lines[$i]->tva_tx;
558 if (!empty($lines[$i]->vat_src_code) && !preg_match(
'/\(/', (
string) $tva_tx)) {
559 $tva_tx .=
' ('.$lines[$i]->vat_src_code.
')';
562 $result = $objecttmp->addline(
564 $lines[$i]->subprice,
566 $lines[$i]->localtax1_tx,
567 $lines[$i]->localtax2_tx,
569 $lines[$i]->fk_product,
570 $lines[$i]->remise_percent,
574 $lines[$i]->info_bits,
580 $lines[$i]->array_options,
583 $lines[$i]->fk_commande,
585 $lines[$i]->ref_supplier,
586 $lines[$i]->special_code,
597 if ($result > 0 && $lines[$i]->product_type == 9) {
598 $fk_parent_line = $result;
606 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_supplier) ?
'' :
' ('.$cmd->ref_supplier.
')'));
607 if ($objecttmp->update($user) < 0) {
609 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
613 $cmd->classifyBilled($user);
615 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
616 $TFactThird[$cmd->socid] = $objecttmp;
618 $TFact[$objecttmp->id] = $objecttmp;
623 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
626 if (!$error && $validate_invoices) {
627 $massaction = $action =
'builddoc';
629 foreach ($TAllFact as &$objecttmp) {
630 $objecttmp->validate($user);
633 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
637 $id = $objecttmp->id;
642 $permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
646 $massaction = $action =
'confirm_createsupplierbills';
652 if ($nb_bills_created == 1) {
653 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
654 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
655 setEventMessages($texttoshow,
null,
'mesgs');
657 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
663 $param .=
'&mode='.urlencode($mode);
665 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
666 $param .=
'&contextpage='.urlencode($contextpage);
668 if ($limit > 0 && $limit !=
$conf->liste_limit) {
669 $param .=
'&limit='.((int) $limit);
672 $param .=
'&search_all='.urlencode($search_all);
675 $param .=
'&socid='.urlencode((
string) ($socid));
677 if ($search_status !=
'') {
678 $param .=
'&search_status='.urlencode($search_status);
680 if ($search_option) {
681 $param .=
'&search_option='.urlencode($search_option);
683 if ($search_date_order_startday) {
684 $param .=
'&search_date_order_startday='.urlencode((
string) ($search_date_order_startday));
686 if ($search_date_order_startmonth) {
687 $param .=
'&search_date_order_startmonth='.urlencode((
string) ($search_date_order_startmonth));
689 if ($search_date_order_startyear) {
690 $param .=
'&search_date_order_startyear='.urlencode((
string) ($search_date_order_startyear));
692 if ($search_date_order_endday) {
693 $param .=
'&search_date_order_endday='.urlencode((
string) ($search_date_order_endday));
695 if ($search_date_order_endmonth) {
696 $param .=
'&search_date_order_endmonth='.urlencode((
string) ($search_date_order_endmonth));
698 if ($search_date_order_endyear) {
699 $param .=
'&search_date_order_endyear='.urlencode((
string) ($search_date_order_endyear));
701 if ($search_date_delivery_startday) {
702 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
704 if ($search_date_delivery_startmonth) {
705 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
707 if ($search_date_delivery_startyear) {
708 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
710 if ($search_date_delivery_endday) {
711 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
713 if ($search_date_delivery_endmonth) {
714 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
716 if ($search_date_delivery_endyear) {
717 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
719 if ($search_date_valid_startday) {
720 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
722 if ($search_date_valid_startmonth) {
723 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
725 if ($search_date_valid_startyear) {
726 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
728 if ($search_date_valid_endday) {
729 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
731 if ($search_date_valid_endmonth) {
732 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
734 if ($search_date_valid_endyear) {
735 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
737 if ($search_date_approve_startday) {
738 $param .=
'&search_date_approve_startday='.urlencode((
string) ($search_date_approve_startday));
740 if ($search_date_approve_startmonth) {
741 $param .=
'&search_date_approve_startmonth='.urlencode((
string) ($search_date_approve_startmonth));
743 if ($search_date_approve_startyear) {
744 $param .=
'&search_date_approve_startyear='.urlencode((
string) ($search_date_approve_startyear));
746 if ($search_date_approve_endday) {
747 $param .=
'&search_date_approve_endday='.urlencode((
string) ($search_date_approve_endday));
749 if ($search_date_approve_endmonth) {
750 $param .=
'&search_date_approve_endmonth='.urlencode((
string) ($search_date_approve_endmonth));
752 if ($search_date_approve_endyear) {
753 $param .=
'&search_date_approve_endyear='.urlencode((
string) ($search_date_approve_endyear));
756 $param .=
'&search_ref='.urlencode($search_ref);
758 if ($search_company) {
759 $param .=
'&search_company='.urlencode($search_company);
761 if ($search_company_alias) {
762 $param .=
'&search_company_alias='.urlencode($search_company_alias);
765 if ($search_user > 0) {
766 $param .=
'&search_user='.urlencode((
string) ($search_user));
768 if ($searchCategorySupplierOrderOperator == 1) {
769 $param .=
"&search_category_supplier_order_operator=".urlencode((
string) ($searchCategorySupplierOrderOperator));
771 foreach ($searchCategorySupplierOrderList as $searchCategorySupplierOrder) {
772 $param .=
"&search_category_order_list[]=".urlencode($searchCategorySupplierOrder);
774 if ($search_sale > 0) {
775 $param .=
'&search_sale='.urlencode($search_sale);
777 if ($search_total_ht !=
'') {
778 $param .=
'&search_total_ht='.urlencode($search_total_ht);
780 if ($search_total_tva !=
'') {
781 $param .=
'&search_total_tva='.urlencode($search_total_tva);
783 if ($search_total_ttc !=
'') {
784 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
786 if ($search_project_ref >= 0) {
787 $param .=
"&search_project_ref=".urlencode($search_project_ref);
790 $param .=
'&show_files='.urlencode((
string) ($show_files));
792 if ($optioncss !=
'') {
793 $param .=
'&optioncss='.urlencode($optioncss);
796 $param .=
'&billed='.((int) ($billed));
799 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
804 $_GET[
"origin"] =
GETPOST(
"origin",
'alpha');
806 setEventMessages(
"Error",
null,
'errors');
819$form =
new Form($db);
827$title = $langs->trans(
"SuppliersOrders");
830 $fourn->fetch($socid);
831 $title .=
' - '.$fourn->name;
835 $title .=
' - '.$langs->trans(
"Billed");
841$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
842$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
846 $sql =
'SELECT DISTINCT';
848$sql .=
' s.rowid as socid, s.nom as name, s.name_alias as alias, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.email,';
849$sql .=
" typent.code as typent_code,";
850$sql .=
" state.code_departement as state_code, state.nom as state_name,";
851$sql .=
" cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_user_author, cf.date_commande as date_commande, cf.date_livraison as delivery_date, cf.date_valid, cf.date_approve,";
852$sql .=
' cf.localtax1 as total_localtax1, cf.localtax2 as total_localtax2,';
853$sql .=
' cf.fk_multicurrency, cf.multicurrency_code, cf.multicurrency_tx, cf.multicurrency_total_ht, cf.multicurrency_total_tva, cf.multicurrency_total_ttc,';
854$sql .=
' cf.date_creation as date_creation, cf.tms as date_modification,';
855$sql .=
' cf.note_public, cf.note_private,';
856$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_title,";
857$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.email as user_email, u.statut as user_status";
859if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
860 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
861 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
865$parameters = array();
866$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
867$sql .= $hookmanager->resPrint;
871$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
872$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
873$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
874$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
875$sql .=
", ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
876if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
877 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cf.rowid = ef.fk_object)";
880 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseurdet as pd ON cf.rowid=pd.fk_commande';
882$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON cf.fk_user_author = u.rowid";
883$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cf.fk_projet";
884$parameters = array();
885$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
886$sql .= $hookmanager->resPrint;
887$sql .=
' WHERE cf.fk_soc = s.rowid';
888$sql .=
' AND cf.entity IN ('.getEntity(
'supplier_order').
')';
890 $sql .=
" AND s.rowid = ".((int) $socid);
895if ($search_refsupp) {
899 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
901if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
902 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
904 if ($search_company) {
907 if ($search_company_alias) {
911if ($search_request_author) {
912 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_request_author);
914if ($billed !=
'' && $billed !=
'-1') {
915 $sql .=
" AND cf.billed = ".((int) $billed);
918if (
GETPOST(
'statut',
'intcomma') !==
'') {
919 $sql .=
" AND cf.fk_statut IN (".$db->sanitize($db->escape($db->escape(
GETPOST(
'statut',
'intcomma')))).
")";
921if ($search_status !=
'' && $search_status !=
'-1') {
922 $sql .=
" AND cf.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
924if ($search_option ==
'late') {
925 $sql .=
" AND cf.date_commande < '".$db->idate(
dol_now() -
$conf->order->fournisseur->warning_delay).
"'";
927if ($search_option ==
'recv_late') {
929 $sql .=
" AND cf.date_livraison < '".$db->idate(
dol_now() -
$conf->order->fournisseur->warning_delay).
"'";
931if ($search_date_order_start) {
932 $sql .=
" AND cf.date_commande >= '".$db->idate($search_date_order_start).
"'";
934if ($search_date_order_end) {
935 $sql .=
" AND cf.date_commande <= '".$db->idate($search_date_order_end).
"'";
937if ($search_date_delivery_start) {
938 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
940if ($search_date_delivery_end) {
941 $sql .=
" AND cf.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
943if ($search_date_valid_start) {
944 $sql .=
" AND cf.date_valid >= '".$db->idate($search_date_valid_start).
"'";
946if ($search_note_public) {
947 $sql .=
" AND cf.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
949if ($search_date_approve_start) {
950 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_approve_start).
"'";
952if ($search_date_valid_end) {
953 $sql .=
" AND cf.date_valid <= '".$db->idate($search_date_valid_end).
"'";
955if ($search_date_approve_start) {
956 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_approve_start).
"'";
958if ($search_date_approve_end) {
959 $sql .=
" AND cf.date_livraison <= '".$db->idate($search_date_approve_end).
"'";
970if ($search_country) {
971 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
973if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
974 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
979if ($search_user > 0) {
980 $sql .=
" AND EXISTS (";
981 $sql .=
" SELECT ec.rowid ";
982 $sql .=
" FROM " . MAIN_DB_PREFIX .
"element_contact as ec";
983 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"c_type_contact as tc ON tc.rowid = ec.fk_c_type_contact";
984 $sql .=
" WHERE ec.element_id = cf.rowid AND ec.fk_socpeople = " . ((int) $search_user);
985 $sql .=
" AND tc.element = 'order_supplier' AND tc.source = 'internal'";
988if ($search_total_ht !=
'') {
991if ($search_total_tva !=
'') {
994if ($search_total_ttc !=
'') {
997if ($search_multicurrency_code !=
'') {
998 $sql .=
" AND cf.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
1000if ($search_multicurrency_tx !=
'') {
1001 $sql .=
natural_search(
'cf.multicurrency_tx', $search_multicurrency_tx, 1);
1003if ($search_multicurrency_montant_ht !=
'') {
1004 $sql .=
natural_search(
'cf.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
1006if ($search_multicurrency_montant_tva !=
'') {
1007 $sql .=
natural_search(
'cf.multicurrency_total_tva', $search_multicurrency_montant_tva, 1);
1009if ($search_multicurrency_montant_ttc !=
'') {
1010 $sql .=
natural_search(
'cf.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1012if ($search_project_ref !=
'') {
1016if ($search_sale && $search_sale !=
'-1') {
1017 if ($search_sale == -2) {
1018 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'cf.fk_soc', 0, 1);
1019 } elseif ($search_sale > 0) {
1020 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'cf.fk_soc', (
int) $search_sale);
1024if (!empty($searchCategorySupplierOrderList)) {
1025 $searchCategorySupplierOrderSqlList = array();
1026 $listofcategoryid =
'';
1027 foreach ($searchCategorySupplierOrderList as $searchCategorySupplierOrder) {
1028 if (intval($searchCategorySupplierOrder) == -2) {
1029 $searchCategorySupplierOrderSqlList[] =
"NOT EXISTS (SELECT ck.fk_supplier_order FROM ".MAIN_DB_PREFIX.
"categorie_supplier_order as ck WHERE cf.rowid = ck.fk_supplier_order)";
1030 } elseif (intval($searchCategorySupplierOrder) > 0) {
1031 if ($searchCategorySupplierOrderOperator == 0) {
1032 $searchCategorySupplierOrderSqlList[] =
" EXISTS (SELECT ck.fk_supplier_order FROM ".MAIN_DB_PREFIX.
"categorie_supplier_order as ck WHERE cf.rowid = ck.fk_supplier_order AND ck.fk_categorie = ".((int) $searchCategorySupplierOrder).
")";
1034 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplierOrder);
1038 if ($listofcategoryid) {
1039 $searchCategorySupplierOrderSqlList[] =
" EXISTS (SELECT ck.fk_supplier_order FROM ".MAIN_DB_PREFIX.
"categorie_supplier_order as ck WHERE cf.rowid = ck.fk_supplier_order AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
1041 if ($searchCategorySupplierOrderOperator == 1) {
1042 if (!empty($searchCategorySupplierOrderSqlList)) {
1043 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierOrderSqlList).
")";
1046 if (!empty($searchCategorySupplierOrderSqlList)) {
1047 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierOrderSqlList).
")";
1052$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
1053$searchCategoryProductList = array($search_product_category);
1054if (!empty($searchCategoryProductList)) {
1055 $searchCategoryProductSqlList = array();
1056 $listofcategoryid =
'';
1057 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1058 if (intval($searchCategoryProduct) == -2) {
1059 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd WHERE cd.fk_commande = cf.rowid AND cd.fk_product = ck.fk_product)";
1060 } elseif (intval($searchCategoryProduct) > 0) {
1061 if ($searchCategoryProductOperator == 0) {
1062 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd WHERE cd.fk_commande = cf.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
1064 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1068 if ($listofcategoryid) {
1069 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commande_fournisseurdet as cd WHERE cd.fk_commande = cf.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
1071 if ($searchCategoryProductOperator == 1) {
1072 if (!empty($searchCategoryProductSqlList)) {
1073 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1076 if (!empty($searchCategoryProductSqlList)) {
1077 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1082include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1084$parameters = array();
1085$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
1086$sql .= $hookmanager->resPrint;
1089$nbtotalofrecords =
'';
1092 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1093 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1094 $resql = $db->query($sqlforcount);
1096 $objforcount = $db->fetch_object($resql);
1097 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1099 dol_print_error($db);
1102 if (($page * $limit) > (
int) $nbtotalofrecords) {
1109$sql .= $db->order($sortfield, $sortorder);
1111 $sql .= $db->plimit($limit + 1, $offset);
1115$resql = $db->query($sql);
1117 $num = $db->num_rows($resql);
1119 $arrayofselected = is_array($toselect) ? $toselect : array();
1121 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1122 $obj = $db->fetch_object($resql);
1124 header(
"Location: ".DOL_URL_ROOT.
'/fourn/commande/card.php?id='.
$id);
1128 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-supplier-order page-list');
1131 if (!empty($mode)) {
1132 $param .=
'&mode='.urlencode($mode);
1134 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1135 $param .=
'&contextpage='.urlencode($contextpage);
1137 if ($limit > 0 && $limit !=
$conf->liste_limit) {
1138 $param .=
'&limit='.((int) $limit);
1141 $param .=
'&search_all='.urlencode($search_all);
1144 $param .=
'&socid='.urlencode((
string) ($socid));
1147 $param .=
"&search_all=".urlencode($search_all);
1149 if ($search_date_order_startday) {
1150 $param .=
'&search_date_order_startday='.urlencode((
string) ($search_date_order_startday));
1152 if ($search_date_order_startmonth) {
1153 $param .=
'&search_date_order_startmonth='.urlencode((
string) ($search_date_order_startmonth));
1155 if ($search_date_order_startyear) {
1156 $param .=
'&search_date_order_startyear='.urlencode((
string) ($search_date_order_startyear));
1158 if ($search_date_order_endday) {
1159 $param .=
'&search_date_order_endday='.urlencode((
string) ($search_date_order_endday));
1161 if ($search_date_order_endmonth) {
1162 $param .=
'&search_date_order_endmonth='.urlencode((
string) ($search_date_order_endmonth));
1164 if ($search_date_order_endyear) {
1165 $param .=
'&search_date_order_endyear='.urlencode((
string) ($search_date_order_endyear));
1167 if ($search_date_delivery_startday) {
1168 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
1170 if ($search_date_delivery_startmonth) {
1171 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
1173 if ($search_date_delivery_startyear) {
1174 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
1176 if ($search_date_delivery_endday) {
1177 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
1179 if ($search_date_delivery_endmonth) {
1180 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
1182 if ($search_date_delivery_endyear) {
1183 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
1185 if ($search_date_valid_startday) {
1186 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1188 if ($search_date_valid_startmonth) {
1189 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1191 if ($search_date_valid_startyear) {
1192 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1194 if ($search_date_valid_endday) {
1195 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1197 if ($search_date_valid_endmonth) {
1198 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1200 if ($search_date_valid_endyear) {
1201 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1203 if ($search_date_approve_startday) {
1204 $param .=
'&search_date_approve_startday='.urlencode((
string) ($search_date_approve_startday));
1206 if ($search_date_approve_startmonth) {
1207 $param .=
'&search_date_approve_startmonth='.urlencode((
string) ($search_date_approve_startmonth));
1209 if ($search_date_approve_startyear) {
1210 $param .=
'&search_date_approve_startyear='.urlencode((
string) ($search_date_approve_startyear));
1212 if ($search_date_approve_endday) {
1213 $param .=
'&search_date_approve_endday='.urlencode((
string) ($search_date_approve_endday));
1215 if ($search_date_approve_endmonth) {
1216 $param .=
'&search_date_approve_endmonth='.urlencode((
string) ($search_date_approve_endmonth));
1218 if ($search_date_approve_endyear) {
1219 $param .=
'&search_date_approve_endyear='.urlencode((
string) ($search_date_approve_endyear));
1222 $param .=
'&search_ref='.urlencode($search_ref);
1224 if ($search_company) {
1225 $param .=
'&search_company='.urlencode($search_company);
1227 if ($search_company_alias) {
1228 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1230 if ($search_user > 0) {
1231 $param .=
'&search_user='.urlencode((
string) ($search_user));
1233 if ($search_request_author) {
1234 $param .=
'&search_request_author='.urlencode($search_request_author);
1236 if ($search_sale > 0) {
1237 $param .=
'&search_sale='.urlencode($search_sale);
1239 if ($search_total_ht !=
'') {
1240 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1242 if ($search_total_ttc !=
'') {
1243 $param .=
"&search_total_ttc=".urlencode($search_total_ttc);
1245 if ($search_multicurrency_code !=
'') {
1246 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1248 if ($search_multicurrency_tx !=
'') {
1249 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1251 if ($search_multicurrency_montant_ht !=
'') {
1252 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1254 if ($search_multicurrency_montant_tva !=
'') {
1255 $param .=
'&search_multicurrency_montant_tva='.urlencode($search_multicurrency_montant_tva);
1257 if ($search_multicurrency_montant_ttc !=
'') {
1258 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1260 if ($search_refsupp) {
1261 $param .=
"&search_refsupp=".urlencode($search_refsupp);
1263 if ($search_status !=
'' && $search_status !=
'-1') {
1264 $param .=
"&search_status=".urlencode($search_status);
1266 if ($search_option) {
1267 $param .=
"&search_option=".urlencode($search_option);
1269 if ($search_project_ref >= 0) {
1270 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1272 if ($billed !=
'') {
1273 $param .=
"&billed=".((int) $billed);
1276 $param .=
'&show_files='.urlencode((
string) ($show_files));
1278 if ($optioncss !=
'') {
1279 $param .=
'&optioncss='.urlencode($optioncss);
1281 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1282 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1286 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1288 $parameters = array(
'param' => &$param);
1289 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
1290 $param .= $hookmanager->resPrint;
1293 $arrayofmassactions = array(
1294 'generate_doc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1295 'builddoc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1296 'presend' => img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1298 if (
isModEnabled(
'category') && $user->hasRight(
"fournisseur",
"commande",
"lire")) {
1299 $arrayofmassactions[
'preaffecttag'] = img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1301 if ($permissiontovalidate) {
1302 if ($permissiontoapprove && !
getDolGlobalString(
'SUPPLIER_ORDER_NO_DIRECT_APPROVE')) {
1303 $arrayofmassactions[
'prevalidate'] = img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove");
1305 $arrayofmassactions[
'prevalidate'] = img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1309 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
"supplier_invoice",
"creer")) {
1310 $arrayofmassactions[
'createbills'] = img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisSupplier");
1312 if ($permissiontodelete) {
1313 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1315 if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1316 $arrayofmassactions = array();
1318 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1320 $url = DOL_URL_ROOT.
'/fourn/commande/card.php?action=create';
1322 $url .=
'&socid='.((int) $socid);
1323 $url .=
'&backtopage='.urlencode(DOL_URL_ROOT.
'/fourn/commande/list.php?socid='.((
int) $socid));
1325 $newcardbutton =
'';
1326 $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'));
1327 $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'));
1328 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/commande/stats/index.php?mode=supplier'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
1330 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSupplierOrderShort'),
'',
'fa fa-plus-circle', $url,
'', (
int) $permissiontoadd);
1333 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
1334 if ($optioncss !=
'') {
1335 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1337 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1338 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1339 print
'<input type="hidden" name="action" value="list">';
1340 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1341 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1342 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1343 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1344 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1346 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1348 $topicmail =
"SendOrderRef";
1349 $modelmail =
"order_supplier_send";
1351 $trackid =
'sord'.$object->id;
1352 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1354 if ($massaction ==
'prevalidate') {
1355 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1358 if ($massaction ==
'createbills') {
1360 print
'<input type="hidden" name="massaction" value="confirm_createsupplierbills">';
1362 print
'<table class="noborder centpercent">';
1364 print
'<td class="titlefield">';
1365 print $langs->trans(
'DateInvoice');
1368 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1373 print $langs->trans(
'CreateOneBillByThird');
1376 print $form->selectyesno(
'createbills_onebythird',
'', 1);
1381 print $langs->trans(
'ValidateInvoices');
1384 print $form->selectyesno(
'validate_invoices', 1, 1);
1389 print
'<div class="center">';
1390 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1391 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1398 foreach ($fieldstosearchall as $key => $val) {
1399 $fieldstosearchall[$key] = $langs->trans($val);
1401 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1404 $moreforfilter =
'';
1405 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1406 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
1408 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER_ORDER, $searchCategorySupplierOrderList,
'minwidth300', $searchCategorySupplierOrderOperator ? $searchCategorySupplierOrderOperator : 0);
1411 if ($user->hasRight(
"user",
"user",
"lire")) {
1412 $langs->load(
"commercial");
1413 $moreforfilter .=
'<div class="divsearchfield">';
1414 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1415 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1416 $moreforfilter .=
'</div>';
1419 if ($user->hasRight(
"user",
"user",
"lire")) {
1420 $moreforfilter .=
'<div class="divsearchfield">';
1421 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1422 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1423 $moreforfilter .=
'</div>';
1426 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1427 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1428 $moreforfilter .=
'<div class="divsearchfield">';
1429 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1430 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1431 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'maxwidth300 widthcentpercentminusx', 1);
1432 $moreforfilter .=
'</div>';
1435 $moreforfilter .=
'<div class="divsearchfield valignmiddle" title="'.$langs->trans(
"Alert").
' '.$langs->trans(
"Late").
'">';
1436 $moreforfilter .=
'<label class="valignmiddle" for="search_option">'.$langs->trans(
'Alert').
'</label> <input type="checkbox" class="valignmiddle" id="search_option" name="search_option" value="'.(($search_status ==
'3,4') ?
'recv_late' :
'late').
'"'.((array_search($search_option, array(
'late',
'recv_late')) !== false) ?
' checked' :
'').
'>';
1437 $moreforfilter .=
'</div>';
1438 $parameters = array();
1439 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1440 if (empty($reshook)) {
1441 $moreforfilter .= $hookmanager->resPrint;
1443 $moreforfilter = $hookmanager->resPrint;
1446 if (!empty($moreforfilter)) {
1447 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1448 print $moreforfilter;
1452 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1453 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1454 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1457 $selectedfields .=
'<script>';
1458 $selectedfields .=
' $(document).ready(function() {';
1459 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1460 $selectedfields .=
' $("#checkforselects").click();';
1461 $selectedfields .=
' $("#massaction").val("createbills").change();';
1462 $selectedfields .=
' });';
1463 $selectedfields .=
'</script>';
1466 print
'<div class="div-table-responsive">';
1467 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1469 print
'<tr class="liste_titre_filter">';
1471 if (
$conf->main_checkbox_left_column) {
1472 print
'<td class="liste_titre middle">';
1473 $searchpicto = $form->showFilterButtons(
'left');
1478 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1479 print
'<td class="liste_titre"><input size="8" type="text" class="flat maxwidth75" name="search_ref" value="'.$search_ref.
'"></td>';
1482 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1483 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_refsupp" value="'.$search_refsupp.
'"></td>';
1486 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1487 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_project_ref" value="'.$search_project_ref.
'"></td>';
1490 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1491 print
'<td class="liste_titre">';
1492 print
'<input type="text" class="flat" size="6" name="search_request_author" value="'.$search_request_author.
'">';
1496 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1497 print
'<td class="liste_titre"><input type="text" size="6" class="flat" name="search_company" value="'.$search_company.
'"></td>';
1500 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1501 print
'<td class="liste_titre"><input type="text" size="6" class="flat" name="search_company_alias" value="'.$search_company_alias.
'"></td>';
1504 if (!empty($arrayfields[
's.town'][
'checked'])) {
1505 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1508 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1509 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1512 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1513 print
'<td class="liste_titre">';
1514 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1518 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1519 print
'<td class="liste_titre center">';
1520 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1524 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1525 print
'<td class="liste_titre maxwidthonsmartphone center">';
1526 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'),
'', 1);
1530 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1531 print
'<td class="liste_titre center">';
1532 print
'<div class="nowrapfordate">';
1533 print $form->selectDate($search_date_order_start ? $search_date_order_start : -1,
'search_date_order_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1535 print
'<div class="nowrapfordate">';
1536 print $form->selectDate($search_date_order_end ? $search_date_order_end : -1,
'search_date_order_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1541 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1542 print
'<td class="liste_titre center">';
1543 print
'<div class="nowrapfordate">';
1544 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'));
1546 print
'<div class="nowrapfordate">';
1547 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'));
1551 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1553 print
'<td class="liste_titre right">';
1554 print
'<input class="flat" type="text" size="5" name="search_total_ht" value="'.$search_total_ht.
'">';
1557 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1559 print
'<td class="liste_titre right">';
1560 print
'<input class="flat" type="text" size="5" name="search_total_tva" value="'.$search_total_tva.
'">';
1563 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1565 print
'<td class="liste_titre right">';
1566 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1569 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
1571 print
'<td class="liste_titre">';
1572 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1575 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
1577 print
'<td class="liste_titre">';
1578 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1581 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
1583 print
'<td class="liste_titre right">';
1584 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1587 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
1589 print
'<td class="liste_titre right">';
1590 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_tva" value="'.dol_escape_htmltag($search_multicurrency_montant_tva).
'">';
1593 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
1595 print
'<td class="liste_titre right">';
1596 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1600 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1603 $parameters = array(
'arrayfields' => $arrayfields);
1604 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1605 print $hookmanager->resPrint;
1607 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
1608 print
'<td class="liste_titre">';
1612 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
1613 print
'<td class="liste_titre">';
1617 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
1618 print
'<td class="liste_titre center parentonrightofpage">';
1619 print $form->selectyesno(
'billed', $billed, 1,
false, 1, 1,
'search_status width100 onrightofpage');
1623 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
1624 print
'<td class="liste_titre center parentonrightofpage">';
1625 $formorder->selectSupplierOrderStatus($search_status, 1,
'search_status',
'search_status width125 onrightofpage');
1629 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
1630 print
'<td class="liste_titre center">';
1631 print
'<div class="nowrapfordate">';
1632 print $form->selectDate($search_date_valid_start ? $search_date_valid_start : -1,
'search_date_valid_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1634 print
'<div class="nowrapfordate">';
1635 print $form->selectDate($search_date_valid_end ? $search_date_valid_end : -1,
'search_date_valid_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1640 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
1641 print
'<td class="liste_titre center">';
1642 print
'<div class="nowrapfordate">';
1643 print $form->selectDate($search_date_approve_start ? $search_date_approve_start : -1,
'search_date_approve_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1645 print
'<div class="nowrapfordate">';
1646 print $form->selectDate($search_date_approve_end ? $search_date_approve_end : -1,
'search_date_approve_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1650 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
1652 print
'<td class="liste_titre">';
1653 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1656 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
1658 print
'<td class="liste_titre">';
1659 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1663 if (!
$conf->main_checkbox_left_column) {
1664 print
'<td class="liste_titre center">';
1665 $searchpicto = $form->showFilterButtons();
1672 $totalarray = array();
1673 $totalarray[
'nbfield'] = 0;
1676 print
'<tr class="liste_titre">';
1677 if (
$conf->main_checkbox_left_column) {
1678 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1679 $totalarray[
'nbfield']++;
1681 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1682 print_liste_field_titre($arrayfields[
'cf.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.ref",
"", $param,
'', $sortfield, $sortorder);
1683 $totalarray[
'nbfield']++;
1685 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1686 print_liste_field_titre($arrayfields[
'cf.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.ref_supplier",
"", $param,
'', $sortfield, $sortorder,
'tdoverflowmax100imp ');
1687 $totalarray[
'nbfield']++;
1689 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1690 print_liste_field_titre($arrayfields[
'cf.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1691 $totalarray[
'nbfield']++;
1693 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1694 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
"u.login",
"", $param,
'', $sortfield, $sortorder);
1695 $totalarray[
'nbfield']++;
1697 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1698 print_liste_field_titre($arrayfields[
'cf.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
1699 $totalarray[
'nbfield']++;
1701 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1703 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
'', $sortfield, $sortorder);
1704 $totalarray[
'nbfield']++;
1706 if (!empty($arrayfields[
's.town'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1708 $totalarray[
'nbfield']++;
1710 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1712 $totalarray[
'nbfield']++;
1714 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1716 $totalarray[
'nbfield']++;
1718 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1720 $totalarray[
'nbfield']++;
1722 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1723 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1724 $totalarray[
'nbfield']++;
1726 if (!empty($arrayfields[
'cf.fk_author'][
'checked'])) {
1727 print_liste_field_titre($arrayfields[
'cf.fk_author'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.fk_author",
"", $param,
'', $sortfield, $sortorder);
1728 $totalarray[
'nbfield']++;
1730 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1731 print_liste_field_titre($arrayfields[
'cf.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_commande",
"", $param,
'', $sortfield, $sortorder,
'center ');
1732 $totalarray[
'nbfield']++;
1734 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1735 print_liste_field_titre($arrayfields[
'cf.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1736 $totalarray[
'nbfield']++;
1738 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1739 print_liste_field_titre($arrayfields[
'cf.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
1740 $totalarray[
'nbfield']++;
1742 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1743 print_liste_field_titre($arrayfields[
'cf.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
1744 $totalarray[
'nbfield']++;
1746 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1747 print_liste_field_titre($arrayfields[
'cf.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
1748 $totalarray[
'nbfield']++;
1750 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
1751 print_liste_field_titre($arrayfields[
'cf.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1752 $totalarray[
'nbfield']++;
1754 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
'cf.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1756 $totalarray[
'nbfield']++;
1758 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
1759 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1760 $totalarray[
'nbfield']++;
1762 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
1763 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1764 $totalarray[
'nbfield']++;
1766 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
1767 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1768 $totalarray[
'nbfield']++;
1771 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1773 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1774 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1775 print $hookmanager->resPrint;
1776 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
1777 print_liste_field_titre($arrayfields[
'cf.date_creation'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1778 $totalarray[
'nbfield']++;
1780 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
1781 print_liste_field_titre($arrayfields[
'cf.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1782 $totalarray[
'nbfield']++;
1784 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
'cf.billed'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.billed',
'', $param,
'', $sortfield, $sortorder,
'center ');
1786 $totalarray[
'nbfield']++;
1788 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
1789 print_liste_field_titre($arrayfields[
'cf.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1790 $totalarray[
'nbfield']++;
1792 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
1793 print_liste_field_titre($arrayfields[
'cf.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1794 $totalarray[
'nbfield']++;
1796 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
1797 print_liste_field_titre($arrayfields[
'cf.date_approve'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.date_approve',
'', $param,
'', $sortfield, $sortorder,
'center ');
1798 $totalarray[
'nbfield']++;
1800 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
1801 print_liste_field_titre($arrayfields[
'cf.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.note_public",
"", $param,
'', $sortfield, $sortorder,
'center ');
1802 $totalarray[
'nbfield']++;
1804 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
1805 print_liste_field_titre($arrayfields[
'cf.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.note_private",
"", $param,
'', $sortfield, $sortorder,
'center ');
1806 $totalarray[
'nbfield']++;
1808 if (!
$conf->main_checkbox_left_column) {
1809 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1810 $totalarray[
'nbfield']++;
1816 $productstat_cache = array();
1818 $userstatic =
new User($db);
1820 $projectstatic =
new Project($db);
1823 $savnbfield = $totalarray[
'nbfield'];
1824 $totalarray = array(
'nbfield' => 0,
'val' => array(),
'pos' => array());
1825 $totalarray[
'val'][
'cf.total_ht'] = 0;
1826 $totalarray[
'val'][
'cf.total_ttc'] = 0;
1827 $totalarray[
'val'][
'cf.total_tva'] = 0;
1829 $imaxinloop = ($limit ? min($num, $limit) : $num);
1830 while ($i < $imaxinloop) {
1831 $obj = $db->fetch_object($resql);
1839 $objectstatic->id = $obj->rowid;
1840 $objectstatic->ref = $obj->ref;
1841 $objectstatic->ref_supplier = $obj->ref_supplier;
1842 $objectstatic->socid = $obj->socid;
1843 $objectstatic->total_ht = $obj->total_ht;
1844 $objectstatic->total_tva = $obj->total_tva;
1845 $objectstatic->total_ttc = $obj->total_ttc;
1846 $objectstatic->date = $db->jdate($obj->date_commande);
1847 $objectstatic->date_commande = $db->jdate($obj->date_commande);
1848 $objectstatic->date_creation = $db->jdate($obj->date_creation);
1849 $objectstatic->delivery_date = $db->jdate($obj->delivery_date);
1850 $objectstatic->note_public = $obj->note_public;
1851 $objectstatic->note_private = $obj->note_private;
1852 $objectstatic->statut = $obj->fk_statut;
1853 $objectstatic->status = $obj->fk_statut;
1855 if ($mode ==
'kanban') {
1857 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1858 print
'<div class="box-flex-container kanban">';
1861 $thirdpartytmp->id = $obj->socid;
1862 $thirdpartytmp->name = $obj->name;
1863 $thirdpartytmp->email = $obj->email;
1864 $thirdpartytmp->name_alias = $obj->alias;
1865 $thirdpartytmp->client = $obj->client;
1866 $thirdpartytmp->fournisseur = $obj->fournisseur;
1868 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $thirdpartytmp->getNomUrl(1,
'supplier', 0, 0, -1),
'selected' => in_array($objectstatic->id, $arrayofselected)));
1869 if ($i == ($imaxinloop - 1)) {
1874 print
'<tr class="oddeven row-with-select '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->billed == 1) ?
'opacitymedium' :
'').
'">';
1876 if (
$conf->main_checkbox_left_column) {
1877 print
'<td class="nowraponall center">';
1878 if ($massactionbutton || $massaction) {
1880 if (in_array($obj->rowid, $arrayofselected)) {
1883 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1887 $totalarray[
'nbfield']++;
1891 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1892 print
'<td class="nowraponall">';
1895 print $objectstatic->getNomUrl(1,
'', 0, -1, 1);
1899 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1903 $totalarray[
'nbfield']++;
1907 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1908 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">'.
dol_escape_htmltag($obj->ref_supplier).
'</td>'.
"\n";
1910 $totalarray[
'nbfield']++;
1914 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1915 $projectstatic->id = $obj->project_id;
1916 $projectstatic->ref = $obj->project_ref;
1917 $projectstatic->title = $obj->project_title;
1918 print
'<td class="tdoverflowmax125">';
1919 if ($obj->project_id > 0) {
1920 print $projectstatic->getNomUrl(1);
1924 $totalarray[
'nbfield']++;
1928 $userstatic->id = $obj->fk_user_author;
1929 $userstatic->lastname = $obj->lastname;
1930 $userstatic->firstname = $obj->firstname;
1931 $userstatic->login = $obj->login;
1932 $userstatic->photo = $obj->photo;
1933 $userstatic->email = $obj->user_email;
1934 $userstatic->status = $obj->user_status;
1935 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1936 print
'<td class="tdoverflowmax150">';
1937 if ($userstatic->id) {
1938 print $userstatic->getNomUrl(1);
1942 $totalarray[
'nbfield']++;
1946 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1947 print
'<td class="tdoverflowmax150">';
1948 $thirdpartytmp->id = $obj->socid;
1949 $thirdpartytmp->name = $obj->name;
1950 $thirdpartytmp->email = $obj->email;
1951 $thirdpartytmp->name_alias = $obj->alias;
1952 $thirdpartytmp->client = $obj->client;
1953 $thirdpartytmp->fournisseur = $obj->fournisseur;
1954 print $thirdpartytmp->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1957 $totalarray[
'nbfield']++;
1961 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1962 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->alias).
'">';
1966 $totalarray[
'nbfield']++;
1970 if (!empty($arrayfields[
's.town'][
'checked'])) {
1971 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1975 $totalarray[
'nbfield']++;
1979 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1980 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
1984 $totalarray[
'nbfield']++;
1988 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1989 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
1991 $totalarray[
'nbfield']++;
1995 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1996 print
'<td class="center">';
1997 $tmparray =
getCountry($obj->fk_pays,
'all');
1998 print $tmparray[
'label'];
2001 $totalarray[
'nbfield']++;
2005 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2006 print
'<td class="center">';
2007 if (empty($typenArray)) {
2008 $typenArray = $formcompany->typent_array(1);
2010 print $typenArray[$obj->typent_code];
2013 $totalarray[
'nbfield']++;
2018 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
2019 print
'<td class="center">';
2021 if ($objectstatic->statut != $objectstatic::STATUS_ORDERSENT && $objectstatic->statut != $objectstatic::STATUS_RECEIVED_PARTIALLY) {
2022 if ($objectstatic->hasDelay()) {
2023 print
' '.img_picto($langs->trans(
"Late").
' : '.$objectstatic->showDelay(),
"warning");
2028 $totalarray[
'nbfield']++;
2032 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
2033 print
'<td class="center">';
2035 if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) {
2036 if ($objectstatic->hasDelay()) {
2037 print
' '.img_picto($langs->trans(
"Late").
' : '.$objectstatic->showDelay(),
"warning");
2042 $totalarray[
'nbfield']++;
2046 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
2047 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2049 $totalarray[
'nbfield']++;
2052 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cf.total_ht';
2054 $totalarray[
'val'][
'cf.total_ht'] += $obj->total_ht;
2057 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
2058 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2060 $totalarray[
'nbfield']++;
2063 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cf.total_tva';
2065 $totalarray[
'val'][
'cf.total_tva'] += $obj->total_tva;
2068 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
2069 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2071 $totalarray[
'nbfield']++;
2074 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cf.total_ttc';
2076 $totalarray[
'val'][
'cf.total_ttc'] += $obj->total_ttc;
2080 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
2081 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2083 $totalarray[
'nbfield']++;
2088 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
2089 print
'<td class="nowrap">';
2090 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2093 $totalarray[
'nbfield']++;
2097 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
2098 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2100 $totalarray[
'nbfield']++;
2104 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
2105 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2107 $totalarray[
'nbfield']++;
2111 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
2112 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2114 $totalarray[
'nbfield']++;
2119 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2121 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2122 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
2123 print $hookmanager->resPrint;
2125 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
2126 print
'<td class="center nowraponall">';
2127 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2130 $totalarray[
'nbfield']++;
2134 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
2135 print
'<td class="center nowraponall">';
2136 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2139 $totalarray[
'nbfield']++;
2143 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
2144 print
'<td class="center">';
2146 print yn($obj->billed, $langs->trans(
"Billed"));
2150 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
2155 print
'<td class="center nowrap">'.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).
'</td>';
2157 $totalarray[
'nbfield']++;
2162 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
2163 print
'<td class="center">';
2167 $totalarray[
'nbfield']++;
2171 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
2172 print
'<td class="center">';
2176 $totalarray[
'nbfield']++;
2180 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
2181 print
'<td class="sensiblehtmlcontent center">';
2182 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2185 $totalarray[
'nbfield']++;
2190 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
2191 print
'<td class="sensiblehtmlcontent center">';
2192 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2195 $totalarray[
'nbfield']++;
2200 if (!
$conf->main_checkbox_left_column) {
2201 print
'<td class="nowrap center">';
2202 if ($massactionbutton || $massaction) {
2204 if (in_array($obj->rowid, $arrayofselected)) {
2207 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2211 $totalarray[
'nbfield']++;
2217 $total += $obj->total_ht;
2218 $subtotal += $obj->total_ht;
2224 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2229 foreach ($arrayfields as $key => $val) {
2230 if (!empty($val[
'checked'])) {
2234 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2239 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2240 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2241 print $hookmanager->resPrint;
2243 print
'</table>'.
"\n";
2246 print
'</form>'.
"\n";
2248 $hidegeneratedfilelistifempty = 1;
2249 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2250 $hidegeneratedfilelistifempty = 0;
2254 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2255 $urlsource .= str_replace(
'&',
'&', $param);
2257 $filedir = $diroutputmassaction;
2258 $genallowed = $permissiontoread;
2259 $delallowed = $permissiontoadd;
2261 print $formfile->showdocuments(
'massfilesarea_supplier_order',
'', $filedir, $urlsource, 0, (
int) $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
2263 dol_print_error($db);
$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 predefined suppliers products.
Class to manage absolute discounts.
Class to manage suppliers invoices.
Class to manage suppliers.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
$date_start
Variables from include:
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...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
getMultidirTemp($object, $module='', $forobject=0)
Return the full path of the directory where a module (or an object of a module) stores its temporary ...
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
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...
getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
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...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.