38require
'../../main.inc.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formorder.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
64$langs->loadLangs(array(
"orders",
"sendings",
'companies',
'compta',
'bills',
'projects',
'suppliers',
'products'));
67$action =
GETPOST(
'action',
'aZ09');
68$massaction =
GETPOST(
'massaction',
'alpha');
70$confirm =
GETPOST(
'confirm',
'alpha');
71$toselect =
GETPOST(
'toselect',
'array:int');
72$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierorderlist';
73$mode =
GETPOST(
'mode',
'alpha');
76$search_date_order_startday =
GETPOSTINT(
'search_date_order_startday');
77$search_date_order_startmonth =
GETPOSTINT(
'search_date_order_startmonth');
78$search_date_order_startyear =
GETPOSTINT(
'search_date_order_startyear');
79$search_date_order_endday =
GETPOSTINT(
'search_date_order_endday');
80$search_date_order_endmonth =
GETPOSTINT(
'search_date_order_endmonth');
81$search_date_order_endyear =
GETPOSTINT(
'search_date_order_endyear');
82$search_date_order_start =
dol_mktime(0, 0, 0, $search_date_order_startmonth, $search_date_order_startday, $search_date_order_startyear);
83$search_date_order_end =
dol_mktime(23, 59, 59, $search_date_order_endmonth, $search_date_order_endday, $search_date_order_endyear);
85$search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
86$search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
87$search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
88$search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
89$search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
90$search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
91$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
92$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
94$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
95$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
96$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
97$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
98$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
99$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
100$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
101$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
103$search_date_approve_startday =
GETPOSTINT(
'search_date_approve_startday');
104$search_date_approve_startmonth =
GETPOSTINT(
'search_date_approve_startmonth');
105$search_date_approve_startyear =
GETPOSTINT(
'search_date_approve_startyear');
106$search_date_approve_endday =
GETPOSTINT(
'search_date_approve_endday');
107$search_date_approve_endmonth =
GETPOSTINT(
'search_date_approve_endmonth');
108$search_date_approve_endyear =
GETPOSTINT(
'search_date_approve_endyear');
109$search_date_approve_start =
dol_mktime(0, 0, 0, $search_date_approve_startmonth, $search_date_approve_startday, $search_date_approve_startyear);
110$search_date_approve_end =
dol_mktime(23, 59, 59, $search_date_approve_endmonth, $search_date_approve_endday, $search_date_approve_endyear);
112$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
114$searchCategorySupplierOrderList =
GETPOST(
'search_category_supplier_order_list',
'array:int');
115$searchCategorySupplierOrderOperator = 0;
116if (GETPOSTISSET(
'formfilteraction')) {
117 $searchCategorySupplierOrderOperator =
GETPOSTINT(
'search_category_supplier_order_operator');
119 $searchCategorySupplierOrderOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
121$search_product_category =
GETPOSTINT(
'search_product_category');
122$search_ref =
GETPOST(
'search_ref',
'alpha');
123$search_refsupp =
GETPOST(
'search_refsupp',
'alpha');
124$search_company =
GETPOST(
'search_company',
'alpha');
125$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
126$search_town =
GETPOST(
'search_town',
'alpha');
127$search_zip =
GETPOST(
'search_zip',
'alpha');
128$search_state =
GETPOST(
"search_state",
'alpha');
129$search_country =
GETPOST(
"search_country",
'aZ09');
130$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
131$search_user =
GETPOST(
'search_user',
'intcomma');
132$search_request_author =
GETPOST(
'search_request_author',
'alpha');
133$optioncss =
GETPOST(
'optioncss',
'alpha');
135$search_sale =
GETPOST(
'search_sale',
'intcomma');
136$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
137$search_total_tva =
GETPOST(
'search_total_tva',
'alpha');
138$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
139$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
140$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
141$search_note_private =
GETPOST(
'search_note_private',
'alpha');
142$search_note_public =
GETPOST(
'search_note_public',
'alpha');
143$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
144$search_multicurrency_montant_tva =
GETPOST(
'search_multicurrency_montant_tva',
'alpha');
145$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
146$optioncss =
GETPOST(
'optioncss',
'alpha');
147$billed =
GETPOST(
'billed',
'int');
148$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
149$search_btn =
GETPOST(
'button_search',
'alpha');
150$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
153 $search_status = implode(
',',
GETPOST(
'search_status',
'array:intcomma'));
155 $search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') :
GETPOST(
'statut',
'intcomma'));
158$search_option =
GETPOST(
'search_option',
'alpha');
159if ($search_option ==
'late') {
160 $search_status =
'1,2';
162if ($search_option ==
'recv_late') {
163 $search_status =
'3,4';
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'));
190$extrafields->fetch_name_optionals_label(
$object->table_element);
191$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
193$diroutputmassaction =
getMultidirTemp($object).
'/massgeneration/'.$user->id;
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->isExternalUser();
255if ($user->isExternalUser()) {
256 $socid = $user->isExternalUser();
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';
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;
466 if ($objecttmp->id > 0) {
467 if (empty($objecttmp->note_public)) {
468 $objecttmp->note_public = $langs->transnoentities(
"Orders");
471 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"element_element (";
473 $sql .=
", sourcetype";
474 $sql .=
", fk_target";
475 $sql .=
", targettype";
476 $sql .=
") VALUES (";
478 $sql .=
", '".$db->escape($objecttmp->origin).
"'";
479 $sql .=
", ".((int) $objecttmp->id);
480 $sql .=
", '".$db->escape($objecttmp->element).
"'";
483 if (!
$db->query($sql)) {
488 $lines = $cmd->lines;
489 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
491 $lines = $cmd->lines;
495 $num = count($lines);
497 for ($i = 0; $i < $num; $i++) {
498 $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
500 if (!empty($createbills_onebythird)) {
503 if ($lines[$i]->subprice < 0) {
504 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
508 $discount->fk_soc = $objecttmp->socid;
509 $discount->socid = $objecttmp->socid;
510 $discount->amount_ht = abs($lines[$i]->total_ht);
511 $discount->amount_tva = abs($lines[$i]->total_tva);
512 $discount->amount_ttc = abs($lines[$i]->total_ttc);
513 $discount->tva_tx = $lines[$i]->tva_tx;
514 $discount->fk_user = $user->id;
515 $discount->description = $desc;
516 $discountid = $discount->create($user);
517 if ($discountid > 0) {
518 $result = $objecttmp->insert_discount($discountid);
527 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
530 if ($lines[$i]->date_debut_prevue) {
533 if ($lines[$i]->date_debut_reel) {
536 if ($lines[$i]->date_start) {
541 if ($lines[$i]->date_fin_prevue) {
542 $date_end = $lines[$i]->date_fin_prevue;
544 if ($lines[$i]->date_fin_reel) {
545 $date_end = $lines[$i]->date_fin_reel;
547 if ($lines[$i]->date_end) {
548 $date_end = $lines[$i]->date_end;
551 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
555 $tva_tx = $lines[$i]->tva_tx;
557 if (!empty($lines[$i]->vat_src_code) && !preg_match(
'/\(/', (
string) $tva_tx)) {
558 $tva_tx .=
' ('.$lines[$i]->vat_src_code.
')';
561 $result = $objecttmp->addline(
563 $lines[$i]->subprice,
565 $lines[$i]->localtax1_tx,
566 $lines[$i]->localtax2_tx,
568 $lines[$i]->fk_product,
569 $lines[$i]->remise_percent,
573 $lines[$i]->info_bits,
579 $lines[$i]->array_options,
582 $lines[$i]->fk_commande,
584 $lines[$i]->ref_supplier,
585 $lines[$i]->special_code,
596 if ($result > 0 && $lines[$i]->product_type == 9) {
597 $fk_parent_line = $result;
605 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_supplier) ?
'' :
' ('.$cmd->ref_supplier.
')'));
606 $objecttmp->update($user);
609 $cmd->classifyBilled($user);
611 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
612 $TFactThird[$cmd->socid] = $objecttmp;
614 $TFact[$objecttmp->id] = $objecttmp;
619 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
622 if (!$error && $validate_invoices) {
623 $massaction = $action =
'builddoc';
625 foreach ($TAllFact as &$objecttmp) {
626 $objecttmp->validate($user);
633 $id = $objecttmp->id;
638 $permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
642 $massaction = $action =
'confirm_createsupplierbills';
648 if ($nb_bills_created == 1) {
649 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
650 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
653 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
659 $param .=
'&mode='.urlencode($mode);
661 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
662 $param .=
'&contextpage='.urlencode($contextpage);
664 if ($limit > 0 && $limit !=
$conf->liste_limit) {
665 $param .=
'&limit='.((int) $limit);
668 $param .=
'&search_all='.urlencode($search_all);
671 $param .=
'&socid='.urlencode((
string) ($socid));
673 if ($search_status !=
'') {
674 $param .=
'&search_status='.urlencode($search_status);
676 if ($search_option) {
677 $param .=
'&search_option='.urlencode($search_option);
679 if ($search_date_order_startday) {
680 $param .=
'&search_date_order_startday='.urlencode((
string) ($search_date_order_startday));
682 if ($search_date_order_startmonth) {
683 $param .=
'&search_date_order_startmonth='.urlencode((
string) ($search_date_order_startmonth));
685 if ($search_date_order_startyear) {
686 $param .=
'&search_date_order_startyear='.urlencode((
string) ($search_date_order_startyear));
688 if ($search_date_order_endday) {
689 $param .=
'&search_date_order_endday='.urlencode((
string) ($search_date_order_endday));
691 if ($search_date_order_endmonth) {
692 $param .=
'&search_date_order_endmonth='.urlencode((
string) ($search_date_order_endmonth));
694 if ($search_date_order_endyear) {
695 $param .=
'&search_date_order_endyear='.urlencode((
string) ($search_date_order_endyear));
697 if ($search_date_delivery_startday) {
698 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
700 if ($search_date_delivery_startmonth) {
701 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
703 if ($search_date_delivery_startyear) {
704 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
706 if ($search_date_delivery_endday) {
707 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
709 if ($search_date_delivery_endmonth) {
710 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
712 if ($search_date_delivery_endyear) {
713 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
715 if ($search_date_valid_startday) {
716 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
718 if ($search_date_valid_startmonth) {
719 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
721 if ($search_date_valid_startyear) {
722 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
724 if ($search_date_valid_endday) {
725 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
727 if ($search_date_valid_endmonth) {
728 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
730 if ($search_date_valid_endyear) {
731 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
733 if ($search_date_approve_startday) {
734 $param .=
'&search_date_approve_startday='.urlencode((
string) ($search_date_approve_startday));
736 if ($search_date_approve_startmonth) {
737 $param .=
'&search_date_approve_startmonth='.urlencode((
string) ($search_date_approve_startmonth));
739 if ($search_date_approve_startyear) {
740 $param .=
'&search_date_approve_startyear='.urlencode((
string) ($search_date_approve_startyear));
742 if ($search_date_approve_endday) {
743 $param .=
'&search_date_approve_endday='.urlencode((
string) ($search_date_approve_endday));
745 if ($search_date_approve_endmonth) {
746 $param .=
'&search_date_approve_endmonth='.urlencode((
string) ($search_date_approve_endmonth));
748 if ($search_date_approve_endyear) {
749 $param .=
'&search_date_approve_endyear='.urlencode((
string) ($search_date_approve_endyear));
752 $param .=
'&search_ref='.urlencode($search_ref);
754 if ($search_company) {
755 $param .=
'&search_company='.urlencode($search_company);
757 if ($search_company_alias) {
758 $param .=
'&search_company_alias='.urlencode($search_company_alias);
761 if ($search_user > 0) {
762 $param .=
'&search_user='.urlencode((
string) ($search_user));
764 if ($searchCategorySupplierOrderOperator == 1) {
765 $param .=
"&search_category_supplier_order_operator=".urlencode((
string) ($searchCategorySupplierOrderOperator));
767 foreach ($searchCategorySupplierOrderList as $searchCategorySupplierOrder) {
768 $param .=
"&search_category_order_list[]=".urlencode($searchCategorySupplierOrder);
770 if ($search_sale > 0) {
771 $param .=
'&search_sale='.urlencode($search_sale);
773 if ($search_total_ht !=
'') {
774 $param .=
'&search_total_ht='.urlencode($search_total_ht);
776 if ($search_total_tva !=
'') {
777 $param .=
'&search_total_tva='.urlencode($search_total_tva);
779 if ($search_total_ttc !=
'') {
780 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
782 if ($search_project_ref >= 0) {
783 $param .=
"&search_project_ref=".urlencode($search_project_ref);
786 $param .=
'&show_files='.urlencode((
string) ($show_files));
788 if ($optioncss !=
'') {
789 $param .=
'&optioncss='.urlencode($optioncss);
792 $param .=
'&billed='.((int) ($billed));
795 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
800 $_GET[
"origin"] =
GETPOST(
"origin",
'alpha');
823$title = $langs->trans(
"SuppliersOrders");
826 $fourn->fetch($socid);
827 $title .=
' - '.$fourn->name;
831 $title .=
' - '.$langs->trans(
"Billed");
837$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
838$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
842 $sql =
'SELECT DISTINCT';
844$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,';
845$sql .=
" typent.code as typent_code,";
846$sql .=
" state.code_departement as state_code, state.nom as state_name,";
847$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,";
848$sql .=
' cf.localtax1 as total_localtax1, cf.localtax2 as total_localtax2,';
849$sql .=
' cf.fk_multicurrency, cf.multicurrency_code, cf.multicurrency_tx, cf.multicurrency_total_ht, cf.multicurrency_total_tva, cf.multicurrency_total_ttc,';
850$sql .=
' cf.date_creation as date_creation, cf.tms as date_modification,';
851$sql .=
' cf.note_public, cf.note_private,';
852$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_title,";
853$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.email as user_email, u.statut as user_status";
855if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
856 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
857 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
861$parameters = array();
862$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
863$sql .= $hookmanager->resPrint;
867$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
868$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
869$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
870$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
871$sql .=
", ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
872if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
873 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cf.rowid = ef.fk_object)";
876 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseurdet as pd ON cf.rowid=pd.fk_commande';
878$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON cf.fk_user_author = u.rowid";
879$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cf.fk_projet";
880$parameters = array();
881$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
882$sql .= $hookmanager->resPrint;
883$sql .=
' WHERE cf.fk_soc = s.rowid';
884$sql .=
' AND cf.entity IN ('.getEntity(
'supplier_order').
')';
886 $sql .=
" AND s.rowid = ".((int) $socid);
891if ($search_refsupp) {
895 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
897if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
898 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
900 if ($search_company) {
903 if ($search_company_alias) {
907if ($search_request_author) {
908 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_request_author);
910if ($billed !=
'' && $billed !=
'-1') {
911 $sql .=
" AND cf.billed = ".((int) $billed);
914if (
GETPOST(
'statut',
'intcomma') !==
'') {
915 $sql .=
" AND cf.fk_statut IN (".$db->sanitize(
$db->escape(
$db->escape(
GETPOST(
'statut',
'intcomma')))).
")";
917if ($search_status !=
'' && $search_status !=
'-1') {
918 $sql .=
" AND cf.fk_statut IN (".$db->sanitize(
$db->escape($search_status)).
")";
920if ($search_option ==
'late') {
921 $sql .=
" AND cf.date_commande < '".$db->idate(
dol_now() -
$conf->order->fournisseur->warning_delay).
"'";
923if ($search_date_order_start) {
924 $sql .=
" AND cf.date_commande >= '".$db->idate($search_date_order_start).
"'";
926if ($search_date_order_end) {
927 $sql .=
" AND cf.date_commande <= '".$db->idate($search_date_order_end).
"'";
929if ($search_date_delivery_start) {
930 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
932if ($search_date_delivery_end) {
933 $sql .=
" AND cf.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
935if ($search_date_valid_start) {
936 $sql .=
" AND cf.date_valid >= '".$db->idate($search_date_valid_start).
"'";
938if ($search_note_public) {
939 $sql .=
" AND cf.note_public LIKE '%".$db->escape(
$db->escapeforlike($search_note_public)).
"%'";
941if ($search_date_approve_start) {
942 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_approve_start).
"'";
944if ($search_date_valid_end) {
945 $sql .=
" AND cf.date_valid <= '".$db->idate($search_date_valid_end).
"'";
947if ($search_date_approve_start) {
948 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_approve_start).
"'";
950if ($search_date_approve_end) {
951 $sql .=
" AND cf.date_livraison <= '".$db->idate($search_date_approve_end).
"'";
962if ($search_country) {
963 $sql .=
" AND s.fk_pays IN (".$db->sanitize(
$db->escape($search_country)).
')';
965if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
966 $sql .=
" AND s.fk_typent IN (".$db->sanitize(
$db->escape($search_type_thirdparty)).
')';
971if ($search_user > 0) {
972 $sql .=
" AND EXISTS (";
973 $sql .=
" SELECT ec.rowid ";
974 $sql .=
" FROM " . MAIN_DB_PREFIX .
"element_contact as ec";
975 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"c_type_contact as tc ON tc.rowid = ec.fk_c_type_contact";
976 $sql .=
" WHERE ec.element_id = cf.rowid AND ec.fk_socpeople = " . ((int) $search_user);
977 $sql .=
" AND tc.element = 'order_supplier' AND tc.source = 'internal'";
980if ($search_total_ht !=
'') {
983if ($search_total_tva !=
'') {
986if ($search_total_ttc !=
'') {
989if ($search_multicurrency_code !=
'') {
990 $sql .=
" AND cf.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
992if ($search_multicurrency_tx !=
'') {
993 $sql .=
natural_search(
'cf.multicurrency_tx', $search_multicurrency_tx, 1);
995if ($search_multicurrency_montant_ht !=
'') {
996 $sql .=
natural_search(
'cf.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
998if ($search_multicurrency_montant_tva !=
'') {
999 $sql .=
natural_search(
'cf.multicurrency_total_tva', $search_multicurrency_montant_tva, 1);
1001if ($search_multicurrency_montant_ttc !=
'') {
1002 $sql .=
natural_search(
'cf.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1004if ($search_project_ref !=
'') {
1008if ($search_sale && $search_sale !=
'-1') {
1009 if ($search_sale == -2) {
1010 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = cf.fk_soc)";
1011 } elseif ($search_sale > 0) {
1012 $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).
")";
1016if (!empty($searchCategorySupplierOrderList)) {
1017 $searchCategorySupplierOrderSqlList = array();
1018 $listofcategoryid =
'';
1019 foreach ($searchCategorySupplierOrderList as $searchCategorySupplierOrder) {
1020 if (intval($searchCategorySupplierOrder) == -2) {
1021 $searchCategorySupplierOrderSqlList[] =
"NOT EXISTS (SELECT ck.fk_supplier_order FROM ".MAIN_DB_PREFIX.
"categorie_supplier_order as ck WHERE cf.rowid = ck.fk_supplier_order)";
1022 } elseif (intval($searchCategorySupplierOrder) > 0) {
1023 if ($searchCategorySupplierOrderOperator == 0) {
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 = ".((int) $searchCategorySupplierOrder).
")";
1026 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplierOrder);
1030 if ($listofcategoryid) {
1031 $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).
"))";
1033 if ($searchCategorySupplierOrderOperator == 1) {
1034 if (!empty($searchCategorySupplierOrderSqlList)) {
1035 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierOrderSqlList).
")";
1038 if (!empty($searchCategorySupplierOrderSqlList)) {
1039 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierOrderSqlList).
")";
1044$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
1045$searchCategoryProductList = array($search_product_category);
1046if (!empty($searchCategoryProductList)) {
1047 $searchCategoryProductSqlList = array();
1048 $listofcategoryid =
'';
1049 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1050 if (intval($searchCategoryProduct) == -2) {
1051 $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)";
1052 } elseif (intval($searchCategoryProduct) > 0) {
1053 if ($searchCategoryProductOperator == 0) {
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 = ".((int) $searchCategoryProduct).
")";
1056 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1060 if ($listofcategoryid) {
1061 $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).
"))";
1063 if ($searchCategoryProductOperator == 1) {
1064 if (!empty($searchCategoryProductSqlList)) {
1065 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1068 if (!empty($searchCategoryProductSqlList)) {
1069 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1074include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1076$parameters = array();
1077$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
1078$sql .= $hookmanager->resPrint;
1081$nbtotalofrecords =
'';
1084 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1085 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1086 $resql =
$db->query($sqlforcount);
1088 $objforcount =
$db->fetch_object($resql);
1089 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1094 if (($page * $limit) > (
int) $nbtotalofrecords) {
1101$sql .=
$db->order($sortfield, $sortorder);
1103 $sql .=
$db->plimit($limit + 1, $offset);
1107$resql =
$db->query($sql);
1109 $num =
$db->num_rows($resql);
1111 $arrayofselected = is_array($toselect) ? $toselect : array();
1113 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1114 $obj =
$db->fetch_object($resql);
1116 header(
"Location: ".DOL_URL_ROOT.
'/fourn/commande/card.php?id='.
$id);
1120 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-supplier-order page-list');
1123 if (!empty($mode)) {
1124 $param .=
'&mode='.urlencode($mode);
1126 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1127 $param .=
'&contextpage='.urlencode($contextpage);
1129 if ($limit > 0 && $limit !=
$conf->liste_limit) {
1130 $param .=
'&limit='.((int) $limit);
1133 $param .=
'&search_all='.urlencode($search_all);
1136 $param .=
'&socid='.urlencode((
string) ($socid));
1139 $param .=
"&search_all=".urlencode($search_all);
1141 if ($search_date_order_startday) {
1142 $param .=
'&search_date_order_startday='.urlencode((
string) ($search_date_order_startday));
1144 if ($search_date_order_startmonth) {
1145 $param .=
'&search_date_order_startmonth='.urlencode((
string) ($search_date_order_startmonth));
1147 if ($search_date_order_startyear) {
1148 $param .=
'&search_date_order_startyear='.urlencode((
string) ($search_date_order_startyear));
1150 if ($search_date_order_endday) {
1151 $param .=
'&search_date_order_endday='.urlencode((
string) ($search_date_order_endday));
1153 if ($search_date_order_endmonth) {
1154 $param .=
'&search_date_order_endmonth='.urlencode((
string) ($search_date_order_endmonth));
1156 if ($search_date_order_endyear) {
1157 $param .=
'&search_date_order_endyear='.urlencode((
string) ($search_date_order_endyear));
1159 if ($search_date_delivery_startday) {
1160 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
1162 if ($search_date_delivery_startmonth) {
1163 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
1165 if ($search_date_delivery_startyear) {
1166 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
1168 if ($search_date_delivery_endday) {
1169 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
1171 if ($search_date_delivery_endmonth) {
1172 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
1174 if ($search_date_delivery_endyear) {
1175 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
1177 if ($search_date_valid_startday) {
1178 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1180 if ($search_date_valid_startmonth) {
1181 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1183 if ($search_date_valid_startyear) {
1184 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1186 if ($search_date_valid_endday) {
1187 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1189 if ($search_date_valid_endmonth) {
1190 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1192 if ($search_date_valid_endyear) {
1193 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1195 if ($search_date_approve_startday) {
1196 $param .=
'&search_date_approve_startday='.urlencode((
string) ($search_date_approve_startday));
1198 if ($search_date_approve_startmonth) {
1199 $param .=
'&search_date_approve_startmonth='.urlencode((
string) ($search_date_approve_startmonth));
1201 if ($search_date_approve_startyear) {
1202 $param .=
'&search_date_approve_startyear='.urlencode((
string) ($search_date_approve_startyear));
1204 if ($search_date_approve_endday) {
1205 $param .=
'&search_date_approve_endday='.urlencode((
string) ($search_date_approve_endday));
1207 if ($search_date_approve_endmonth) {
1208 $param .=
'&search_date_approve_endmonth='.urlencode((
string) ($search_date_approve_endmonth));
1210 if ($search_date_approve_endyear) {
1211 $param .=
'&search_date_approve_endyear='.urlencode((
string) ($search_date_approve_endyear));
1214 $param .=
'&search_ref='.urlencode($search_ref);
1216 if ($search_company) {
1217 $param .=
'&search_company='.urlencode($search_company);
1219 if ($search_company_alias) {
1220 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1222 if ($search_user > 0) {
1223 $param .=
'&search_user='.urlencode((
string) ($search_user));
1225 if ($search_request_author) {
1226 $param .=
'&search_request_author='.urlencode($search_request_author);
1228 if ($search_sale > 0) {
1229 $param .=
'&search_sale='.urlencode($search_sale);
1231 if ($search_total_ht !=
'') {
1232 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1234 if ($search_total_ttc !=
'') {
1235 $param .=
"&search_total_ttc=".urlencode($search_total_ttc);
1237 if ($search_multicurrency_code !=
'') {
1238 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1240 if ($search_multicurrency_tx !=
'') {
1241 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1243 if ($search_multicurrency_montant_ht !=
'') {
1244 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1246 if ($search_multicurrency_montant_tva !=
'') {
1247 $param .=
'&search_multicurrency_montant_tva='.urlencode($search_multicurrency_montant_tva);
1249 if ($search_multicurrency_montant_ttc !=
'') {
1250 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1252 if ($search_refsupp) {
1253 $param .=
"&search_refsupp=".urlencode($search_refsupp);
1255 if ($search_status !=
'' && $search_status !=
'-1') {
1256 $param .=
"&search_status=".urlencode($search_status);
1258 if ($search_option) {
1259 $param .=
"&search_option=".urlencode($search_option);
1261 if ($search_project_ref >= 0) {
1262 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1264 if ($billed !=
'') {
1265 $param .=
"&billed=".((int) $billed);
1268 $param .=
'&show_files='.urlencode((
string) ($show_files));
1270 if ($optioncss !=
'') {
1271 $param .=
'&optioncss='.urlencode($optioncss);
1273 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1274 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1278 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1280 $parameters = array(
'param' => &$param);
1281 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
1282 $param .= $hookmanager->resPrint;
1285 $arrayofmassactions = array(
1286 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1287 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1288 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1290 if (
isModEnabled(
'category') && $user->hasRight(
"fournisseur",
"commande",
"lire")) {
1291 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1293 if ($permissiontovalidate) {
1294 if ($permissiontoapprove && !
getDolGlobalString(
'SUPPLIER_ORDER_NO_DIRECT_APPROVE')) {
1295 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove");
1297 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1301 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
"supplier_invoice",
"creer")) {
1302 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisSupplier");
1304 if ($permissiontodelete) {
1305 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1307 if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1308 $arrayofmassactions = array();
1310 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1312 $url = DOL_URL_ROOT.
'/fourn/commande/card.php?action=create';
1314 $url .=
'&socid='.((int) $socid);
1315 $url .=
'&backtopage='.urlencode(DOL_URL_ROOT.
'/fourn/commande/list.php?socid='.((
int) $socid));
1317 $newcardbutton =
'';
1318 $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'));
1319 $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'));
1320 $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'));
1321 $newcardbutton .= dolGetButtonTitleSeparator();
1322 $newcardbutton .= dolGetButtonTitle($langs->trans(
'NewSupplierOrderShort'),
'',
'fa fa-plus-circle', $url,
'', (
int) $permissiontoadd);
1325 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
1326 if ($optioncss !=
'') {
1327 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1329 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1330 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1331 print
'<input type="hidden" name="action" value="list">';
1332 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1333 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1334 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1335 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1336 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1338 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1340 $topicmail =
"SendOrderRef";
1341 $modelmail =
"order_supplier_send";
1343 $trackid =
'sord'.$object->id;
1344 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1346 if ($massaction ==
'prevalidate') {
1347 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1350 if ($massaction ==
'createbills') {
1352 print
'<input type="hidden" name="massaction" value="confirm_createsupplierbills">';
1354 print
'<table class="noborder centpercent">';
1356 print
'<td class="titlefield">';
1357 print $langs->trans(
'DateInvoice');
1360 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1365 print $langs->trans(
'CreateOneBillByThird');
1368 print $form->selectyesno(
'createbills_onebythird',
'', 1);
1373 print $langs->trans(
'ValidateInvoices');
1376 print $form->selectyesno(
'validate_invoices', 1, 1);
1381 print
'<div class="center">';
1382 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1383 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1390 foreach ($fieldstosearchall as $key => $val) {
1391 $fieldstosearchall[$key] = $langs->trans($val);
1393 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1396 $moreforfilter =
'';
1397 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1398 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
1400 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER_ORDER, $searchCategorySupplierOrderList,
'minwidth300', $searchCategorySupplierOrderOperator ? $searchCategorySupplierOrderOperator : 0);
1403 if ($user->hasRight(
"user",
"user",
"lire")) {
1404 $langs->load(
"commercial");
1405 $moreforfilter .=
'<div class="divsearchfield">';
1406 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1407 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1408 $moreforfilter .=
'</div>';
1411 if ($user->hasRight(
"user",
"user",
"lire")) {
1412 $moreforfilter .=
'<div class="divsearchfield">';
1413 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1414 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1415 $moreforfilter .=
'</div>';
1418 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1419 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1420 $moreforfilter .=
'<div class="divsearchfield">';
1421 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1422 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1423 $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);
1424 $moreforfilter .=
'</div>';
1427 $moreforfilter .=
'<div class="divsearchfield valignmiddle" title="'.$langs->trans(
"Alert").
' '.$langs->trans(
"Late").
'">';
1428 $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' :
'').
'>';
1429 $moreforfilter .=
'</div>';
1430 $parameters = array();
1431 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1432 if (empty($reshook)) {
1433 $moreforfilter .= $hookmanager->resPrint;
1435 $moreforfilter = $hookmanager->resPrint;
1438 if (!empty($moreforfilter)) {
1439 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1440 print $moreforfilter;
1444 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1445 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1446 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1449 $selectedfields .=
'<script>';
1450 $selectedfields .=
' $(document).ready(function() {';
1451 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1452 $selectedfields .=
' $("#checkforselects").click();';
1453 $selectedfields .=
' $("#massaction").val("createbills").change();';
1454 $selectedfields .=
' });';
1455 $selectedfields .=
'</script>';
1458 print
'<div class="div-table-responsive">';
1459 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1461 print
'<tr class="liste_titre_filter">';
1463 if (
$conf->main_checkbox_left_column) {
1464 print
'<td class="liste_titre middle">';
1465 $searchpicto = $form->showFilterButtons(
'left');
1470 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1471 print
'<td class="liste_titre"><input size="8" type="text" class="flat maxwidth75" name="search_ref" value="'.$search_ref.
'"></td>';
1474 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1475 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_refsupp" value="'.$search_refsupp.
'"></td>';
1478 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1479 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_project_ref" value="'.$search_project_ref.
'"></td>';
1482 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1483 print
'<td class="liste_titre">';
1484 print
'<input type="text" class="flat" size="6" name="search_request_author" value="'.$search_request_author.
'">';
1488 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1489 print
'<td class="liste_titre"><input type="text" size="6" class="flat" name="search_company" value="'.$search_company.
'"></td>';
1492 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1493 print
'<td class="liste_titre"><input type="text" size="6" class="flat" name="search_company_alias" value="'.$search_company_alias.
'"></td>';
1496 if (!empty($arrayfields[
's.town'][
'checked'])) {
1497 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1500 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1501 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1504 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1505 print
'<td class="liste_titre">';
1506 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1510 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1511 print
'<td class="liste_titre center">';
1512 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1516 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1517 print
'<td class="liste_titre maxwidthonsmartphone center">';
1518 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);
1522 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1523 print
'<td class="liste_titre center">';
1524 print
'<div class="nowrapfordate">';
1525 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'));
1527 print
'<div class="nowrapfordate">';
1528 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'));
1533 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1534 print
'<td class="liste_titre center">';
1535 print
'<div class="nowrapfordate">';
1536 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'));
1538 print
'<div class="nowrapfordate">';
1539 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'));
1543 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1545 print
'<td class="liste_titre right">';
1546 print
'<input class="flat" type="text" size="5" name="search_total_ht" value="'.$search_total_ht.
'">';
1549 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1551 print
'<td class="liste_titre right">';
1552 print
'<input class="flat" type="text" size="5" name="search_total_tva" value="'.$search_total_tva.
'">';
1555 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1557 print
'<td class="liste_titre right">';
1558 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1561 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
1563 print
'<td class="liste_titre">';
1564 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1567 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
1569 print
'<td class="liste_titre">';
1570 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1573 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
1575 print
'<td class="liste_titre right">';
1576 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1579 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
1581 print
'<td class="liste_titre right">';
1582 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_tva" value="'.dol_escape_htmltag($search_multicurrency_montant_tva).
'">';
1585 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
1587 print
'<td class="liste_titre right">';
1588 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1592 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1595 $parameters = array(
'arrayfields' => $arrayfields);
1596 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1597 print $hookmanager->resPrint;
1599 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
1600 print
'<td class="liste_titre">';
1604 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
1605 print
'<td class="liste_titre">';
1609 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
1610 print
'<td class="liste_titre center parentonrightofpage">';
1611 print $form->selectyesno(
'billed', $billed, 1,
false, 1, 1,
'search_status width100 onrightofpage');
1615 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
1616 print
'<td class="liste_titre center parentonrightofpage">';
1617 $formorder->selectSupplierOrderStatus($search_status, 1,
'search_status',
'search_status width125 onrightofpage');
1621 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
1622 print
'<td class="liste_titre center">';
1623 print
'<div class="nowrapfordate">';
1624 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'));
1626 print
'<div class="nowrapfordate">';
1627 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'));
1632 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
1633 print
'<td class="liste_titre center">';
1634 print
'<div class="nowrapfordate">';
1635 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'));
1637 print
'<div class="nowrapfordate">';
1638 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'));
1642 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
1644 print
'<td class="liste_titre">';
1645 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1648 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
1650 print
'<td class="liste_titre">';
1651 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1655 if (!
$conf->main_checkbox_left_column) {
1656 print
'<td class="liste_titre center">';
1657 $searchpicto = $form->showFilterButtons();
1668 print
'<tr class="liste_titre">';
1669 if (
$conf->main_checkbox_left_column) {
1670 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1673 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1674 print_liste_field_titre($arrayfields[
'cf.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.ref",
"", $param,
'', $sortfield, $sortorder);
1677 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1678 print_liste_field_titre($arrayfields[
'cf.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.ref_supplier",
"", $param,
'', $sortfield, $sortorder,
'tdoverflowmax100imp ');
1681 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1682 print_liste_field_titre($arrayfields[
'cf.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1685 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1686 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
"u.login",
"", $param,
'', $sortfield, $sortorder);
1689 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1690 print_liste_field_titre($arrayfields[
'cf.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
1693 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1695 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
'', $sortfield, $sortorder);
1698 if (!empty($arrayfields[
's.town'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1702 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1703 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1706 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1710 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1714 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1718 if (!empty($arrayfields[
'cf.fk_author'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
'cf.fk_author'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.fk_author",
"", $param,
'', $sortfield, $sortorder);
1722 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1723 print_liste_field_titre($arrayfields[
'cf.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_commande",
"", $param,
'', $sortfield, $sortorder,
'center ');
1726 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1727 print_liste_field_titre($arrayfields[
'cf.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1730 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1731 print_liste_field_titre($arrayfields[
'cf.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
1734 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1735 print_liste_field_titre($arrayfields[
'cf.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
1738 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1739 print_liste_field_titre($arrayfields[
'cf.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
1742 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
1743 print_liste_field_titre($arrayfields[
'cf.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1746 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
1747 print_liste_field_titre($arrayfields[
'cf.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1750 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
1751 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1754 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1758 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
1759 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1763 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1765 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1766 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1767 print $hookmanager->resPrint;
1768 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
1769 print_liste_field_titre($arrayfields[
'cf.date_creation'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1772 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
1773 print_liste_field_titre($arrayfields[
'cf.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1776 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
1777 print_liste_field_titre($arrayfields[
'cf.billed'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.billed',
'', $param,
'', $sortfield, $sortorder,
'center ');
1780 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
1781 print_liste_field_titre($arrayfields[
'cf.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1784 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
'cf.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1788 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
1789 print_liste_field_titre($arrayfields[
'cf.date_approve'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.date_approve',
'', $param,
'', $sortfield, $sortorder,
'center ');
1792 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
1793 print_liste_field_titre($arrayfields[
'cf.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.note_public",
"", $param,
'', $sortfield, $sortorder,
'center ');
1796 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
1797 print_liste_field_titre($arrayfields[
'cf.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.note_private",
"", $param,
'', $sortfield, $sortorder,
'center ');
1800 if (!
$conf->main_checkbox_left_column) {
1801 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1808 $productstat_cache = array();
1816 $totalarray = array(
'nbfield' => 0,
'val' => array(),
'pos' => array());
1821 $imaxinloop = ($limit ? min($num, $limit) : $num);
1822 while ($i < $imaxinloop) {
1823 $obj =
$db->fetch_object($resql);
1831 $objectstatic->id = $obj->rowid;
1832 $objectstatic->ref = $obj->ref;
1833 $objectstatic->ref_supplier = $obj->ref_supplier;
1834 $objectstatic->socid = $obj->socid;
1835 $objectstatic->total_ht = $obj->total_ht;
1836 $objectstatic->total_tva = $obj->total_tva;
1837 $objectstatic->total_ttc = $obj->total_ttc;
1838 $objectstatic->date =
$db->jdate($obj->date_commande);
1839 $objectstatic->date_commande =
$db->jdate($obj->date_commande);
1840 $objectstatic->date_creation =
$db->jdate($obj->date_creation);
1841 $objectstatic->delivery_date =
$db->jdate($obj->delivery_date);
1842 $objectstatic->note_public = $obj->note_public;
1843 $objectstatic->note_private = $obj->note_private;
1844 $objectstatic->statut = $obj->fk_statut;
1845 $objectstatic->status = $obj->fk_statut;
1847 if ($mode ==
'kanban') {
1849 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1850 print
'<div class="box-flex-container kanban">';
1853 $thirdpartytmp->id = $obj->socid;
1854 $thirdpartytmp->name = $obj->name;
1855 $thirdpartytmp->email = $obj->email;
1856 $thirdpartytmp->name_alias = $obj->alias;
1857 $thirdpartytmp->client = $obj->client;
1858 $thirdpartytmp->fournisseur = $obj->fournisseur;
1860 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $thirdpartytmp->getNomUrl(1,
'supplier', 0, 0, -1),
'selected' => in_array($objectstatic->id, $arrayofselected)));
1861 if ($i == ($imaxinloop - 1)) {
1866 print
'<tr class="oddeven row-with-select '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->billed == 1) ?
'opacitymedium' :
'').
'">';
1868 if (
$conf->main_checkbox_left_column) {
1869 print
'<td class="nowraponall center">';
1870 if ($massactionbutton || $massaction) {
1872 if (in_array($obj->rowid, $arrayofselected)) {
1875 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1883 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1884 print
'<td class="nowraponall">';
1887 print $objectstatic->getNomUrl(1,
'', 0, -1, 1);
1891 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1899 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1900 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">'.
dol_escape_htmltag($obj->ref_supplier).
'</td>'.
"\n";
1906 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1907 $projectstatic->id = $obj->project_id;
1908 $projectstatic->ref = $obj->project_ref;
1909 $projectstatic->title = $obj->project_title;
1910 print
'<td class="tdoverflowmax125">';
1911 if ($obj->project_id > 0) {
1912 print $projectstatic->getNomUrl(1);
1920 $userstatic->id = $obj->fk_user_author;
1921 $userstatic->lastname = $obj->lastname;
1922 $userstatic->firstname = $obj->firstname;
1923 $userstatic->login = $obj->login;
1924 $userstatic->photo = $obj->photo;
1925 $userstatic->email = $obj->user_email;
1926 $userstatic->status = $obj->user_status;
1927 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1928 print
'<td class="tdoverflowmax150">';
1929 if ($userstatic->id) {
1930 print $userstatic->getNomUrl(1);
1938 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1939 print
'<td class="tdoverflowmax150">';
1940 $thirdpartytmp->id = $obj->socid;
1941 $thirdpartytmp->name = $obj->name;
1942 $thirdpartytmp->email = $obj->email;
1943 $thirdpartytmp->name_alias = $obj->alias;
1944 $thirdpartytmp->client = $obj->client;
1945 $thirdpartytmp->fournisseur = $obj->fournisseur;
1946 print $thirdpartytmp->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1953 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1954 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->alias).
'">';
1962 if (!empty($arrayfields[
's.town'][
'checked'])) {
1963 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1971 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1972 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
1980 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1981 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
1987 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1988 print
'<td class="center">';
1989 $tmparray =
getCountry($obj->fk_pays,
'all');
1990 print $tmparray[
'label'];
1997 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1998 print
'<td class="center">';
1999 if (empty($typenArray)) {
2000 $typenArray = $formcompany->typent_array(1);
2002 print $typenArray[$obj->typent_code];
2010 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
2011 print
'<td class="center">';
2013 if ($objectstatic->statut != $objectstatic::STATUS_ORDERSENT && $objectstatic->statut != $objectstatic::STATUS_RECEIVED_PARTIALLY) {
2014 if ($objectstatic->hasDelay()) {
2015 print
' '.img_picto($langs->trans(
"Late").
' : '.$objectstatic->showDelay(),
"warning");
2024 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
2025 print
'<td class="center">';
2027 if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) {
2028 if ($objectstatic->hasDelay()) {
2029 print
' '.img_picto($langs->trans(
"Late").
' : '.$objectstatic->showDelay(),
"warning");
2038 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
2039 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2046 $totalarray[
'val'][
'cf.total_ht'] += $obj->total_ht;
2049 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
2050 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2057 $totalarray[
'val'][
'cf.total_tva'] += $obj->total_tva;
2060 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
2061 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2068 $totalarray[
'val'][
'cf.total_ttc'] += $obj->total_ttc;
2072 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
2073 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2080 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
2081 print
'<td class="nowrap">';
2082 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2089 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
2090 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2096 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
2097 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2103 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
2104 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2111 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2113 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
2114 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
2115 print $hookmanager->resPrint;
2117 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
2118 print
'<td class="center nowraponall">';
2126 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
2127 print
'<td class="center nowraponall">';
2135 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
2136 print
'<td class="center">';
2138 print
yn($obj->billed, $langs->trans(
"Billed"));
2146 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
2147 print
'<td class="center nowrap">'.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).
'</td>';
2154 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
2155 print
'<td class="center">';
2163 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
2164 print
'<td class="center">';
2172 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
2173 print
'<td class="sensiblehtmlcontent center">';
2174 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2182 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
2183 print
'<td class="sensiblehtmlcontent center">';
2184 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2192 if (!
$conf->main_checkbox_left_column) {
2193 print
'<td class="nowrap center">';
2194 if ($massactionbutton || $massaction) {
2196 if (in_array($obj->rowid, $arrayofselected)) {
2199 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2209 $total += $obj->total_ht;
2210 $subtotal += $obj->total_ht;
2216 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2221 foreach ($arrayfields as $key => $val) {
2222 if (!empty($val[
'checked'])) {
2226 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2231 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2232 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2233 print $hookmanager->resPrint;
2235 print
'</table>'.
"\n";
2238 print
'</form>'.
"\n";
2240 $hidegeneratedfilelistifempty = 1;
2241 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2242 $hidegeneratedfilelistifempty = 0;
2246 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2247 $urlsource .= str_replace(
'&',
'&', $param);
2249 $filedir = $diroutputmassaction;
2250 $genallowed = $permissiontoread;
2251 $delallowed = $permissiontoadd;
2253 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.
$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...
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.
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.
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.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
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.