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",
'deliveries',
'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');
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$search_product_category =
GETPOSTINT(
'search_product_category');
114$search_ref =
GETPOST(
'search_ref',
'alpha');
115$search_refsupp =
GETPOST(
'search_refsupp',
'alpha');
116$search_company =
GETPOST(
'search_company',
'alpha');
117$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
118$search_town =
GETPOST(
'search_town',
'alpha');
119$search_zip =
GETPOST(
'search_zip',
'alpha');
120$search_state =
GETPOST(
"search_state",
'alpha');
121$search_country =
GETPOST(
"search_country",
'aZ09');
122$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
123$search_user =
GETPOST(
'search_user',
'intcomma');
124$search_request_author =
GETPOST(
'search_request_author',
'alpha');
125$optioncss =
GETPOST(
'optioncss',
'alpha');
127$search_sale =
GETPOST(
'search_sale',
'intcomma');
128$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
129$search_total_tva =
GETPOST(
'search_total_tva',
'alpha');
130$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
131$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
132$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
133$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
134$search_multicurrency_montant_tva =
GETPOST(
'search_multicurrency_montant_tva',
'alpha');
135$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
136$optioncss =
GETPOST(
'optioncss',
'alpha');
137$search_billed =
GETPOST(
'search_billed',
'intcomma');
138$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
139$search_btn =
GETPOST(
'button_search',
'alpha');
140$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
143 $search_status = implode(
',',
GETPOST(
'search_status',
'array:intcomma'));
145 $search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') :
GETPOST(
'statut',
'intcomma'));
148$search_option =
GETPOST(
'search_option',
'alpha');
149if ($search_option ==
'late') {
150 $search_status =
'1,2';
153$diroutputmassaction =
$conf->fournisseur->commande->dir_output.
'/temp/massgeneration/'.$user->id;
156$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
157$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
159if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
163$offset = $limit * $page;
164$pageprev = $page - 1;
165$pagenext = $page + 1;
167 $sortfield =
'cf.ref';
175$hookmanager->initHooks(array(
'supplierorderlist'));
179$extrafields->fetch_name_optionals_label(
$object->table_element);
181$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
184$fieldstosearchall = array();
185foreach (
$object->fields as $key => $val) {
186 if (!empty($val[
'searchall'])) {
187 $fieldstosearchall[
'cf.'.$key] = $val[
'label'];
190$fieldstosearchall[
'pd.description'] =
'Description';
191$fieldstosearchall[
's.nom'] =
"ThirdParty";
192$fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
193$fieldstosearchall[
's.zip'] =
"Zip";
194$fieldstosearchall[
's.town'] =
"Town";
195if (empty($user->socid)) {
196 $fieldstosearchall[
"cf.note_private"] =
"NotePrivate";
199$checkedtypetiers = 0;
203 'u.login' => array(
'label' =>
"AuthorRequest",
'enabled' => 1,
'position' => 41),
204 's.name_alias' => array(
'label' =>
"AliasNameShort",
'position' => 51,
'checked' => 0),
205 's.town' => array(
'label' =>
"Town",
'enabled' => 1,
'position' => 55,
'checked' => 1),
206 's.zip' => array(
'label' =>
"Zip",
'enabled' => 1,
'position' => 56,
'checked' => 1),
207 'state.nom' => array(
'label' =>
"StateShort",
'enabled' => 1,
'position' => 57),
208 'country.code_iso' => array(
'label' =>
"Country",
'enabled' => 1,
'position' => 58),
209 'typent.code' => array(
'label' =>
"ThirdPartyType",
'enabled' => $checkedtypetiers,
'position' => 59),
210 'cf.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax1_assuj ==
"1"),
'position' => 140),
211 'cf.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' => 0,
'enabled' => ($mysoc->localtax2_assuj ==
"1"),
'position' => 145),
212 'cf.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 750),
213 'cf.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 760),
215foreach (
$object->fields as $key => $val) {
217 if (!empty($val[
'visible'])) {
218 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
219 $arrayfields[
'cf.'.$key] = array(
220 'label' => $val[
'label'],
221 'checked' => (($visible < 0) ? 0 : 1),
222 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
223 'position' => $val[
'position'],
224 'help' => isset($val[
'help']) ? $val[
'help'] :
''
229include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
233'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
238if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
239 $search_sale = $user->id;
245 $socid = $user->socid;
247$result =
restrictedArea($user,
'fournisseur', $orderid,
'',
'commande');
249$permissiontoread = ($user->hasRight(
"fournisseur",
"commande",
"lire") || $user->hasRight(
"supplier_order",
"lire"));
250$permissiontoadd = ($user->hasRight(
"fournisseur",
"commande",
"creer") || $user->hasRight(
"supplier_order",
"creer"));
251$permissiontodelete = ($user->hasRight(
"fournisseur",
"commande",
"supprimer") || $user->hasRight(
"supplier_order",
"supprimer"));
252$permissiontovalidate = $permissiontoadd;
253$permissiontoapprove = ($user->hasRight(
"fournisseur",
"commande",
"approuver") || $user->hasRight(
"supplier_order",
"approuver"));
260if (
GETPOST(
'cancel',
'alpha')) {
264if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createsupplierbills') {
268$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
269$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
274if (empty($reshook)) {
276 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
279 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
283 $search_product_category =
'';
285 $search_refsupp =
'';
286 $search_company =
'';
287 $search_company_alias =
'';
292 $search_country =
'';
293 $search_type_thirdparty =
'';
294 $search_request_author =
'';
295 $search_total_ht =
'';
296 $search_total_tva =
'';
297 $search_total_ttc =
'';
298 $search_multicurrency_code =
'';
299 $search_multicurrency_tx =
'';
300 $search_multicurrency_montant_ht =
'';
301 $search_multicurrency_montant_tva =
'';
302 $search_multicurrency_montant_ttc =
'';
303 $search_project_ref =
'';
306 $search_date_order_startday =
'';
307 $search_date_order_startmonth =
'';
308 $search_date_order_startyear =
'';
309 $search_date_order_endday =
'';
310 $search_date_order_endmonth =
'';
311 $search_date_order_endyear =
'';
312 $search_date_order_start =
'';
313 $search_date_order_end =
'';
314 $search_date_delivery_startday =
'';
315 $search_date_delivery_startmonth =
'';
316 $search_date_delivery_startyear =
'';
317 $search_date_delivery_endday =
'';
318 $search_date_delivery_endmonth =
'';
319 $search_date_delivery_endyear =
'';
320 $search_date_delivery_start =
'';
321 $search_date_delivery_end =
'';
322 $search_date_valid_startday =
'';
323 $search_date_valid_startmonth =
'';
324 $search_date_valid_startyear =
'';
325 $search_date_valid_endday =
'';
326 $search_date_valid_endmonth =
'';
327 $search_date_valid_endyear =
'';
328 $search_date_valid_start =
'';
329 $search_date_valid_end =
'';
330 $search_date_approve_startday =
'';
331 $search_date_approve_startmonth =
'';
332 $search_date_approve_startyear =
'';
333 $search_date_approve_endday =
'';
334 $search_date_approve_endmonth =
'';
335 $search_date_approve_endyear =
'';
336 $search_date_approve_start =
'';
337 $search_date_approve_end =
'';
341 $search_array_options = array();
343 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
344 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
349 $objectclass =
'CommandeFournisseur';
350 $objectlabel =
'SupplierOrders';
351 $uploaddir =
$conf->fournisseur->commande->dir_output;
352 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
354 if ($action ==
'validate' && $permissiontovalidate) {
355 if (
GETPOST(
'confirm') ==
'yes') {
360 foreach ($toselect as $checked) {
361 if ($objecttmp->fetch($checked)) {
362 if ($objecttmp->statut == 0) {
363 $objecttmp->date_commande =
dol_now();
364 $result = $objecttmp->valid($user);
367 if (!
getDolGlobalString(
'SUPPLIER_ORDER_NO_DIRECT_APPROVE') && $permissiontoapprove && !(
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') && $objecttmp->hasProductsOrServices(1))) {
368 $result = $objecttmp->approve($user);
369 setEventMessages($langs->trans(
"SupplierOrderValidatedAndApproved"), array($objecttmp->ref));
371 setEventMessages($langs->trans(
"SupplierOrderValidated"), array($objecttmp->ref));
390 if ($massaction ==
'confirm_createsupplierbills') {
391 $orders =
GETPOST(
'toselect',
'array');
392 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
393 $validate_invoices =
GETPOSTINT(
'validate_invoices');
397 $TFactThird = array();
399 $nb_bills_created = 0;
407 foreach ($orders as $id_order) {
409 if ($cmd->fetch($id_order) <= 0) {
414 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
416 $objecttmp = $TFactThird[$cmd->socid];
419 if (!empty($cmd->socid) > 0) {
421 $societe->fetch($cmd->socid);
422 $objecttmp->vat_reverse_charge = $societe->vat_reverse_charge;
423 $objecttmp->thirdparty = $societe;
425 $objecttmp->socid = $cmd->socid;
426 $objecttmp->type = $objecttmp::TYPE_STANDARD;
427 $objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
428 $objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
429 $objecttmp->fk_project = $cmd->fk_project;
430 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
431 $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier;
432 $default_ref_supplier += 1;
435 if (empty($datefacture)) {
439 $objecttmp->date = $datefacture;
440 $objecttmp->origin =
'order_supplier';
441 $objecttmp->origin_id = $id_order;
443 $res = $objecttmp->create($user);
447 $lastref = $objecttmp->ref;
448 $lastid = $objecttmp->id;
452 if ($objecttmp->id > 0) {
453 if (empty($objecttmp->note_public)) {
454 $objecttmp->note_public = $langs->transnoentities(
"Orders");
457 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"element_element (";
459 $sql .=
", sourcetype";
460 $sql .=
", fk_target";
461 $sql .=
", targettype";
462 $sql .=
") VALUES (";
464 $sql .=
", '".$db->escape($objecttmp->origin).
"'";
465 $sql .=
", ".((int) $objecttmp->id);
466 $sql .=
", '".$db->escape($objecttmp->element).
"'";
469 if (!$db->query($sql)) {
474 $lines = $cmd->lines;
475 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
477 $lines = $cmd->lines;
481 $num = count($lines);
483 for ($i = 0; $i < $num; $i++) {
484 $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
485 if ($lines[$i]->subprice < 0) {
486 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
490 $discount->fk_soc = $objecttmp->socid;
491 $discount->socid = $objecttmp->socid;
492 $discount->amount_ht = abs($lines[$i]->total_ht);
493 $discount->amount_tva = abs($lines[$i]->total_tva);
494 $discount->amount_ttc = abs($lines[$i]->total_ttc);
495 $discount->tva_tx = $lines[$i]->tva_tx;
496 $discount->fk_user = $user->id;
497 $discount->description = $desc;
498 $discountid = $discount->create($user);
499 if ($discountid > 0) {
500 $result = $objecttmp->insert_discount($discountid);
509 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
512 if ($lines[$i]->date_debut_prevue) {
513 $date_start = $lines[$i]->date_debut_prevue;
515 if ($lines[$i]->date_debut_reel) {
516 $date_start = $lines[$i]->date_debut_reel;
518 if ($lines[$i]->date_start) {
519 $date_start = $lines[$i]->date_start;
523 if ($lines[$i]->date_fin_prevue) {
524 $date_end = $lines[$i]->date_fin_prevue;
526 if ($lines[$i]->date_fin_reel) {
527 $date_end = $lines[$i]->date_fin_reel;
529 if ($lines[$i]->date_end) {
530 $date_end = $lines[$i]->date_end;
533 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
537 $tva_tx = $lines[$i]->tva_tx;
539 if (!empty($lines[$i]->vat_src_code) && !preg_match(
'/\(/', (
string) $tva_tx)) {
540 $tva_tx .=
' ('.$lines[$i]->vat_src_code.
')';
543 $result = $objecttmp->addline(
545 $lines[$i]->subprice,
547 $lines[$i]->localtax1_tx,
548 $lines[$i]->localtax2_tx,
550 $lines[$i]->fk_product,
551 $lines[$i]->remise_percent,
555 $lines[$i]->info_bits,
561 $lines[$i]->array_options,
564 $lines[$i]->fk_commande,
566 $lines[$i]->ref_supplier,
567 $lines[$i]->special_code,
578 if ($result > 0 && $lines[$i]->product_type == 9) {
579 $fk_parent_line = $result;
587 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_supplier) ?
'' :
' ('.$cmd->ref_supplier.
')'));
588 $objecttmp->update($user);
591 $cmd->classifyBilled($user);
593 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
594 $TFactThird[$cmd->socid] = $objecttmp;
596 $TFact[$objecttmp->id] = $objecttmp;
601 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
604 if (!$error && $validate_invoices) {
605 $massaction = $action =
'builddoc';
607 foreach ($TAllFact as &$objecttmp) {
608 $objecttmp->validate($user);
615 $id = $objecttmp->id;
619 $upload_dir =
$conf->fournisseur->facture->dir_output;
620 $permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
624 $massaction = $action =
'confirm_createsupplierbills';
630 if ($nb_bills_created == 1) {
631 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
632 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
635 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
641 $param .=
'&mode='.urlencode($mode);
643 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
644 $param .=
'&contextpage='.urlencode($contextpage);
646 if ($limit > 0 && $limit !=
$conf->liste_limit) {
647 $param .=
'&limit='.((int) $limit);
650 $param .=
'&search_all='.urlencode($search_all);
653 $param .=
'&socid='.urlencode((
string) ($socid));
655 if ($search_status !=
'') {
656 $param .=
'&search_status='.urlencode($search_status);
658 if ($search_option) {
659 $param .=
'&search_option='.urlencode($search_option);
661 if ($search_date_order_startday) {
662 $param .=
'&search_date_order_startday='.urlencode((
string) ($search_date_order_startday));
664 if ($search_date_order_startmonth) {
665 $param .=
'&search_date_order_startmonth='.urlencode((
string) ($search_date_order_startmonth));
667 if ($search_date_order_startyear) {
668 $param .=
'&search_date_order_startyear='.urlencode((
string) ($search_date_order_startyear));
670 if ($search_date_order_endday) {
671 $param .=
'&search_date_order_endday='.urlencode((
string) ($search_date_order_endday));
673 if ($search_date_order_endmonth) {
674 $param .=
'&search_date_order_endmonth='.urlencode((
string) ($search_date_order_endmonth));
676 if ($search_date_order_endyear) {
677 $param .=
'&search_date_order_endyear='.urlencode((
string) ($search_date_order_endyear));
679 if ($search_date_delivery_startday) {
680 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
682 if ($search_date_delivery_startmonth) {
683 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
685 if ($search_date_delivery_startyear) {
686 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
688 if ($search_date_delivery_endday) {
689 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
691 if ($search_date_delivery_endmonth) {
692 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
694 if ($search_date_delivery_endyear) {
695 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
697 if ($search_date_valid_startday) {
698 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
700 if ($search_date_valid_startmonth) {
701 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
703 if ($search_date_valid_startyear) {
704 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
706 if ($search_date_valid_endday) {
707 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
709 if ($search_date_valid_endmonth) {
710 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
712 if ($search_date_valid_endyear) {
713 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
715 if ($search_date_approve_startday) {
716 $param .=
'&search_date_approve_startday='.urlencode((
string) ($search_date_approve_startday));
718 if ($search_date_approve_startmonth) {
719 $param .=
'&search_date_approve_startmonth='.urlencode((
string) ($search_date_approve_startmonth));
721 if ($search_date_approve_startyear) {
722 $param .=
'&search_date_approve_startyear='.urlencode((
string) ($search_date_approve_startyear));
724 if ($search_date_approve_endday) {
725 $param .=
'&search_date_approve_endday='.urlencode((
string) ($search_date_approve_endday));
727 if ($search_date_approve_endmonth) {
728 $param .=
'&search_date_approve_endmonth='.urlencode((
string) ($search_date_approve_endmonth));
730 if ($search_date_approve_endyear) {
731 $param .=
'&search_date_approve_endyear='.urlencode((
string) ($search_date_approve_endyear));
734 $param .=
'&search_ref='.urlencode($search_ref);
736 if ($search_company) {
737 $param .=
'&search_company='.urlencode($search_company);
739 if ($search_company_alias) {
740 $param .=
'&search_company_alias='.urlencode($search_company_alias);
743 if ($search_user > 0) {
744 $param .=
'&search_user='.urlencode((
string) ($search_user));
746 if ($search_sale > 0) {
747 $param .=
'&search_sale='.urlencode($search_sale);
749 if ($search_total_ht !=
'') {
750 $param .=
'&search_total_ht='.urlencode($search_total_ht);
752 if ($search_total_tva !=
'') {
753 $param .=
'&search_total_tva='.urlencode($search_total_tva);
755 if ($search_total_ttc !=
'') {
756 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
758 if ($search_project_ref >= 0) {
759 $param .=
"&search_project_ref=".urlencode($search_project_ref);
762 $param .=
'&show_files='.urlencode((
string) ($show_files));
764 if ($optioncss !=
'') {
765 $param .=
'&optioncss='.urlencode($optioncss);
768 $param .=
'&billed='.urlencode($billed);
771 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
776 $_GET[
"origin"] = $_POST[
"origin"];
777 $_GET[
"originid"] = $_POST[
"originid"];
791$form =
new Form($db);
799$title = $langs->trans(
"SuppliersOrders");
802 $fourn->fetch($socid);
803 $title .=
' - '.$fourn->name;
806if ($search_billed > 0) {
807 $title .=
' - '.$langs->trans(
"Billed");
813$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
814$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
818 $sql =
'SELECT DISTINCT';
820$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,';
821$sql .=
" typent.code as typent_code,";
822$sql .=
" state.code_departement as state_code, state.nom as state_name,";
823$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,";
824$sql .=
' cf.localtax1 as total_localtax1, cf.localtax2 as total_localtax2,';
825$sql .=
' cf.fk_multicurrency, cf.multicurrency_code, cf.multicurrency_tx, cf.multicurrency_total_ht, cf.multicurrency_total_tva, cf.multicurrency_total_ttc,';
826$sql .=
' cf.date_creation as date_creation, cf.tms as date_modification,';
827$sql .=
' cf.note_public, cf.note_private,';
828$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_title,";
829$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.email as user_email, u.statut as user_status";
831if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
832 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
833 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
837$parameters = array();
838$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
839$sql .= $hookmanager->resPrint;
843$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
844$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
845$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
846$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
847$sql .=
", ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
848if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
849 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cf.rowid = ef.fk_object)";
852 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseurdet as pd ON cf.rowid=pd.fk_commande';
854$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON cf.fk_user_author = u.rowid";
855$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cf.fk_projet";
856$parameters = array();
857$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
858$sql .= $hookmanager->resPrint;
859$sql .=
' WHERE cf.fk_soc = s.rowid';
860$sql .=
' AND cf.entity IN ('.getEntity(
'supplier_order').
')';
862 $sql .=
" AND s.rowid = ".((int) $socid);
867if ($search_refsupp) {
871 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
873if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
874 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
876 if ($search_company) {
879 if ($search_company_alias) {
883if ($search_request_author) {
884 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_request_author);
886if ($search_billed !=
'' && $search_billed >= 0) {
887 $sql .=
" AND cf.billed = ".((int) $search_billed);
890if (
GETPOST(
'statut',
'intcomma') !==
'') {
891 $sql .=
" AND cf.fk_statut IN (".$db->sanitize($db->escape($db->escape(
GETPOST(
'statut',
'intcomma')))).
")";
893if ($search_status !=
'' && $search_status !=
'-1') {
894 $sql .=
" AND cf.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
896if ($search_option ==
'late') {
897 $sql .=
" AND cf.date_commande < '".$db->idate(
dol_now() -
$conf->order->fournisseur->warning_delay).
"'";
899if ($search_date_order_start) {
900 $sql .=
" AND cf.date_commande >= '".$db->idate($search_date_order_start).
"'";
902if ($search_date_order_end) {
903 $sql .=
" AND cf.date_commande <= '".$db->idate($search_date_order_end).
"'";
905if ($search_date_delivery_start) {
906 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
908if ($search_date_delivery_end) {
909 $sql .=
" AND cf.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
911if ($search_date_valid_start) {
912 $sql .=
" AND cf.date_valid >= '".$db->idate($search_date_valid_start).
"'";
914if ($search_date_valid_end) {
915 $sql .=
" AND cf.date_valid <= '".$db->idate($search_date_valid_end).
"'";
917if ($search_date_approve_start) {
918 $sql .=
" AND cf.date_livraison >= '".$db->idate($search_date_approve_start).
"'";
920if ($search_date_approve_end) {
921 $sql .=
" AND cf.date_livraison <= '".$db->idate($search_date_approve_end).
"'";
932if ($search_country) {
933 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
935if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
936 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
941if ($search_user > 0) {
942 $sql .=
" AND EXISTS (";
943 $sql .=
" SELECT ec.rowid ";
944 $sql .=
" FROM " . MAIN_DB_PREFIX .
"element_contact as ec";
945 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"c_type_contact as tc ON tc.rowid = ec.fk_c_type_contact";
946 $sql .=
" WHERE ec.element_id = cf.rowid AND ec.fk_socpeople = " . ((int) $search_user);
947 $sql .=
" AND tc.element = 'order_supplier' AND tc.source = 'internal'";
950if ($search_total_ht !=
'') {
953if ($search_total_tva !=
'') {
956if ($search_total_ttc !=
'') {
959if ($search_multicurrency_code !=
'') {
960 $sql .=
" AND cf.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
962if ($search_multicurrency_tx !=
'') {
963 $sql .=
natural_search(
'cf.multicurrency_tx', $search_multicurrency_tx, 1);
965if ($search_multicurrency_montant_ht !=
'') {
966 $sql .=
natural_search(
'cf.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
968if ($search_multicurrency_montant_tva !=
'') {
969 $sql .=
natural_search(
'cf.multicurrency_total_tva', $search_multicurrency_montant_tva, 1);
971if ($search_multicurrency_montant_ttc !=
'') {
972 $sql .=
natural_search(
'cf.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
974if ($search_project_ref !=
'') {
978if ($search_sale && $search_sale !=
'-1') {
979 if ($search_sale == -2) {
980 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = cf.fk_soc)";
981 } elseif ($search_sale > 0) {
982 $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).
")";
986$searchCategoryProductOperator = -1;
987$searchCategoryProductList = array($search_product_category);
988if (!empty($searchCategoryProductList)) {
989 $searchCategoryProductSqlList = array();
990 $listofcategoryid =
'';
991 foreach ($searchCategoryProductList as $searchCategoryProduct) {
992 if (intval($searchCategoryProduct) == -2) {
993 $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)";
994 } elseif (intval($searchCategoryProduct) > 0) {
995 if ($searchCategoryProductOperator == 0) {
996 $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).
")";
998 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1002 if ($listofcategoryid) {
1003 $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).
"))";
1005 if ($searchCategoryProductOperator == 1) {
1006 if (!empty($searchCategoryProductSqlList)) {
1007 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1010 if (!empty($searchCategoryProductSqlList)) {
1011 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1016include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1018$parameters = array();
1019$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
1020$sql .= $hookmanager->resPrint;
1023$nbtotalofrecords =
'';
1026 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1027 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1028 $resql = $db->query($sqlforcount);
1030 $objforcount = $db->fetch_object($resql);
1031 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1036 if (($page * $limit) > $nbtotalofrecords) {
1043$sql .= $db->order($sortfield, $sortorder);
1045 $sql .= $db->plimit($limit + 1, $offset);
1049$resql = $db->query($sql);
1051 $num = $db->num_rows($resql);
1053 $arrayofselected = is_array($toselect) ? $toselect : array();
1055 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1056 $obj = $db->fetch_object($resql);
1058 header(
"Location: ".DOL_URL_ROOT.
'/fourn/commande/card.php?id='.
$id);
1062 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-supplier-order page-list');
1065 if (!empty($mode)) {
1066 $param .=
'&mode='.urlencode($mode);
1068 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1069 $param .=
'&contextpage='.urlencode($contextpage);
1071 if ($limit > 0 && $limit !=
$conf->liste_limit) {
1072 $param .=
'&limit='.((int) $limit);
1075 $param .=
'&search_all='.urlencode($search_all);
1078 $param .=
'&socid='.urlencode((
string) ($socid));
1081 $param .=
"&search_all=".urlencode($search_all);
1083 if ($search_date_order_startday) {
1084 $param .=
'&search_date_order_startday='.urlencode((
string) ($search_date_order_startday));
1086 if ($search_date_order_startmonth) {
1087 $param .=
'&search_date_order_startmonth='.urlencode((
string) ($search_date_order_startmonth));
1089 if ($search_date_order_startyear) {
1090 $param .=
'&search_date_order_startyear='.urlencode((
string) ($search_date_order_startyear));
1092 if ($search_date_order_endday) {
1093 $param .=
'&search_date_order_endday='.urlencode((
string) ($search_date_order_endday));
1095 if ($search_date_order_endmonth) {
1096 $param .=
'&search_date_order_endmonth='.urlencode((
string) ($search_date_order_endmonth));
1098 if ($search_date_order_endyear) {
1099 $param .=
'&search_date_order_endyear='.urlencode((
string) ($search_date_order_endyear));
1101 if ($search_date_delivery_startday) {
1102 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
1104 if ($search_date_delivery_startmonth) {
1105 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
1107 if ($search_date_delivery_startyear) {
1108 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
1110 if ($search_date_delivery_endday) {
1111 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
1113 if ($search_date_delivery_endmonth) {
1114 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
1116 if ($search_date_delivery_endyear) {
1117 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
1119 if ($search_date_valid_startday) {
1120 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
1122 if ($search_date_valid_startmonth) {
1123 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
1125 if ($search_date_valid_startyear) {
1126 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
1128 if ($search_date_valid_endday) {
1129 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
1131 if ($search_date_valid_endmonth) {
1132 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
1134 if ($search_date_valid_endyear) {
1135 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
1137 if ($search_date_approve_startday) {
1138 $param .=
'&search_date_approve_startday='.urlencode((
string) ($search_date_approve_startday));
1140 if ($search_date_approve_startmonth) {
1141 $param .=
'&search_date_approve_startmonth='.urlencode((
string) ($search_date_approve_startmonth));
1143 if ($search_date_approve_startyear) {
1144 $param .=
'&search_date_approve_startyear='.urlencode((
string) ($search_date_approve_startyear));
1146 if ($search_date_approve_endday) {
1147 $param .=
'&search_date_approve_endday='.urlencode((
string) ($search_date_approve_endday));
1149 if ($search_date_approve_endmonth) {
1150 $param .=
'&search_date_approve_endmonth='.urlencode((
string) ($search_date_approve_endmonth));
1152 if ($search_date_approve_endyear) {
1153 $param .=
'&search_date_approve_endyear='.urlencode((
string) ($search_date_approve_endyear));
1156 $param .=
'&search_ref='.urlencode($search_ref);
1158 if ($search_company) {
1159 $param .=
'&search_company='.urlencode($search_company);
1161 if ($search_company_alias) {
1162 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1164 if ($search_user > 0) {
1165 $param .=
'&search_user='.urlencode((
string) ($search_user));
1167 if ($search_request_author) {
1168 $param .=
'&search_request_author='.urlencode($search_request_author);
1170 if ($search_sale > 0) {
1171 $param .=
'&search_sale='.urlencode($search_sale);
1173 if ($search_total_ht !=
'') {
1174 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1176 if ($search_total_ttc !=
'') {
1177 $param .=
"&search_total_ttc=".urlencode($search_total_ttc);
1179 if ($search_multicurrency_code !=
'') {
1180 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1182 if ($search_multicurrency_tx !=
'') {
1183 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1185 if ($search_multicurrency_montant_ht !=
'') {
1186 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1188 if ($search_multicurrency_montant_tva !=
'') {
1189 $param .=
'&search_multicurrency_montant_tva='.urlencode($search_multicurrency_montant_tva);
1191 if ($search_multicurrency_montant_ttc !=
'') {
1192 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1194 if ($search_refsupp) {
1195 $param .=
"&search_refsupp=".urlencode($search_refsupp);
1197 if ($search_status !=
'' && $search_status !=
'-1') {
1198 $param .=
"&search_status=".urlencode($search_status);
1200 if ($search_option) {
1201 $param .=
"&search_option=".urlencode($search_option);
1203 if ($search_project_ref >= 0) {
1204 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1206 if ($search_billed !=
'') {
1207 $param .=
"&search_billed=".urlencode($search_billed);
1210 $param .=
'&show_files='.urlencode((
string) ($show_files));
1212 if ($optioncss !=
'') {
1213 $param .=
'&optioncss='.urlencode($optioncss);
1215 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1216 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1220 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1222 $parameters = array(
'param' => &$param);
1223 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
1224 $param .= $hookmanager->resPrint;
1227 $arrayofmassactions = array(
1228 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1229 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1230 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1233 if ($permissiontovalidate) {
1234 if ($permissiontoapprove && !
getDolGlobalString(
'SUPPLIER_ORDER_NO_DIRECT_APPROVE')) {
1235 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove");
1237 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1241 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
"supplier_invoice",
"creer")) {
1242 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisSupplier");
1244 if ($permissiontodelete) {
1245 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1247 if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1248 $arrayofmassactions = array();
1250 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1252 $url = DOL_URL_ROOT.
'/fourn/commande/card.php?action=create';
1254 $url .=
'&socid='.((int) $socid);
1255 $url .=
'&backtopage='.urlencode(DOL_URL_ROOT.
'/fourn/commande/list.php?socid='.((
int) $socid));
1257 $newcardbutton =
'';
1258 $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'));
1259 $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'));
1261 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSupplierOrderShort'),
'',
'fa fa-plus-circle', $url,
'', (
int) $permissiontoadd);
1264 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1265 if ($optioncss !=
'') {
1266 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1268 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1269 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1270 print
'<input type="hidden" name="action" value="list">';
1271 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1272 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1273 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1274 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1275 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1277 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1279 $topicmail =
"SendOrderRef";
1280 $modelmail =
"order_supplier_send";
1282 $trackid =
'sord'.$object->id;
1283 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1285 if ($massaction ==
'prevalidate') {
1286 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1289 if ($massaction ==
'createbills') {
1291 print
'<input type="hidden" name="massaction" value="confirm_createsupplierbills">';
1293 print
'<table class="noborder centpercent">';
1295 print
'<td class="titlefield">';
1296 print $langs->trans(
'DateInvoice');
1299 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1304 print $langs->trans(
'CreateOneBillByThird');
1307 print $form->selectyesno(
'createbills_onebythird',
'', 1);
1312 print $langs->trans(
'ValidateInvoices');
1315 print $form->selectyesno(
'validate_invoices', 1, 1);
1320 print
'<div class="center">';
1321 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1322 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1329 foreach ($fieldstosearchall as $key => $val) {
1330 $fieldstosearchall[$key] = $langs->trans($val);
1332 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1335 $moreforfilter =
'';
1338 if ($user->hasRight(
"user",
"user",
"lire")) {
1339 $langs->load(
"commercial");
1340 $moreforfilter .=
'<div class="divsearchfield">';
1341 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1342 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1343 $moreforfilter .=
'</div>';
1346 if ($user->hasRight(
"user",
"user",
"lire")) {
1347 $moreforfilter .=
'<div class="divsearchfield">';
1348 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1349 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1350 $moreforfilter .=
'</div>';
1353 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1354 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1355 $moreforfilter .=
'<div class="divsearchfield">';
1356 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1357 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1358 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300 widthcentpercentminusx', 1);
1359 $moreforfilter .=
'</div>';
1362 $moreforfilter .=
'<div class="divsearchfield">';
1363 $moreforfilter .= $langs->trans(
'Alert').
' <input type="checkbox" name="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
1364 $moreforfilter .=
'</div>';
1365 $parameters = array();
1366 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1367 if (empty($reshook)) {
1368 $moreforfilter .= $hookmanager->resPrint;
1370 $moreforfilter = $hookmanager->resPrint;
1373 if (!empty($moreforfilter)) {
1374 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1375 print $moreforfilter;
1379 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1380 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1381 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1384 $selectedfields .=
'<script>';
1385 $selectedfields .=
' $(document).ready(function() {';
1386 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1387 $selectedfields .=
' $("#checkforselects").click();';
1388 $selectedfields .=
' $("#massaction").val("createbills").change();';
1389 $selectedfields .=
' });';
1390 $selectedfields .=
'</script>';
1393 print
'<div class="div-table-responsive">';
1394 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1396 print
'<tr class="liste_titre_filter">';
1399 print
'<td class="liste_titre middle">';
1400 $searchpicto = $form->showFilterButtons(
'left');
1405 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1406 print
'<td class="liste_titre"><input size="8" type="text" class="flat maxwidth75" name="search_ref" value="'.$search_ref.
'"></td>';
1409 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1410 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_refsupp" value="'.$search_refsupp.
'"></td>';
1413 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1414 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_project_ref" value="'.$search_project_ref.
'"></td>';
1417 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1418 print
'<td class="liste_titre">';
1419 print
'<input type="text" class="flat" size="6" name="search_request_author" value="'.$search_request_author.
'">';
1423 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1424 print
'<td class="liste_titre"><input type="text" size="6" class="flat" name="search_company" value="'.$search_company.
'"></td>';
1427 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1428 print
'<td class="liste_titre"><input type="text" size="6" class="flat" name="search_company_alias" value="'.$search_company_alias.
'"></td>';
1431 if (!empty($arrayfields[
's.town'][
'checked'])) {
1432 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1435 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1436 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1439 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1440 print
'<td class="liste_titre">';
1441 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1445 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1446 print
'<td class="liste_titre center">';
1447 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1451 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1452 print
'<td class="liste_titre maxwidthonsmartphone center">';
1453 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);
1457 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1458 print
'<td class="liste_titre center">';
1459 print
'<div class="nowrapfordate">';
1460 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'));
1462 print
'<div class="nowrapfordate">';
1463 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'));
1468 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1469 print
'<td class="liste_titre center">';
1470 print
'<div class="nowrapfordate">';
1471 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'));
1473 print
'<div class="nowrapfordate">';
1474 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'));
1478 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1480 print
'<td class="liste_titre right">';
1481 print
'<input class="flat" type="text" size="5" name="search_total_ht" value="'.$search_total_ht.
'">';
1484 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1486 print
'<td class="liste_titre right">';
1487 print
'<input class="flat" type="text" size="5" name="search_total_tva" value="'.$search_total_tva.
'">';
1490 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1492 print
'<td class="liste_titre right">';
1493 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1496 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
1498 print
'<td class="liste_titre">';
1499 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1502 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
1504 print
'<td class="liste_titre">';
1505 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1508 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
1510 print
'<td class="liste_titre right">';
1511 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1514 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
1516 print
'<td class="liste_titre right">';
1517 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_tva" value="'.dol_escape_htmltag($search_multicurrency_montant_tva).
'">';
1520 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
1522 print
'<td class="liste_titre right">';
1523 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1527 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1530 $parameters = array(
'arrayfields' => $arrayfields);
1531 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1532 print $hookmanager->resPrint;
1534 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
1535 print
'<td class="liste_titre">';
1539 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
1540 print
'<td class="liste_titre">';
1544 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
1545 print
'<td class="liste_titre center parentonrightofpage">';
1546 print $form->selectyesno(
'search_billed', $search_billed, 1,
false, 1, 1,
'search_status width100 onrightofpage');
1550 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
1551 print
'<td class="liste_titre center parentonrightofpage">';
1552 $formorder->selectSupplierOrderStatus($search_status, 1,
'search_status',
'search_status width125 onrightofpage');
1556 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
1557 print
'<td class="liste_titre center">';
1558 print
'<div class="nowrapfordate">';
1559 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'));
1561 print
'<div class="nowrapfordate">';
1562 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'));
1567 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
1568 print
'<td class="liste_titre center">';
1569 print
'<div class="nowrapfordate">';
1570 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'));
1572 print
'<div class="nowrapfordate">';
1573 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'));
1578 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
1579 print
'<td class="liste_titre">';
1583 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
1584 print
'<td class="liste_titre">';
1589 print
'<td class="liste_titre center">';
1590 $searchpicto = $form->showFilterButtons();
1597 $totalarray = array();
1598 $totalarray[
'nbfield'] = 0;
1601 print
'<tr class="liste_titre">';
1603 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1604 $totalarray[
'nbfield']++;
1606 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1607 print_liste_field_titre($arrayfields[
'cf.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.ref",
"", $param,
'', $sortfield, $sortorder);
1608 $totalarray[
'nbfield']++;
1610 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1611 print_liste_field_titre($arrayfields[
'cf.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.ref_supplier",
"", $param,
'', $sortfield, $sortorder,
'tdoverflowmax100imp ');
1612 $totalarray[
'nbfield']++;
1614 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1615 print_liste_field_titre($arrayfields[
'cf.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1616 $totalarray[
'nbfield']++;
1618 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1619 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
"u.login",
"", $param,
'', $sortfield, $sortorder);
1620 $totalarray[
'nbfield']++;
1622 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1623 print_liste_field_titre($arrayfields[
'cf.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
1624 $totalarray[
'nbfield']++;
1626 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1628 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
'', $sortfield, $sortorder);
1629 $totalarray[
'nbfield']++;
1631 if (!empty($arrayfields[
's.town'][
'checked'])) {
1632 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1633 $totalarray[
'nbfield']++;
1635 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1636 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1637 $totalarray[
'nbfield']++;
1639 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1640 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1641 $totalarray[
'nbfield']++;
1643 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1644 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1645 $totalarray[
'nbfield']++;
1647 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1648 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1649 $totalarray[
'nbfield']++;
1651 if (!empty($arrayfields[
'cf.fk_author'][
'checked'])) {
1652 print_liste_field_titre($arrayfields[
'cf.fk_author'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.fk_author",
"", $param,
'', $sortfield, $sortorder);
1653 $totalarray[
'nbfield']++;
1655 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1656 print_liste_field_titre($arrayfields[
'cf.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_commande",
"", $param,
'', $sortfield, $sortorder,
'center ');
1657 $totalarray[
'nbfield']++;
1659 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1660 print_liste_field_titre($arrayfields[
'cf.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1661 $totalarray[
'nbfield']++;
1663 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1664 print_liste_field_titre($arrayfields[
'cf.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
1665 $totalarray[
'nbfield']++;
1667 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1668 print_liste_field_titre($arrayfields[
'cf.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
1669 $totalarray[
'nbfield']++;
1671 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1672 print_liste_field_titre($arrayfields[
'cf.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
1673 $totalarray[
'nbfield']++;
1675 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
1676 print_liste_field_titre($arrayfields[
'cf.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1677 $totalarray[
'nbfield']++;
1679 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
1680 print_liste_field_titre($arrayfields[
'cf.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1681 $totalarray[
'nbfield']++;
1683 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
1684 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1685 $totalarray[
'nbfield']++;
1687 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
1688 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1689 $totalarray[
'nbfield']++;
1691 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
1692 print_liste_field_titre($arrayfields[
'cf.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'cf.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1693 $totalarray[
'nbfield']++;
1696 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1698 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1699 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1700 print $hookmanager->resPrint;
1701 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
1702 print_liste_field_titre($arrayfields[
'cf.date_creation'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1703 $totalarray[
'nbfield']++;
1705 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
1706 print_liste_field_titre($arrayfields[
'cf.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1707 $totalarray[
'nbfield']++;
1709 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
1710 print_liste_field_titre($arrayfields[
'cf.billed'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.billed',
'', $param,
'', $sortfield, $sortorder,
'center ');
1711 $totalarray[
'nbfield']++;
1713 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
1714 print_liste_field_titre($arrayfields[
'cf.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1715 $totalarray[
'nbfield']++;
1717 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
1718 print_liste_field_titre($arrayfields[
'cf.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
1719 $totalarray[
'nbfield']++;
1721 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
1722 print_liste_field_titre($arrayfields[
'cf.date_approve'][
'label'], $_SERVER[
"PHP_SELF"],
'cf.date_approve',
'', $param,
'', $sortfield, $sortorder,
'center ');
1723 $totalarray[
'nbfield']++;
1725 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
1726 print_liste_field_titre($arrayfields[
'cf.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.note_public",
"", $param,
'', $sortfield, $sortorder,
'center ');
1727 $totalarray[
'nbfield']++;
1729 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
1730 print_liste_field_titre($arrayfields[
'cf.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"cf.note_private",
"", $param,
'', $sortfield, $sortorder,
'center ');
1731 $totalarray[
'nbfield']++;
1734 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1735 $totalarray[
'nbfield']++;
1741 $productstat_cache = array();
1743 $userstatic =
new User($db);
1745 $projectstatic =
new Project($db);
1748 $savnbfield = $totalarray[
'nbfield'];
1749 $totalarray = array(
'nbfield' => 0,
'val' => array(),
'pos' => array());
1750 $totalarray[
'val'][
'cf.total_ht'] = 0;
1751 $totalarray[
'val'][
'cf.total_ttc'] = 0;
1752 $totalarray[
'val'][
'cf.total_tva'] = 0;
1754 $imaxinloop = ($limit ? min($num, $limit) : $num);
1755 while ($i < $imaxinloop) {
1756 $obj = $db->fetch_object($resql);
1764 $objectstatic->id = $obj->rowid;
1765 $objectstatic->ref = $obj->ref;
1766 $objectstatic->ref_supplier = $obj->ref_supplier;
1767 $objectstatic->socid = $obj->socid;
1768 $objectstatic->total_ht = $obj->total_ht;
1769 $objectstatic->total_tva = $obj->total_tva;
1770 $objectstatic->total_ttc = $obj->total_ttc;
1771 $objectstatic->date_commande = $db->jdate($obj->date_commande);
1772 $objectstatic->delivery_date = $db->jdate($obj->delivery_date);
1773 $objectstatic->note_public = $obj->note_public;
1774 $objectstatic->note_private = $obj->note_private;
1775 $objectstatic->statut = $obj->fk_statut;
1776 $objectstatic->status = $obj->fk_statut;
1778 if ($mode ==
'kanban') {
1780 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1781 print
'<div class="box-flex-container kanban">';
1784 $thirdpartytmp->id = $obj->socid;
1785 $thirdpartytmp->name = $obj->name;
1786 $thirdpartytmp->email = $obj->email;
1787 $thirdpartytmp->name_alias = $obj->alias;
1788 $thirdpartytmp->client = $obj->client;
1789 $thirdpartytmp->fournisseur = $obj->fournisseur;
1791 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $thirdpartytmp->getNomUrl(
'supplier', 0, 0, -1),
'selected' => in_array($objectstatic->id, $arrayofselected)));
1792 if ($i == ($imaxinloop - 1)) {
1797 print
'<tr class="oddeven '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->billed == 1) ?
'opacitymedium' :
'').
'">';
1800 print
'<td class="nowrap center">';
1801 if ($massactionbutton || $massaction) {
1803 if (in_array($obj->rowid, $arrayofselected)) {
1806 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1810 $totalarray[
'nbfield']++;
1814 if (!empty($arrayfields[
'cf.ref'][
'checked'])) {
1815 print
'<td class="nowrap">';
1818 print $objectstatic->getNomUrl(1,
'', 0, -1, 1);
1822 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1826 $totalarray[
'nbfield']++;
1830 if (!empty($arrayfields[
'cf.ref_supplier'][
'checked'])) {
1831 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">'.
dol_escape_htmltag($obj->ref_supplier).
'</td>'.
"\n";
1833 $totalarray[
'nbfield']++;
1837 if (!empty($arrayfields[
'cf.fk_projet'][
'checked'])) {
1838 $projectstatic->id = $obj->project_id;
1839 $projectstatic->ref = $obj->project_ref;
1840 $projectstatic->title = $obj->project_title;
1842 if ($obj->project_id > 0) {
1843 print $projectstatic->getNomUrl(1);
1847 $totalarray[
'nbfield']++;
1851 $userstatic->id = $obj->fk_user_author;
1852 $userstatic->lastname = $obj->lastname;
1853 $userstatic->firstname = $obj->firstname;
1854 $userstatic->login = $obj->login;
1855 $userstatic->photo = $obj->photo;
1856 $userstatic->email = $obj->user_email;
1857 $userstatic->status = $obj->user_status;
1858 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1859 print
'<td class="tdoverflowmax150">';
1860 if ($userstatic->id) {
1861 print $userstatic->getNomUrl(1);
1865 $totalarray[
'nbfield']++;
1869 if (!empty($arrayfields[
'cf.fk_soc'][
'checked'])) {
1870 print
'<td class="tdoverflowmax150">';
1871 $thirdpartytmp->id = $obj->socid;
1872 $thirdpartytmp->name = $obj->name;
1873 $thirdpartytmp->email = $obj->email;
1874 $thirdpartytmp->name_alias = $obj->alias;
1875 $thirdpartytmp->client = $obj->client;
1876 $thirdpartytmp->fournisseur = $obj->fournisseur;
1877 print $thirdpartytmp->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1880 $totalarray[
'nbfield']++;
1884 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1885 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->alias).
'">';
1889 $totalarray[
'nbfield']++;
1893 if (!empty($arrayfields[
's.town'][
'checked'])) {
1894 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1898 $totalarray[
'nbfield']++;
1902 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1903 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
1907 $totalarray[
'nbfield']++;
1911 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1912 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
1914 $totalarray[
'nbfield']++;
1918 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1919 print
'<td class="center">';
1920 $tmparray =
getCountry($obj->fk_pays,
'all');
1921 print $tmparray[
'label'];
1924 $totalarray[
'nbfield']++;
1928 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1929 print
'<td class="center">';
1930 if (empty($typenArray)) {
1931 $typenArray = $formcompany->typent_array(1);
1933 print $typenArray[$obj->typent_code];
1936 $totalarray[
'nbfield']++;
1941 if (!empty($arrayfields[
'cf.date_commande'][
'checked'])) {
1942 print
'<td class="center">';
1944 if ($objectstatic->statut != $objectstatic::STATUS_ORDERSENT && $objectstatic->statut != $objectstatic::STATUS_RECEIVED_PARTIALLY) {
1945 if ($objectstatic->hasDelay()) {
1946 print
' '.img_picto($langs->trans(
"Late").
' : '.$objectstatic->showDelay(),
"warning");
1951 $totalarray[
'nbfield']++;
1955 if (!empty($arrayfields[
'cf.date_livraison'][
'checked'])) {
1956 print
'<td class="center">';
1958 if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) {
1959 if ($objectstatic->hasDelay()) {
1960 print
' '.img_picto($langs->trans(
"Late").
' : '.$objectstatic->showDelay(),
"warning");
1965 $totalarray[
'nbfield']++;
1969 if (!empty($arrayfields[
'cf.total_ht'][
'checked'])) {
1970 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1972 $totalarray[
'nbfield']++;
1975 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cf.total_ht';
1977 $totalarray[
'val'][
'cf.total_ht'] += $obj->total_ht;
1980 if (!empty($arrayfields[
'cf.total_tva'][
'checked'])) {
1981 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1983 $totalarray[
'nbfield']++;
1986 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cf.total_tva';
1988 $totalarray[
'val'][
'cf.total_tva'] += $obj->total_tva;
1991 if (!empty($arrayfields[
'cf.total_ttc'][
'checked'])) {
1992 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1994 $totalarray[
'nbfield']++;
1997 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cf.total_ttc';
1999 $totalarray[
'val'][
'cf.total_ttc'] += $obj->total_ttc;
2003 if (!empty($arrayfields[
'cf.multicurrency_code'][
'checked'])) {
2004 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2006 $totalarray[
'nbfield']++;
2011 if (!empty($arrayfields[
'cf.multicurrency_tx'][
'checked'])) {
2012 print
'<td class="nowrap">';
2013 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2016 $totalarray[
'nbfield']++;
2020 if (!empty($arrayfields[
'cf.multicurrency_total_ht'][
'checked'])) {
2021 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2023 $totalarray[
'nbfield']++;
2027 if (!empty($arrayfields[
'cf.multicurrency_total_tva'][
'checked'])) {
2028 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2030 $totalarray[
'nbfield']++;
2034 if (!empty($arrayfields[
'cf.multicurrency_total_ttc'][
'checked'])) {
2035 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2037 $totalarray[
'nbfield']++;
2042 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2044 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2045 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
2046 print $hookmanager->resPrint;
2048 if (!empty($arrayfields[
'cf.date_creation'][
'checked'])) {
2049 print
'<td class="center nowraponall">';
2050 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2053 $totalarray[
'nbfield']++;
2057 if (!empty($arrayfields[
'cf.tms'][
'checked'])) {
2058 print
'<td class="center nowraponall">';
2059 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2062 $totalarray[
'nbfield']++;
2066 if (!empty($arrayfields[
'cf.billed'][
'checked'])) {
2067 print
'<td class="center">';
2069 print
yn($obj->billed, $langs->trans(
"Billed"));
2073 $totalarray[
'nbfield']++;
2077 if (!empty($arrayfields[
'cf.fk_statut'][
'checked'])) {
2078 print
'<td class="center nowrap">'.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).
'</td>';
2080 $totalarray[
'nbfield']++;
2085 if (!empty($arrayfields[
'cf.date_valid'][
'checked'])) {
2086 print
'<td class="center">';
2090 $totalarray[
'nbfield']++;
2094 if (!empty($arrayfields[
'cf.date_approve'][
'checked'])) {
2095 print
'<td class="center">';
2099 $totalarray[
'nbfield']++;
2103 if (!empty($arrayfields[
'cf.note_public'][
'checked'])) {
2104 print
'<td class="sensiblehtmlcontent center">';
2108 $totalarray[
'nbfield']++;
2113 if (!empty($arrayfields[
'cf.note_private'][
'checked'])) {
2114 print
'<td class="sensiblehtmlcontent center">';
2118 $totalarray[
'nbfield']++;
2124 print
'<td class="nowrap center">';
2125 if ($massactionbutton || $massaction) {
2127 if (in_array($obj->rowid, $arrayofselected)) {
2130 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2134 $totalarray[
'nbfield']++;
2140 $total += $obj->total_ht;
2141 $subtotal += $obj->total_ht;
2147 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2152 foreach ($arrayfields as $key => $val) {
2153 if (!empty($val[
'checked'])) {
2157 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2162 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2163 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2164 print $hookmanager->resPrint;
2166 print
'</table>'.
"\n";
2169 print
'</form>'.
"\n";
2171 $hidegeneratedfilelistifempty = 1;
2172 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2173 $hidegeneratedfilelistifempty = 0;
2177 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2178 $urlsource .= str_replace(
'&',
'&', $param);
2180 $filedir = $diroutputmassaction;
2181 $genallowed = $permissiontoread;
2182 $delallowed = $permissiontoadd;
2184 print $formfile->showdocuments(
'massfilesarea_supplier_order',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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_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_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.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
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_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.