38require
'../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formorder.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
63$langs->loadLangs(array(
"orders",
"sendings",
'companies',
'compta',
'bills',
'projects',
'suppliers',
'products'));
66$action =
GETPOST(
'action',
'aZ09');
67$massaction =
GETPOST(
'massaction',
'alpha');
69$confirm =
GETPOST(
'confirm',
'alpha');
70$toselect =
GETPOST(
'toselect',
'array:int');
71$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierorderlist';
72$mode =
GETPOST(
'mode',
'alpha');
75$search_date_order_startday =
GETPOSTINT(
'search_date_order_startday');
76$search_date_order_startmonth =
GETPOSTINT(
'search_date_order_startmonth');
77$search_date_order_startyear =
GETPOSTINT(
'search_date_order_startyear');
78$search_date_order_endday =
GETPOSTINT(
'search_date_order_endday');
79$search_date_order_endmonth =
GETPOSTINT(
'search_date_order_endmonth');
80$search_date_order_endyear =
GETPOSTINT(
'search_date_order_endyear');
81$search_date_order_start =
dol_mktime(0, 0, 0, $search_date_order_startmonth, $search_date_order_startday, $search_date_order_startyear);
82$search_date_order_end =
dol_mktime(23, 59, 59, $search_date_order_endmonth, $search_date_order_endday, $search_date_order_endyear);
84$search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
85$search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
86$search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
87$search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
88$search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
89$search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
90$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
91$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
93$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
94$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
95$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
96$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
97$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
98$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
99$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
100$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
102$search_date_approve_startday =
GETPOSTINT(
'search_date_approve_startday');
103$search_date_approve_startmonth =
GETPOSTINT(
'search_date_approve_startmonth');
104$search_date_approve_startyear =
GETPOSTINT(
'search_date_approve_startyear');
105$search_date_approve_endday =
GETPOSTINT(
'search_date_approve_endday');
106$search_date_approve_endmonth =
GETPOSTINT(
'search_date_approve_endmonth');
107$search_date_approve_endyear =
GETPOSTINT(
'search_date_approve_endyear');
108$search_date_approve_start =
dol_mktime(0, 0, 0, $search_date_approve_startmonth, $search_date_approve_startday, $search_date_approve_startyear);
109$search_date_approve_end =
dol_mktime(23, 59, 59, $search_date_approve_endmonth, $search_date_approve_endday, $search_date_approve_endyear);
111$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
113$searchCategorySupplierOrderList =
GETPOST(
'search_category_supplier_order_list',
'array:int');
114$searchCategorySupplierOrderOperator = 0;
115if (GETPOSTISSET(
'formfilteraction')) {
116 $searchCategorySupplierOrderOperator =
GETPOSTINT(
'search_category_supplier_order_operator');
118 $searchCategorySupplierOrderOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
120$search_product_category =
GETPOSTINT(
'search_product_category');
121$search_ref =
GETPOST(
'search_ref',
'alpha');
122$search_refsupp =
GETPOST(
'search_refsupp',
'alpha');
123$search_company =
GETPOST(
'search_company',
'alpha');
124$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
125$search_town =
GETPOST(
'search_town',
'alpha');
126$search_zip =
GETPOST(
'search_zip',
'alpha');
127$search_state =
GETPOST(
"search_state",
'alpha');
128$search_country =
GETPOST(
"search_country",
'aZ09');
129$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
130$search_user =
GETPOST(
'search_user',
'intcomma');
131$search_request_author =
GETPOST(
'search_request_author',
'alpha');
132$optioncss =
GETPOST(
'optioncss',
'alpha');
134$search_sale =
GETPOST(
'search_sale',
'intcomma');
135$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
136$search_total_tva =
GETPOST(
'search_total_tva',
'alpha');
137$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
138$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
139$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
140$search_note_private =
GETPOST(
'search_note_private',
'alpha');
141$search_note_public =
GETPOST(
'search_note_public',
'alpha');
142$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
143$search_multicurrency_montant_tva =
GETPOST(
'search_multicurrency_montant_tva',
'alpha');
144$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
145$optioncss =
GETPOST(
'optioncss',
'alpha');
146$billed =
GETPOST(
'billed',
'int');
147$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
148$search_btn =
GETPOST(
'button_search',
'alpha');
149$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
152 $search_status = implode(
',',
GETPOST(
'search_status',
'array:intcomma'));
154 $search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') :
GETPOST(
'statut',
'intcomma'));
157$search_option =
GETPOST(
'search_option',
'alpha');
158if ($search_option ==
'late') {
159 $search_status =
'1,2';
161if ($search_option ==
'recv_late') {
162 $search_status =
'3,4';
165$diroutputmassaction = $conf->fournisseur->commande->dir_output.
'/temp/massgeneration/'.$user->id;
168$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
169$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
171if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
175$offset = $limit * $page;
176$pageprev = $page - 1;
177$pagenext = $page + 1;
179 $sortfield =
'cf.ref';
187$hookmanager->initHooks(array(
'supplierorderlist'));
191$extrafields->fetch_name_optionals_label(
$object->table_element);
193$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
196$fieldstosearchall = array();
197foreach (
$object->fields as $key => $val) {
198 if (!empty($val[
'searchall'])) {
199 $fieldstosearchall[
'cf.'.$key] = $val[
'label'];
202$fieldstosearchall[
'pd.description'] =
'Description';
203$fieldstosearchall[
's.nom'] =
"ThirdParty";
204$fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
205$fieldstosearchall[
's.zip'] =
"Zip";
206$fieldstosearchall[
's.town'] =
"Town";
207if (empty($user->socid)) {
208 $fieldstosearchall[
"cf.note_private"] =
"NotePrivate";
211$enabledtypetiers = 0;
215 'u.login' => array(
'label' =>
"AuthorRequest",
'enabled' =>
'1',
'position' => 41),
216 's.name_alias' => array(
'label' =>
"AliasNameShort",
'position' => 51,
'checked' =>
'0'),
217 's.town' => array(
'label' =>
"Town",
'enabled' =>
'1',
'position' => 55,
'checked' =>
'0'),
218 's.zip' => array(
'label' =>
"Zip",
'enabled' =>
'1',
'position' => 56,
'checked' =>
'1'),
219 'state.nom' => array(
'label' =>
"StateShort",
'enabled' =>
'1',
'position' => 57),
220 'country.code_iso' => array(
'label' =>
"Country",
'enabled' =>
'1',
'position' => 58),
221 'typent.code' => array(
'label' =>
"ThirdPartyType",
'enabled' => $enabledtypetiers,
'position' => 59),
222 'cf.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
string) (
int) (
$mysoc->localtax1_assuj ==
"1"),
'position' => 140),
223 'cf.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (
string) (
int) (
$mysoc->localtax2_assuj ==
"1"),
'position' => 145),
224 'cf.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 750),
225 'cf.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 760),
227foreach (
$object->fields as $key => $val) {
229 if (!empty($val[
'visible'])) {
230 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
231 $arrayfields[
'cf.'.$key] = array(
232 'label' => $val[
'label'],
233 'checked' => (($visible < 0) ?
'0' :
'1'),
234 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
235 'position' => $val[
'position'],
236 'help' => isset($val[
'help']) ? $val[
'help'] :
''
241include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
249if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
250 $search_sale = $user->id;
256 $socid = $user->socid;
258$result =
restrictedArea($user,
'fournisseur', $orderid,
'',
'commande');
260$permissiontoread = ($user->hasRight(
"fournisseur",
"commande",
"lire") || $user->hasRight(
"supplier_order",
"lire"));
261$permissiontoadd = ($user->hasRight(
"fournisseur",
"commande",
"creer") || $user->hasRight(
"supplier_order",
"creer"));
262$permissiontodelete = ($user->hasRight(
"fournisseur",
"commande",
"supprimer") || $user->hasRight(
"supplier_order",
"supprimer"));
263$permissiontovalidate = $permissiontoadd;
264$permissiontoapprove = ($user->hasRight(
"fournisseur",
"commande",
"approuver") || $user->hasRight(
"supplier_order",
"approuver"));
271if (
GETPOST(
'cancel',
'alpha')) {
275if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createsupplierbills') {
279$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
280$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
285if (empty($reshook)) {
287 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
290 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
294 $search_product_category =
'';
295 $searchCategorySupplierOrderList = array();
297 $search_refsupp =
'';
298 $search_company =
'';
299 $search_company_alias =
'';
304 $search_country =
'';
305 $search_type_thirdparty =
'';
306 $search_request_author =
'';
307 $search_total_ht =
'';
308 $search_total_tva =
'';
309 $search_total_ttc =
'';
310 $search_multicurrency_code =
'';
311 $search_multicurrency_tx =
'';
312 $search_multicurrency_montant_ht =
'';
313 $search_multicurrency_montant_tva =
'';
314 $search_multicurrency_montant_ttc =
'';
315 $search_project_ref =
'';
318 $search_date_order_startday =
'';
319 $search_date_order_startmonth =
'';
320 $search_date_order_startyear =
'';
321 $search_date_order_endday =
'';
322 $search_date_order_endmonth =
'';
323 $search_date_order_endyear =
'';
324 $search_date_order_start =
'';
325 $search_date_order_end =
'';
326 $search_date_delivery_startday =
'';
327 $search_date_delivery_startmonth =
'';
328 $search_date_delivery_startyear =
'';
329 $search_date_delivery_endday =
'';
330 $search_date_delivery_endmonth =
'';
331 $search_date_delivery_endyear =
'';
332 $search_date_delivery_start =
'';
333 $search_date_delivery_end =
'';
334 $search_date_valid_startday =
'';
335 $search_date_valid_startmonth =
'';
336 $search_date_valid_startyear =
'';
337 $search_date_valid_endday =
'';
338 $search_date_valid_endmonth =
'';
339 $search_date_valid_endyear =
'';
340 $search_date_valid_start =
'';
341 $search_date_valid_end =
'';
342 $search_date_approve_startday =
'';
343 $search_date_approve_startmonth =
'';
344 $search_date_approve_startyear =
'';
345 $search_date_approve_endday =
'';
346 $search_date_approve_endmonth =
'';
347 $search_date_approve_endyear =
'';
348 $search_date_approve_start =
'';
349 $search_date_approve_end =
'';
352 $search_array_options = array();
354 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
355 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
360 $objectclass =
'CommandeFournisseur';
361 $objectlabel =
'SupplierOrders';
362 $uploaddir = $conf->fournisseur->commande->dir_output;
363 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
365 if ($action ==
'validate' && $permissiontovalidate) {
366 if (
GETPOST(
'confirm') ==
'yes') {
371 foreach ($toselect as $checked) {
372 if ($objecttmp->fetch($checked)) {
373 if ($objecttmp->statut == 0) {
374 $objecttmp->date_commande =
dol_now();
375 $result = $objecttmp->valid($user);
378 if (!
getDolGlobalString(
'SUPPLIER_ORDER_NO_DIRECT_APPROVE') && $permissiontoapprove && !(
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') && $objecttmp->hasProductsOrServices(1))) {
379 $result = $objecttmp->approve($user);
380 setEventMessages($langs->trans(
"SupplierOrderValidatedAndApproved"), array($objecttmp->ref));
382 setEventMessages($langs->trans(
"SupplierOrderValidated"), array($objecttmp->ref));
401 if ($massaction ==
'confirm_createsupplierbills') {
402 $orders =
GETPOST(
'toselect',
'array:int');
403 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
404 $validate_invoices =
GETPOSTINT(
'validate_invoices');
408 $TFactThird = array();
410 $nb_bills_created = 0;
418 foreach ($orders as $id_order) {
420 if ($cmd->fetch($id_order) <= 0) {
425 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
427 $objecttmp = $TFactThird[$cmd->socid];
430 if (!empty($cmd->socid) > 0) {
432 $societe->fetch($cmd->socid);
433 $objecttmp->vat_reverse_charge = $societe->vat_reverse_charge;
434 $objecttmp->thirdparty = $societe;
436 $objecttmp->socid = $cmd->socid;
437 $objecttmp->type = $objecttmp::TYPE_STANDARD;
438 $objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
439 $objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
440 $objecttmp->fk_project = $cmd->fk_project;
441 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
442 $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier;
443 $default_ref_supplier += 1;
446 if (empty($datefacture)) {
450 $objecttmp->date = $datefacture;
451 $objecttmp->origin =
'order_supplier';
452 $objecttmp->origin_id = (int) $id_order;
454 $res = $objecttmp->create($user);
458 $lastref = $objecttmp->ref;
459 $lastid = $objecttmp->id;
463 if ($objecttmp->id > 0) {
464 if (empty($objecttmp->note_public)) {
465 $objecttmp->note_public = $langs->transnoentities(
"Orders");
468 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"element_element (";
470 $sql .=
", sourcetype";
471 $sql .=
", fk_target";
472 $sql .=
", targettype";
473 $sql .=
") VALUES (";
475 $sql .=
", '".$db->escape($objecttmp->origin).
"'";
476 $sql .=
", ".((int) $objecttmp->id);
477 $sql .=
", '".$db->escape($objecttmp->element).
"'";
480 if (!$db->query($sql)) {
485 $lines = $cmd->lines;
486 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
488 $lines = $cmd->lines;
492 $num = count($lines);
494 for ($i = 0; $i < $num; $i++) {
495 $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
496 if ($lines[$i]->subprice < 0) {
497 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
501 $discount->fk_soc = $objecttmp->socid;
502 $discount->socid = $objecttmp->socid;
503 $discount->amount_ht = abs($lines[$i]->total_ht);
504 $discount->amount_tva = abs($lines[$i]->total_tva);
505 $discount->amount_ttc = abs($lines[$i]->total_ttc);
506 $discount->tva_tx = $lines[$i]->tva_tx;
507 $discount->fk_user = $user->id;
508 $discount->description = $desc;
509 $discountid = $discount->create($user);
510 if ($discountid > 0) {
511 $result = $objecttmp->insert_discount($discountid);
520 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
523 if ($lines[$i]->date_debut_prevue) {
524 $date_start = $lines[$i]->date_debut_prevue;
526 if ($lines[$i]->date_debut_reel) {
527 $date_start = $lines[$i]->date_debut_reel;
529 if ($lines[$i]->date_start) {
530 $date_start = $lines[$i]->date_start;
534 if ($lines[$i]->date_fin_prevue) {
535 $date_end = $lines[$i]->date_fin_prevue;
537 if ($lines[$i]->date_fin_reel) {
538 $date_end = $lines[$i]->date_fin_reel;
540 if ($lines[$i]->date_end) {
541 $date_end = $lines[$i]->date_end;
544 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
548 $tva_tx = $lines[$i]->tva_tx;
550 if (!empty($lines[$i]->vat_src_code) && !preg_match(
'/\(/', (
string) $tva_tx)) {
551 $tva_tx .=
' ('.$lines[$i]->vat_src_code.
')';
554 $result = $objecttmp->addline(
556 $lines[$i]->subprice,
558 $lines[$i]->localtax1_tx,
559 $lines[$i]->localtax2_tx,
561 $lines[$i]->fk_product,
562 $lines[$i]->remise_percent,
566 $lines[$i]->info_bits,
572 $lines[$i]->array_options,
575 $lines[$i]->fk_commande,
577 $lines[$i]->ref_supplier,
578 $lines[$i]->special_code,
589 if ($result > 0 && $lines[$i]->product_type == 9) {
590 $fk_parent_line = $result;
598 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_supplier) ?
'' :
' ('.$cmd->ref_supplier.
')'));
599 $objecttmp->update($user);
602 $cmd->classifyBilled($user);
604 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
605 $TFactThird[$cmd->socid] = $objecttmp;
607 $TFact[$objecttmp->id] = $objecttmp;
612 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
615 if (!$error && $validate_invoices) {
616 $massaction = $action =
'builddoc';
618 foreach ($TAllFact as &$objecttmp) {
619 $objecttmp->validate($user);
626 $id = $objecttmp->id;
630 $upload_dir = $conf->fournisseur->facture->dir_output;
631 $permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
635 $massaction = $action =
'confirm_createsupplierbills';
641 if ($nb_bills_created == 1) {
642 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
643 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
646 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
652 $param .=
'&mode='.urlencode($mode);
654 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
655 $param .=
'&contextpage='.urlencode($contextpage);
657 if ($limit > 0 && $limit != $conf->liste_limit) {
658 $param .=
'&limit='.((int) $limit);
661 $param .=
'&search_all='.urlencode($search_all);
664 $param .=
'&socid='.urlencode((
string) ($socid));
666 if ($search_status !=
'') {
667 $param .=
'&search_status='.urlencode($search_status);
669 if ($search_option) {
670 $param .=
'&search_option='.urlencode($search_option);
672 if ($search_date_order_startday) {
673 $param .=
'&search_date_order_startday='.urlencode((
string) ($search_date_order_startday));
675 if ($search_date_order_startmonth) {
676 $param .=
'&search_date_order_startmonth='.urlencode((
string) ($search_date_order_startmonth));
678 if ($search_date_order_startyear) {
679 $param .=
'&search_date_order_startyear='.urlencode((
string) ($search_date_order_startyear));
681 if ($search_date_order_endday) {
682 $param .=
'&search_date_order_endday='.urlencode((
string) ($search_date_order_endday));
684 if ($search_date_order_endmonth) {
685 $param .=
'&search_date_order_endmonth='.urlencode((
string) ($search_date_order_endmonth));
687 if ($search_date_order_endyear) {
688 $param .=
'&search_date_order_endyear='.urlencode((
string) ($search_date_order_endyear));
690 if ($search_date_delivery_startday) {
691 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
693 if ($search_date_delivery_startmonth) {
694 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
696 if ($search_date_delivery_startyear) {
697 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
699 if ($search_date_delivery_endday) {
700 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
702 if ($search_date_delivery_endmonth) {
703 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
705 if ($search_date_delivery_endyear) {
706 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
708 if ($search_date_valid_startday) {
709 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
711 if ($search_date_valid_startmonth) {
712 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
714 if ($search_date_valid_startyear) {
715 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
717 if ($search_date_valid_endday) {
718 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
720 if ($search_date_valid_endmonth) {
721 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
723 if ($search_date_valid_endyear) {
724 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
726 if ($search_date_approve_startday) {
727 $param .=
'&search_date_approve_startday='.urlencode((
string) ($search_date_approve_startday));
729 if ($search_date_approve_startmonth) {
730 $param .=
'&search_date_approve_startmonth='.urlencode((
string) ($search_date_approve_startmonth));
732 if ($search_date_approve_startyear) {
733 $param .=
'&search_date_approve_startyear='.urlencode((
string) ($search_date_approve_startyear));
735 if ($search_date_approve_endday) {
736 $param .=
'&search_date_approve_endday='.urlencode((
string) ($search_date_approve_endday));
738 if ($search_date_approve_endmonth) {
739 $param .=
'&search_date_approve_endmonth='.urlencode((
string) ($search_date_approve_endmonth));
741 if ($search_date_approve_endyear) {
742 $param .=
'&search_date_approve_endyear='.urlencode((
string) ($search_date_approve_endyear));
745 $param .=
'&search_ref='.urlencode($search_ref);
747 if ($search_company) {
748 $param .=
'&search_company='.urlencode($search_company);
750 if ($search_company_alias) {
751 $param .=
'&search_company_alias='.urlencode($search_company_alias);
754 if ($search_user > 0) {
755 $param .=
'&search_user='.urlencode((
string) ($search_user));
757 if ($searchCategorySupplierOrderOperator == 1) {
758 $param .=
"&search_category_supplier_order_operator=".urlencode((
string) ($searchCategorySupplierOrderOperator));
760 foreach ($searchCategorySupplierOrderList as $searchCategorySupplierOrder) {
761 $param .=
"&search_category_order_list[]=".urlencode($searchCategorySupplierOrder);
763 if ($search_sale > 0) {
764 $param .=
'&search_sale='.urlencode($search_sale);
766 if ($search_total_ht !=
'') {
767 $param .=
'&search_total_ht='.urlencode($search_total_ht);
769 if ($search_total_tva !=
'') {
770 $param .=
'&search_total_tva='.urlencode($search_total_tva);
772 if ($search_total_ttc !=
'') {
773 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
775 if ($search_project_ref >= 0) {
776 $param .=
"&search_project_ref=".urlencode($search_project_ref);
779 $param .=
'&show_files='.urlencode((
string) ($show_files));
781 if ($optioncss !=
'') {
782 $param .=
'&optioncss='.urlencode($optioncss);
785 $param .=
'&billed='.((int) ($billed));
788 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
793 $_GET[
"origin"] = $_POST[
"origin"];
794 $_GET[
"originid"] = $_POST[
"originid"];
808$form =
new Form($db);
816$title = $langs->trans(
"SuppliersOrders");
819 $fourn->fetch($socid);
820 $title .=
' - '.$fourn->name;
824 $title .=
' - '.$langs->trans(
"Billed");
830$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
831$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
835 $sql =
'SELECT DISTINCT';
837$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,';
838$sql .=
" typent.code as typent_code,";
839$sql .=
" state.code_departement as state_code, state.nom as state_name,";
840$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,";
841$sql .=
' cf.localtax1 as total_localtax1, cf.localtax2 as total_localtax2,';
842$sql .=
' cf.fk_multicurrency, cf.multicurrency_code, cf.multicurrency_tx, cf.multicurrency_total_ht, cf.multicurrency_total_tva, cf.multicurrency_total_ttc,';
843$sql .=
' cf.date_creation as date_creation, cf.tms as date_modification,';
844$sql .=
' cf.note_public, cf.note_private,';
845$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_title,";
846$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.email as user_email, u.statut as user_status";
848if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
849 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
850 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
854$parameters = array();
855$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
856$sql .= $hookmanager->resPrint;
860$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
861$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
862$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
863$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
864$sql .=
", ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
865if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
866 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cf.rowid = ef.fk_object)";
869 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseurdet as pd ON cf.rowid=pd.fk_commande';
871$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON cf.fk_user_author = u.rowid";
872$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cf.fk_projet";
873$parameters = array();
874$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
875$sql .= $hookmanager->resPrint;
876$sql .=
' WHERE cf.fk_soc = s.rowid';
877$sql .=
' AND cf.entity IN ('.getEntity(
'supplier_order').
')';
879 $sql .=
" AND s.rowid = ".((int) $socid);
884if ($search_refsupp) {
888 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
890if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
891 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
893 if ($search_company) {
896 if ($search_company_alias) {
900if ($search_request_author) {
901 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_request_author);
903if ($billed !=
'' && $billed !=
'-1') {
904 $sql .=
" AND cf.billed = ".((int) $billed);
907if (
GETPOST(
'statut',
'intcomma') !==
'') {
908 $sql .=
" AND cf.fk_statut IN (".$db->sanitize($db->escape($db->escape(
GETPOST(
'statut',
'intcomma')))).
")";
910if ($search_status !=
'' && $search_status !=
'-1') {
911 $sql .=
" AND cf.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
913if ($search_option ==
'late') {
914 $sql .=
" AND cf.date_commande < '".$db->idate(
dol_now() - $conf->order->fournisseur->warning_delay).
"'";
916if ($search_date_order_start) {
917 $sql .=
" AND cf.date_commande >= '".$db->idate($search_date_order_start).
"'";
919if ($search_date_order_end) {
920 $sql .=
" AND cf.date_commande <= '".$db->idate($search_date_order_end).
"'";
922if ($search_date_delivery_start) {
923 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
925if ($search_date_delivery_end) {
926 $sql .=
" AND cf.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
928if ($search_date_valid_start) {
929 $sql .=
" AND cf.date_valid >= '".$db->idate($search_date_valid_start).
"'";
931if ($search_note_public) {
932 $sql .=
" AND cf.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
934if ($search_date_approve_start) {
935 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_approve_start).
"'";
937if ($search_date_valid_end) {
938 $sql .=
" AND cf.date_valid <= '".$db->idate($search_date_valid_end).
"'";
940if ($search_date_approve_start) {
941 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_approve_start).
"'";
943if ($search_date_approve_end) {
944 $sql .=
" AND cf.date_livraison <= '".$db->idate($search_date_approve_end).
"'";
955if ($search_country) {
956 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
958if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
959 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
964if ($search_user > 0) {
965 $sql .=
" AND EXISTS (";
966 $sql .=
" SELECT ec.rowid ";
967 $sql .=
" FROM " . MAIN_DB_PREFIX .
"element_contact as ec";
968 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"c_type_contact as tc ON tc.rowid = ec.fk_c_type_contact";
969 $sql .=
" WHERE ec.element_id = cf.rowid AND ec.fk_socpeople = " . ((int) $search_user);
970 $sql .=
" AND tc.element = 'order_supplier' AND tc.source = 'internal'";
973if ($search_total_ht !=
'') {
976if ($search_total_tva !=
'') {
979if ($search_total_ttc !=
'') {
982if ($search_multicurrency_code !=
'') {
983 $sql .=
" AND cf.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
985if ($search_multicurrency_tx !=
'') {
986 $sql .=
natural_search(
'cf.multicurrency_tx', $search_multicurrency_tx, 1);
988if ($search_multicurrency_montant_ht !=
'') {
989 $sql .=
natural_search(
'cf.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
991if ($search_multicurrency_montant_tva !=
'') {
992 $sql .=
natural_search(
'cf.multicurrency_total_tva', $search_multicurrency_montant_tva, 1);
994if ($search_multicurrency_montant_ttc !=
'') {
995 $sql .=
natural_search(
'cf.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
997if ($search_project_ref !=
'') {
1001if ($search_sale && $search_sale !=
'-1') {
1002 if ($search_sale == -2) {
1003 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = cf.fk_soc)";
1004 } elseif ($search_sale > 0) {
1005 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = cf.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
1009if (!empty($searchCategorySupplierOrderList)) {
1010 $searchCategorySupplierOrderSqlList = array();
1011 $listofcategoryid =
'';
1012 foreach ($searchCategorySupplierOrderList as $searchCategorySupplierOrder) {
1013 if (intval($searchCategorySupplierOrder) == -2) {
1014 $searchCategorySupplierOrderSqlList[] =
"NOT EXISTS (SELECT ck.fk_supplier_order FROM ".MAIN_DB_PREFIX.
"categorie_supplier_order as ck WHERE cf.rowid = ck.fk_supplier_order)";
1015 } elseif (intval($searchCategorySupplierOrder) > 0) {
1016 if ($searchCategorySupplierOrderOperator == 0) {
1017 $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).
")";
1019 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplierOrder);
1023 if ($listofcategoryid) {
1024 $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).
"))";
1026 if ($searchCategorySupplierOrderOperator == 1) {
1027 if (!empty($searchCategorySupplierOrderSqlList)) {
1028 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierOrderSqlList).
")";
1031 if (!empty($searchCategorySupplierOrderSqlList)) {
1032 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierOrderSqlList).
")";
1037$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
1038$searchCategoryProductList = array($search_product_category);
1039if (!empty($searchCategoryProductList)) {
1040 $searchCategoryProductSqlList = array();
1041 $listofcategoryid =
'';
1042 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1043 if (intval($searchCategoryProduct) == -2) {
1044 $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)";
1045 } elseif (intval($searchCategoryProduct) > 0) {
1046 if ($searchCategoryProductOperator == 0) {
1047 $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).
")";
1049 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1053 if ($listofcategoryid) {
1054 $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).
"))";
1056 if ($searchCategoryProductOperator == 1) {
1057 if (!empty($searchCategoryProductSqlList)) {
1058 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1061 if (!empty($searchCategoryProductSqlList)) {
1062 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1067include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1069$parameters = array();
1070$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
1071$sql .= $hookmanager->resPrint;
1074$nbtotalofrecords =
'';
1077 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1078 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1079 $resql = $db->query($sqlforcount);
1081 $objforcount = $db->fetch_object($resql);
1082 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1087 if (($page * $limit) > (
int) $nbtotalofrecords) {
1094$sql .= $db->order($sortfield, $sortorder);
1096 $sql .= $db->plimit($limit + 1, $offset);
1100$resql = $db->query($sql);
1102 $num = $db->num_rows($resql);
1104 $arrayofselected = is_array($toselect) ? $toselect : array();
1106 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1107 $obj = $db->fetch_object($resql);
1109 header(
"Location: ".DOL_URL_ROOT.
'/fourn/commande/card.php?id='.
$id);
1113 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-supplier-order page-list');
1116 if (!empty($mode)) {
1117 $param .=
'&mode='.urlencode($mode);
1119 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1120 $param .=
'&contextpage='.urlencode($contextpage);
1122 if ($limit > 0 && $limit != $conf->liste_limit) {
1123 $param .=
'&limit='.((int) $limit);
1126 $param .=
'&search_all='.urlencode($search_all);
1129 $param .=
'&socid='.urlencode((
string) ($socid));
1132 $param .=
"&search_all=".urlencode($search_all);
1134 if ($search_date_order_startday) {
1135 $param .=
'&search_date_order_startday='.urlencode((
string) ($search_date_order_startday));
1137 if ($search_date_order_startmonth) {
1138 $param .=
'&search_date_order_startmonth='.urlencode((
string) ($search_date_order_startmonth));
1140 if ($search_date_order_startyear) {
1141 $param .=
'&search_date_order_startyear='.urlencode((
string) ($search_date_order_startyear));
1143 if ($search_date_order_endday) {
1144 $param .=
'&search_date_order_endday='.urlencode((
string) ($search_date_order_endday));
1146 if ($search_date_order_endmonth) {
1147 $param .=
'&search_date_order_endmonth='.urlencode((
string) ($search_date_order_endmonth));
1149 if ($search_date_order_endyear) {
1150 $param .=
'&search_date_order_endyear='.urlencode((
string) ($search_date_order_endyear));
1152 if ($search_date_delivery_startday) {
1153 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
1155 if ($search_date_delivery_startmonth) {
1156 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
1158 if ($search_date_delivery_startyear) {
1159 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
1161 if ($search_date_delivery_endday) {
1162 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
1164 if ($search_date_delivery_endmonth) {
1165 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
1167 if ($search_date_delivery_endyear) {
1168 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
1170 if ($search_date_valid_startday) {
1171 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1173 if ($search_date_valid_startmonth) {
1174 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1176 if ($search_date_valid_startyear) {
1177 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1179 if ($search_date_valid_endday) {
1180 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1182 if ($search_date_valid_endmonth) {
1183 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1185 if ($search_date_valid_endyear) {
1186 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1188 if ($search_date_approve_startday) {
1189 $param .=
'&search_date_approve_startday='.urlencode((
string) ($search_date_approve_startday));
1191 if ($search_date_approve_startmonth) {
1192 $param .=
'&search_date_approve_startmonth='.urlencode((
string) ($search_date_approve_startmonth));
1194 if ($search_date_approve_startyear) {
1195 $param .=
'&search_date_approve_startyear='.urlencode((
string) ($search_date_approve_startyear));
1197 if ($search_date_approve_endday) {
1198 $param .=
'&search_date_approve_endday='.urlencode((
string) ($search_date_approve_endday));
1200 if ($search_date_approve_endmonth) {
1201 $param .=
'&search_date_approve_endmonth='.urlencode((
string) ($search_date_approve_endmonth));
1203 if ($search_date_approve_endyear) {
1204 $param .=
'&search_date_approve_endyear='.urlencode((
string) ($search_date_approve_endyear));
1207 $param .=
'&search_ref='.urlencode($search_ref);
1209 if ($search_company) {
1210 $param .=
'&search_company='.urlencode($search_company);
1212 if ($search_company_alias) {
1213 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1215 if ($search_user > 0) {
1216 $param .=
'&search_user='.urlencode((
string) ($search_user));
1218 if ($search_request_author) {
1219 $param .=
'&search_request_author='.urlencode($search_request_author);
1221 if ($search_sale > 0) {
1222 $param .=
'&search_sale='.urlencode($search_sale);
1224 if ($search_total_ht !=
'') {
1225 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1227 if ($search_total_ttc !=
'') {
1228 $param .=
"&search_total_ttc=".urlencode($search_total_ttc);
1230 if ($search_multicurrency_code !=
'') {
1231 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1233 if ($search_multicurrency_tx !=
'') {
1234 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1236 if ($search_multicurrency_montant_ht !=
'') {
1237 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1239 if ($search_multicurrency_montant_tva !=
'') {
1240 $param .=
'&search_multicurrency_montant_tva='.urlencode($search_multicurrency_montant_tva);
1242 if ($search_multicurrency_montant_ttc !=
'') {
1243 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1245 if ($search_refsupp) {
1246 $param .=
"&search_refsupp=".urlencode($search_refsupp);
1248 if ($search_status !=
'' && $search_status !=
'-1') {
1249 $param .=
"&search_status=".urlencode($search_status);
1251 if ($search_option) {
1252 $param .=
"&search_option=".urlencode($search_option);
1254 if ($search_project_ref >= 0) {
1255 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1257 if ($billed !=
'') {
1258 $param .=
"&billed=".((int) $billed);
1261 $param .=
'&show_files='.urlencode((
string) ($show_files));
1263 if ($optioncss !=
'') {
1264 $param .=
'&optioncss='.urlencode($optioncss);
1266 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1267 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1271 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1273 $parameters = array(
'param' => &$param);
1274 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
1275 $param .= $hookmanager->resPrint;
1278 $arrayofmassactions = array(
1279 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1280 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1281 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1283 if (
isModEnabled(
'category') && $user->hasRight(
"fournisseur",
"commande",
"lire")) {
1284 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1286 if ($permissiontovalidate) {
1287 if ($permissiontoapprove && !
getDolGlobalString(
'SUPPLIER_ORDER_NO_DIRECT_APPROVE')) {
1288 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove");
1290 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1294 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
"supplier_invoice",
"creer")) {
1295 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisSupplier");
1297 if ($permissiontodelete) {
1298 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1300 if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1301 $arrayofmassactions = array();
1303 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1305 $url = DOL_URL_ROOT.
'/fourn/commande/card.php?action=create';
1307 $url .=
'&socid='.((int) $socid);
1308 $url .=
'&backtopage='.urlencode(DOL_URL_ROOT.
'/fourn/commande/list.php?socid='.((
int) $socid));
1310 $newcardbutton =
'';
1311 $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'));
1312 $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'));
1314 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSupplierOrderShort'),
'',
'fa fa-plus-circle', $url,
'', (
int) $permissiontoadd);
1317 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
1318 if ($optioncss !=
'') {
1319 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1321 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1322 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1323 print
'<input type="hidden" name="action" value="list">';
1324 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1325 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1326 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1327 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1328 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1330 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1332 $topicmail =
"SendOrderRef";
1333 $modelmail =
"order_supplier_send";
1335 $trackid =
'sord'.$object->id;
1336 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1338 if ($massaction ==
'prevalidate') {
1339 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1342 if ($massaction ==
'createbills') {
1344 print
'<input type="hidden" name="massaction" value="confirm_createsupplierbills">';
1346 print
'<table class="noborder centpercent">';
1348 print
'<td class="titlefield">';
1349 print $langs->trans(
'DateInvoice');
1352 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1357 print $langs->trans(
'CreateOneBillByThird');
1360 print $form->selectyesno(
'createbills_onebythird',
'', 1);
1365 print $langs->trans(
'ValidateInvoices');
1368 print $form->selectyesno(
'validate_invoices', 1, 1);
1373 print
'<div class="center">';
1374 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1375 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1382 foreach ($fieldstosearchall as $key => $val) {
1383 $fieldstosearchall[$key] = $langs->trans($val);
1385 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1388 $moreforfilter =
'';
1389 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1390 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
1392 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER_ORDER, $searchCategorySupplierOrderList,
'minwidth300', $searchCategorySupplierOrderOperator ? $searchCategorySupplierOrderOperator : 0);
1395 if ($user->hasRight(
"user",
"user",
"lire")) {
1396 $langs->load(
"commercial");
1397 $moreforfilter .=
'<div class="divsearchfield">';
1398 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1399 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1400 $moreforfilter .=
'</div>';
1403 if ($user->hasRight(
"user",
"user",
"lire")) {
1404 $moreforfilter .=
'<div class="divsearchfield">';
1405 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1406 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1407 $moreforfilter .=
'</div>';
1410 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1411 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1412 $moreforfilter .=
'<div class="divsearchfield">';
1413 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1414 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1415 $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);
1416 $moreforfilter .=
'</div>';
1419 $moreforfilter .=
'<div class="divsearchfield valignmiddle" title="'.$langs->trans(
"Alert").
' '.$langs->trans(
"Late").
'">';
1420 $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' :
'').
'>';
1421 $moreforfilter .=
'</div>';
1422 $parameters = array();
1423 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1424 if (empty($reshook)) {
1425 $moreforfilter .= $hookmanager->resPrint;
1427 $moreforfilter = $hookmanager->resPrint;
1430 if (!empty($moreforfilter)) {
1431 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1432 print $moreforfilter;
1436 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1437 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1438 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1441 $selectedfields .=
'<script>';
1442 $selectedfields .=
' $(document).ready(function() {';
1443 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1444 $selectedfields .=
' $("#checkforselects").click();';
1445 $selectedfields .=
' $("#massaction").val("createbills").change();';
1446 $selectedfields .=
' });';
1447 $selectedfields .=
'</script>';
1450 print
'<div class="div-table-responsive">';
1451 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1453 print
'<tr class="liste_titre_filter">';
1456 print
'<td class="liste_titre middle">';
1457 $searchpicto = $form->showFilterButtons(
'left');
1462 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1463 print
'<td class="liste_titre"><input size="8" type="text" class="flat maxwidth75" name="search_ref" value="'.$search_ref.
'"></td>';
1466 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1467 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_refsupp" value="'.$search_refsupp.
'"></td>';
1470 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1471 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_project_ref" value="'.$search_project_ref.
'"></td>';
1474 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1475 print
'<td class="liste_titre">';
1476 print
'<input type="text" class="flat" size="6" name="search_request_author" value="'.$search_request_author.
'">';
1480 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1481 print
'<td class="liste_titre"><input type="text" size="6" class="flat" name="search_company" value="'.$search_company.
'"></td>';
1484 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1485 print
'<td class="liste_titre"><input type="text" size="6" class="flat" name="search_company_alias" value="'.$search_company_alias.
'"></td>';
1488 if (!empty($arrayfields[
's.town'][
'checked'])) {
1489 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1492 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1493 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1496 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1497 print
'<td class="liste_titre">';
1498 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1502 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1503 print
'<td class="liste_titre center">';
1504 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1508 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1509 print
'<td class="liste_titre maxwidthonsmartphone center">';
1510 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);
1514 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1515 print
'<td class="liste_titre center">';
1516 print
'<div class="nowrapfordate">';
1517 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'));
1519 print
'<div class="nowrapfordate">';
1520 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'));
1525 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1526 print
'<td class="liste_titre center">';
1527 print
'<div class="nowrapfordate">';
1528 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'));
1530 print
'<div class="nowrapfordate">';
1531 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'));
1535 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1537 print
'<td class="liste_titre right">';
1538 print
'<input class="flat" type="text" size="5" name="search_total_ht" value="'.$search_total_ht.
'">';
1541 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1543 print
'<td class="liste_titre right">';
1544 print
'<input class="flat" type="text" size="5" name="search_total_tva" value="'.$search_total_tva.
'">';
1547 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1549 print
'<td class="liste_titre right">';
1550 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1553 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
1555 print
'<td class="liste_titre">';
1556 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1559 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
1561 print
'<td class="liste_titre">';
1562 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1565 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
1567 print
'<td class="liste_titre right">';
1568 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1571 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
1573 print
'<td class="liste_titre right">';
1574 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_tva" value="'.dol_escape_htmltag($search_multicurrency_montant_tva).
'">';
1577 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
1579 print
'<td class="liste_titre right">';
1580 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1584 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1587 $parameters = array(
'arrayfields' => $arrayfields);
1588 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1589 print $hookmanager->resPrint;
1591 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
1592 print
'<td class="liste_titre">';
1596 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
1597 print
'<td class="liste_titre">';
1601 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
1602 print
'<td class="liste_titre center parentonrightofpage">';
1603 print $form->selectyesno(
'billed', $billed, 1,
false, 1, 1,
'search_status width100 onrightofpage');
1607 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
1608 print
'<td class="liste_titre center parentonrightofpage">';
1609 $formorder->selectSupplierOrderStatus($search_status, 1,
'search_status',
'search_status width125 onrightofpage');
1613 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
1614 print
'<td class="liste_titre center">';
1615 print
'<div class="nowrapfordate">';
1616 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'));
1618 print
'<div class="nowrapfordate">';
1619 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'));
1624 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
1625 print
'<td class="liste_titre center">';
1626 print
'<div class="nowrapfordate">';
1627 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'));
1629 print
'<div class="nowrapfordate">';
1630 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'));
1634 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
1636 print
'<td class="liste_titre">';
1637 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1640 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
1642 print
'<td class="liste_titre">';
1643 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1648 print
'<td class="liste_titre center">';
1649 $searchpicto = $form->showFilterButtons();
1660 print
'<tr class="liste_titre">';
1662 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1665 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1666 print_liste_field_titre($arrayfields[
'cf.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.ref",
"", $param,
'', $sortfield, $sortorder);
1669 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1670 print_liste_field_titre($arrayfields[
'cf.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.ref_supplier",
"", $param,
'', $sortfield, $sortorder,
'tdoverflowmax100imp ');
1673 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1674 print_liste_field_titre($arrayfields[
'cf.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1677 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1678 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
"u.login",
"", $param,
'', $sortfield, $sortorder);
1681 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1682 print_liste_field_titre($arrayfields[
'cf.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
1685 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1687 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
'', $sortfield, $sortorder);
1690 if (!empty($arrayfields[
's.town'][
'checked'])) {
1691 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1694 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1695 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1698 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1702 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1703 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1706 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1710 if (!empty($arrayfields[
'cf.fk_author'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
'cf.fk_author'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.fk_author",
"", $param,
'', $sortfield, $sortorder);
1714 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
'cf.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_commande",
"", $param,
'', $sortfield, $sortorder,
'center ');
1718 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
'cf.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1722 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1723 print_liste_field_titre($arrayfields[
'cf.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
1726 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1727 print_liste_field_titre($arrayfields[
'cf.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
1730 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1731 print_liste_field_titre($arrayfields[
'cf.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
1734 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
1735 print_liste_field_titre($arrayfields[
'cf.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1738 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
1739 print_liste_field_titre($arrayfields[
'cf.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1742 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
1743 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1746 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
1747 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1750 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
1751 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1755 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1757 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1758 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1759 print $hookmanager->resPrint;
1760 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
'cf.date_creation'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1764 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
1765 print_liste_field_titre($arrayfields[
'cf.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1768 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
1769 print_liste_field_titre($arrayfields[
'cf.billed'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.billed',
'', $param,
'', $sortfield, $sortorder,
'center ');
1772 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
1773 print_liste_field_titre($arrayfields[
'cf.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1776 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
1777 print_liste_field_titre($arrayfields[
'cf.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1780 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
1781 print_liste_field_titre($arrayfields[
'cf.date_approve'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.date_approve',
'', $param,
'', $sortfield, $sortorder,
'center ');
1784 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
'cf.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.note_public",
"", $param,
'', $sortfield, $sortorder,
'center ');
1788 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
1789 print_liste_field_titre($arrayfields[
'cf.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.note_private",
"", $param,
'', $sortfield, $sortorder,
'center ');
1793 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1800 $productstat_cache = array();
1802 $userstatic =
new User($db);
1804 $projectstatic =
new Project($db);
1808 $totalarray = array(
'nbfield' => 0,
'val' => array(),
'pos' => array());
1813 $imaxinloop = ($limit ? min($num, $limit) : $num);
1814 while ($i < $imaxinloop) {
1815 $obj = $db->fetch_object($resql);
1823 $objectstatic->id = $obj->rowid;
1824 $objectstatic->ref = $obj->ref;
1825 $objectstatic->ref_supplier = $obj->ref_supplier;
1826 $objectstatic->socid = $obj->socid;
1827 $objectstatic->total_ht = $obj->total_ht;
1828 $objectstatic->total_tva = $obj->total_tva;
1829 $objectstatic->total_ttc = $obj->total_ttc;
1830 $objectstatic->date = $db->jdate($obj->date_commande);
1831 $objectstatic->date_commande = $db->jdate($obj->date_commande);
1832 $objectstatic->date_creation = $db->jdate($obj->date_creation);
1833 $objectstatic->delivery_date = $db->jdate($obj->delivery_date);
1834 $objectstatic->note_public = $obj->note_public;
1835 $objectstatic->note_private = $obj->note_private;
1836 $objectstatic->statut = $obj->fk_statut;
1837 $objectstatic->status = $obj->fk_statut;
1839 if ($mode ==
'kanban') {
1841 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1842 print
'<div class="box-flex-container kanban">';
1845 $thirdpartytmp->id = $obj->socid;
1846 $thirdpartytmp->name = $obj->name;
1847 $thirdpartytmp->email = $obj->email;
1848 $thirdpartytmp->name_alias = $obj->alias;
1849 $thirdpartytmp->client = $obj->client;
1850 $thirdpartytmp->fournisseur = $obj->fournisseur;
1852 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $thirdpartytmp->getNomUrl(1,
'supplier', 0, 0, -1),
'selected' => in_array($objectstatic->id, $arrayofselected)));
1853 if ($i == ($imaxinloop - 1)) {
1858 print
'<tr class="oddeven row-with-select '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->billed == 1) ?
'opacitymedium' :
'').
'">';
1861 print
'<td class="nowraponall center">';
1862 if ($massactionbutton || $massaction) {
1864 if (in_array($obj->rowid, $arrayofselected)) {
1867 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1875 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1876 print
'<td class="nowraponall">';
1879 print $objectstatic->getNomUrl(1,
'', 0, -1, 1);
1883 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1891 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1892 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">'.
dol_escape_htmltag($obj->ref_supplier).
'</td>'.
"\n";
1898 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1899 $projectstatic->id = $obj->project_id;
1900 $projectstatic->ref = $obj->project_ref;
1901 $projectstatic->title = $obj->project_title;
1902 print
'<td class="tdoverflowmax125">';
1903 if ($obj->project_id > 0) {
1904 print $projectstatic->getNomUrl(1);
1912 $userstatic->id = $obj->fk_user_author;
1913 $userstatic->lastname = $obj->lastname;
1914 $userstatic->firstname = $obj->firstname;
1915 $userstatic->login = $obj->login;
1916 $userstatic->photo = $obj->photo;
1917 $userstatic->email = $obj->user_email;
1918 $userstatic->status = $obj->user_status;
1919 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1920 print
'<td class="tdoverflowmax150">';
1921 if ($userstatic->id) {
1922 print $userstatic->getNomUrl(1);
1930 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1931 print
'<td class="tdoverflowmax150">';
1932 $thirdpartytmp->id = $obj->socid;
1933 $thirdpartytmp->name = $obj->name;
1934 $thirdpartytmp->email = $obj->email;
1935 $thirdpartytmp->name_alias = $obj->alias;
1936 $thirdpartytmp->client = $obj->client;
1937 $thirdpartytmp->fournisseur = $obj->fournisseur;
1938 print $thirdpartytmp->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1945 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1946 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->alias).
'">';
1954 if (!empty($arrayfields[
's.town'][
'checked'])) {
1955 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1963 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1964 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
1972 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1973 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
1979 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1980 print
'<td class="center">';
1981 $tmparray =
getCountry($obj->fk_pays,
'all');
1982 print $tmparray[
'label'];
1989 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1990 print
'<td class="center">';
1991 if (empty($typenArray)) {
1992 $typenArray = $formcompany->typent_array(1);
1994 print $typenArray[$obj->typent_code];
2002 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
2003 print
'<td class="center">';
2005 if ($objectstatic->statut != $objectstatic::STATUS_ORDERSENT && $objectstatic->statut != $objectstatic::STATUS_RECEIVED_PARTIALLY) {
2006 if ($objectstatic->hasDelay()) {
2007 print
' '.img_picto($langs->trans(
"Late").
' : '.$objectstatic->showDelay(),
"warning");
2016 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
2017 print
'<td class="center">';
2019 if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) {
2020 if ($objectstatic->hasDelay()) {
2021 print
' '.img_picto($langs->trans(
"Late").
' : '.$objectstatic->showDelay(),
"warning");
2030 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
2031 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2038 $totalarray[
'val'][
'cf.total_ht'] += $obj->total_ht;
2041 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
2042 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2049 $totalarray[
'val'][
'cf.total_tva'] += $obj->total_tva;
2052 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
2053 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2060 $totalarray[
'val'][
'cf.total_ttc'] += $obj->total_ttc;
2064 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
2065 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2072 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
2073 print
'<td class="nowrap">';
2074 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2081 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
2082 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2088 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
2089 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2095 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
2096 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2103 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2105 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2106 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
2107 print $hookmanager->resPrint;
2109 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
2110 print
'<td class="center nowraponall">';
2111 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2118 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
2119 print
'<td class="center nowraponall">';
2120 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2127 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
2128 print
'<td class="center">';
2130 print
yn($obj->billed, $langs->trans(
"Billed"));
2138 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
2139 print
'<td class="center nowrap">'.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).
'</td>';
2146 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
2147 print
'<td class="center">';
2155 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
2156 print
'<td class="center">';
2164 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
2165 print
'<td class="sensiblehtmlcontent center">';
2166 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2174 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
2175 print
'<td class="sensiblehtmlcontent center">';
2176 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2185 print
'<td class="nowrap center">';
2186 if ($massactionbutton || $massaction) {
2188 if (in_array($obj->rowid, $arrayofselected)) {
2191 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2201 $total += $obj->total_ht;
2202 $subtotal += $obj->total_ht;
2208 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2213 foreach ($arrayfields as $key => $val) {
2214 if (!empty($val[
'checked'])) {
2218 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2223 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2224 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2225 print $hookmanager->resPrint;
2227 print
'</table>'.
"\n";
2230 print
'</form>'.
"\n";
2232 $hidegeneratedfilelistifempty = 1;
2233 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2234 $hidegeneratedfilelistifempty = 0;
2238 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2239 $urlsource .= str_replace(
'&',
'&', $param);
2241 $filedir = $diroutputmassaction;
2242 $genallowed = $permissiontoread;
2243 $delallowed = $permissiontoadd;
2245 print $formfile->showdocuments(
'massfilesarea_supplier_order',
'', $filedir, $urlsource, 0, (
int) $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 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.
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_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...
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...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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.