43require
'../main.inc.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.
'/core/class/discount.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50if (isModEnabled(
'margin')) {
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
67$langs->loadLangs(array(
'orders',
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
70$action =
GETPOST(
'action',
'aZ09');
71$massaction =
GETPOST(
'massaction',
'alpha');
73$confirm =
GETPOST(
'confirm',
'alpha');
74$toselect =
GETPOST(
'toselect',
'array');
75$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlist';
76$optioncss =
GETPOST(
'optioncss',
'alpha');
77$mode =
GETPOST(
'mode',
'alpha');
80 $userschilds = $user->getAllChildIds();
82 $userschilds = array();
86$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
87if (empty($search_datecloture_start)) {
90$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
91if (empty($search_datecloture_end)) {
101$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
102$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
103$search_id =
GETPOST(
'search_id',
'int');
104$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
105$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
106$search_company =
GETPOST(
'search_company',
'alpha');
107$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
108$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
109$search_town =
GETPOST(
'search_town',
'alpha');
110$search_zip =
GETPOST(
'search_zip',
'alpha');
111$search_state =
GETPOST(
'search_state',
'alpha');
112$search_country =
GETPOST(
'search_country',
'aZ09');
113$search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'intcomma');
114$search_user =
GETPOST(
'search_user',
'intcomma');
115$search_sale =
GETPOST(
'search_sale',
'intcomma');
116$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
117$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
118$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
119$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
121$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
122$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
123$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
124$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
125$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
127$search_login =
GETPOST(
'search_login',
'alpha');
128$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
129$search_billed =
GETPOST(
'search_billed',
'intcomma');
130$search_status =
GETPOST(
'search_status',
'intcomma');
131$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
132$search_project =
GETPOST(
'search_project',
'alpha');
133$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
135$search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'intcomma');
136$search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'intcomma');
137$search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'intcomma');
138$search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'intcomma');
140$search_option =
GETPOST(
'search_option',
'alpha');
141if ($search_option ==
'late') {
142 $search_status =
'-2';
144$search_orderday =
'';
145$search_ordermonth =
'';
146$search_orderyear =
'';
147$search_deliveryday =
'';
148$search_deliverymonth =
'';
149$search_deliveryyear =
'';
151$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
153$diroutputmassaction =
$conf->commande->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
157$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
158$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
160if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
164$offset = $limit * $page;
165$pageprev = $page - 1;
166$pagenext = $page + 1;
168 $sortfield =
'c.ref';
174$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
178$hookmanager->initHooks(array(
'orderlist'));
182$extrafields->fetch_name_optionals_label(
$object->table_element);
183$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
186$fieldstosearchall = array(
188 'c.ref_client' =>
'RefCustomerOrder',
189 'pd.description' =>
'Description',
190 's.nom' =>
"ThirdParty",
191 's.name_alias' =>
"AliasNameShort",
194 'c.note_public' =>
'NotePublic',
196if (empty($user->socid)) {
197 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
200$checkedtypetiers = 0;
202 'c.rowid' => array(
'label' =>
"ID",
'checked' => 1,
'enabled' =>
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 1),
203 'c.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5,
'searchall' => 1),
204 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' => -1,
'position' => 10,
'searchall' => 1),
205 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => -1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 20),
206 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 25),
207 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 30,
'searchall' => 1),
208 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 31,
'searchall' => 1),
209 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
210 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 35,
'searchall' => 1),
211 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 40,
'searchall' => 1),
212 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 45),
213 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 50),
214 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 55),
215 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' => 1,
'position' => 60,
'csslist' =>
'nowraponall'),
216 'c.date_delivery' => array(
'label' =>
"DateDeliveryPlanned",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65,
'csslist' =>
'nowraponall'),
217 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => -1,
'position' => 66 ,
'enabled' => isModEnabled(
"shipping")),
218 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => -1,
'position' => 67),
219 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => -1,
'position' => 68),
220 'c.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => -1,
'position' => 69),
221 'c.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 75),
222 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 80),
223 'c.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 85),
224 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 90),
225 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 95),
226 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 100),
227 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 105),
228 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 110),
229 'u.login' => array(
'label' =>
"Author",
'checked' => -1,
'position' => 115),
230 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 116),
231 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
232 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
233 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
234 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
235 'c.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 120),
236 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 125),
237 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 130),
238 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 135,
'searchall' => 1),
239 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 140),
240 'shippable' => array(
'label' =>
"Shippable",
'checked' => 1,
'enabled' => (isModEnabled(
"shipping")),
'position' => 990),
241 'c.facture' => array(
'label' =>
"Billed",
'checked' => 1,
'enabled' => (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
242 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
243 'c.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000)
246$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
247$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
249 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
250} elseif ($reshook == 0) {
251 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
255include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
260'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
266 $socid = $user->socid;
269$permissiontoreadallthirdparty = $user->hasRight(
'societe',
'client',
'voir');
270$permissiontoread =
false;
271$permissiontovalidate =
false;
272$permissiontoclose =
false;
273$permissiontocancel =
false;
274$permissiontosendbymail =
false;
287if (
GETPOST(
'cancel',
'alpha')) {
291if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
295$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
296$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
301if (empty($reshook)) {
303 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
306 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
309 $search_product_category =
'';
312 $search_ref_customer =
'';
313 $search_company =
'';
314 $search_company_alias =
'';
315 $search_parent_name =
'';
320 $search_country =
'';
321 $search_type_thirdparty =
'';
322 $search_total_ht =
'';
323 $search_total_vat =
'';
324 $search_total_ttc =
'';
325 $search_warehouse =
'';
326 $search_multicurrency_code =
'';
327 $search_multicurrency_tx =
'';
328 $search_multicurrency_montant_ht =
'';
329 $search_multicurrency_montant_vat =
'';
330 $search_multicurrency_montant_ttc =
'';
332 $search_dateorder_start =
'';
333 $search_dateorder_end =
'';
334 $search_datedelivery_start =
'';
335 $search_datedelivery_end =
'';
336 $search_project_ref =
'';
337 $search_project =
'';
340 $search_datecloture_start =
'';
341 $search_datecloture_end =
'';
342 $search_fk_cond_reglement =
'';
343 $search_fk_shipping_method =
'';
344 $search_fk_mode_reglement =
'';
345 $search_fk_input_reason =
'';
347 $search_import_key =
'';
348 $search_categ_cus = 0;
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 =
'Commande';
361 $objectlabel =
'Orders';
362 $permissiontoread = $user->hasRight(
"commande",
"lire");
363 $permissiontoadd = $user->hasRight(
"commande",
"creer");
364 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
366 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
367 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
368 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
369 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
371 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
372 $permissiontoclose = $user->hasRight(
"commande",
"creer");
373 $permissiontocancel = $user->hasRight(
"commande",
"creer");
374 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
376 $uploaddir =
$conf->commande->multidir_output[
$conf->entity];
377 $triggersendname =
'ORDER_SENTBYMAIL';
380 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
382 if ($massaction ==
'confirm_createbills') {
383 $orders =
GETPOST(
'toselect',
'array');
384 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
385 $validate_invoices =
GETPOSTINT(
'validate_invoices');
390 $TFactThird = array();
391 $TFactThirdNbLines = array();
393 $nb_bills_created = 0;
399 $nbOrders = is_array($orders) ? count($orders) : 1;
402 foreach ($orders as $id_order) {
404 if ($cmd->fetch($id_order) <= 0) {
407 $cmd->fetch_thirdparty();
410 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
413 $objecttmp = $TFactThird[$cmd->socid];
416 $objecttmp->socid = $cmd->socid;
417 $objecttmp->thirdparty = $cmd->thirdparty;
419 $objecttmp->type = $objecttmp::TYPE_STANDARD;
420 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
421 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
423 $objecttmp->fk_project = $cmd->fk_project;
424 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
425 if (empty($createbills_onebythird)) {
426 $objecttmp->ref_client = $cmd->ref_client;
429 if (empty($objecttmp->note_public)) {
430 $objecttmp->note_public = $langs->transnoentities(
"Orders");
434 if (empty($datefacture)) {
438 $objecttmp->date = $datefacture;
439 $objecttmp->origin =
'commande';
440 $objecttmp->origin_id = $id_order;
442 $objecttmp->array_options = $cmd->array_options;
444 $res = $objecttmp->create($user);
448 $lastref = $objecttmp->ref;
449 $lastid = $objecttmp->id;
451 $TFactThird[$cmd->socid] = $objecttmp;
452 $TFactThirdNbLines[$cmd->socid] = 0;
454 $langs->load(
"errors");
455 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
460 if ($objecttmp->id > 0) {
461 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
464 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
469 $lines = $cmd->lines;
470 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
472 $lines = $cmd->lines;
476 $num = count($lines);
477 $array_options = array();
479 for ($i = 0; $i < $num; $i++) {
480 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
482 if (!empty($createbills_onebythird)) {
486 if ($lines[$i]->subprice < 0 && !
getDolGlobalString(
'INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
489 $discount->fk_soc = $objecttmp->socid;
490 $discount->socid = $objecttmp->socid;
491 $discount->amount_ht = abs($lines[$i]->total_ht);
492 $discount->amount_tva = abs($lines[$i]->total_tva);
493 $discount->amount_ttc = abs($lines[$i]->total_ttc);
494 $discount->tva_tx = $lines[$i]->tva_tx;
495 $discount->fk_user = $user->id;
496 $discount->description = $desc;
497 $discountid = $discount->create($user);
498 if ($discountid > 0) {
499 $result = $objecttmp->insert_discount($discountid);
508 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
511 if ($lines[$i]->date_debut_prevue) {
512 $date_start = $lines[$i]->date_debut_prevue;
514 if ($lines[$i]->date_debut_reel) {
515 $date_start = $lines[$i]->date_debut_reel;
517 if ($lines[$i]->date_start) {
518 $date_start = $lines[$i]->date_start;
522 if ($lines[$i]->date_fin_prevue) {
523 $date_end = $lines[$i]->date_fin_prevue;
525 if ($lines[$i]->date_fin_reel) {
526 $date_end = $lines[$i]->date_fin_reel;
528 if ($lines[$i]->date_end) {
529 $date_end = $lines[$i]->date_end;
532 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
537 if (method_exists($lines[$i],
'fetch_optionals')) {
538 $lines[$i]->fetch_optionals();
539 $array_options = $lines[$i]->array_options;
542 $objecttmp->context[
'createfromclone'] =
'createfromclone';
544 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
546 if (!empty($createbills_onebythird)) {
547 $TFactThirdNbLines[$cmd->socid]++;
548 $rang = $TFactThirdNbLines[$cmd->socid];
551 $result = $objecttmp->addline(
553 $lines[$i]->subprice,
556 $lines[$i]->localtax1_tx,
557 $lines[$i]->localtax2_tx,
558 $lines[$i]->fk_product,
559 $lines[$i]->remise_percent,
563 $lines[$i]->info_bits,
564 $lines[$i]->fk_remise_except,
569 $lines[$i]->special_code,
573 $lines[$i]->fk_fournprice,
586 $errors[] = $objecttmp->error;
590 if ($result > 0 && $lines[$i]->product_type == 9) {
591 $fk_parent_line = $result;
599 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_client) ?
'' :
' ('.$cmd->ref_client.
')'));
600 $objecttmp->update($user);
605 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
606 $TFactThird[$cmd->socid] = $objecttmp;
608 $TFact[$objecttmp->id] = $objecttmp;
613 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
616 if (!$error && $validate_invoices) {
617 $massaction = $action =
'builddoc';
619 foreach ($TAllFact as &$objecttmp) {
620 $result = $objecttmp->validate($user);
627 $id = $objecttmp->id;
631 $upload_dir =
$conf->facture->dir_output;
632 $permissiontoadd = $user->hasRight(
'facture',
'creer');
637 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
641 $massaction = $action =
'confirm_createbills';
647 if ($nb_bills_created == 1) {
648 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_ONE') == 1) {
650 header(
'Location: '.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) $lastid));
653 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
654 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
657 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_MANY') == 1) {
659 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills');
662 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
668 $param .=
'&mode='.urlencode($mode);
670 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
671 $param .=
'&contextpage='.urlencode($contextpage);
673 if ($limit > 0 && $limit !=
$conf->liste_limit) {
674 $param .=
'&limit='.((int) $limit);
676 if ($optioncss !=
'') {
677 $param .=
'&optioncss='.urlencode($optioncss);
680 $param .=
'&search_all='.urlencode($search_all);
683 $param .=
'&show_files='.urlencode((
string) ($show_files));
686 $param .=
'&socid='.urlencode((
string) ($socid));
688 if ($search_status !=
'') {
689 $param .=
'&search_status='.urlencode($search_status);
691 if ($search_option) {
692 $param .=
"&search_option=".urlencode($search_option);
694 if ($search_orderday) {
695 $param .=
'&search_orderday='.urlencode($search_orderday);
697 if ($search_ordermonth) {
698 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
700 if ($search_orderyear) {
701 $param .=
'&search_orderyear='.urlencode($search_orderyear);
703 if ($search_deliveryday) {
704 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
706 if ($search_deliverymonth) {
707 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
709 if ($search_deliveryyear) {
710 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
713 $param .=
'&search_id='.urlencode((
string) $search_id);
716 $param .=
'&search_ref='.urlencode($search_ref);
718 if ($search_company) {
719 $param .=
'&search_company='.urlencode($search_company);
721 if ($search_ref_customer) {
722 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
724 if ($search_user > 0) {
725 $param .=
'&search_user='.urlencode((
string) ($search_user));
727 if ($search_sale > 0) {
728 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
730 if ($search_total_ht !=
'') {
731 $param .=
'&search_total_ht='.urlencode($search_total_ht);
733 if ($search_total_vat !=
'') {
734 $param .=
'&search_total_vat='.urlencode($search_total_vat);
736 if ($search_total_ttc !=
'') {
737 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
739 if ($search_project_ref >= 0) {
740 $param .=
"&search_project_ref=".urlencode($search_project_ref);
742 if ($search_billed !=
'') {
743 $param .=
'&search_billed='.urlencode($search_billed);
746 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
752 $_GET[
"origin"] = $_POST[
"origin"];
753 $_GET[
"originid"] = $_POST[
"originid"];
754 if (!empty($errors)) {
763if ($action ==
'validate' && $permissiontoadd && $objectclass !==
null) {
764 if (
GETPOST(
'confirm') ==
'yes') {
765 $objecttmp =
new $objectclass($db);
768 foreach ($toselect as $checked) {
769 if ($objecttmp->fetch($checked)) {
770 if ($objecttmp->statut == 0) {
771 if (!empty($objecttmp->fk_warehouse)) {
772 $idwarehouse = $objecttmp->fk_warehouse;
776 if ($objecttmp->valid($user, $idwarehouse)) {
777 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
783 $langs->load(
"errors");
784 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
799if ($action ==
'shipped' && $permissiontoadd && $objectclass !==
null) {
800 if (
GETPOST(
'confirm') ==
'yes') {
801 $objecttmp =
new $objectclass($db);
804 foreach ($toselect as $checked) {
805 if ($objecttmp->fetch($checked)) {
806 if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
807 if ($objecttmp->cloture($user)) {
808 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
810 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
814 $langs->load(
"errors");
815 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
832if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
835 $objecttmp =
new $objectclass($db);
837 foreach ($toselect as $toselectid) {
838 $result = $objecttmp->fetch($toselectid);
840 $result = $objecttmp->classifyBilled($user, 0);
868$form =
new Form($db);
872if (isModEnabled(
'margin')) {
875$companystatic =
new Societe($db);
876$company_url_list = array();
878$projectstatic =
new Project($db);
882$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
883$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
885$title = $langs->trans(
"Orders");
886$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
892 $sql =
'SELECT DISTINCT';
894$sql .=
' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,';
895$sql .=
" s.parent as fk_parent,";
896$sql .=
" s2.nom as name2,";
897$sql .=
" typent.code as typent_code,";
898$sql .=
" state.code_departement as state_code, state.nom as state_name,";
899$sql .=
" country.code as country_code,";
900$sql .=
' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
901$sql .=
' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
902$sql .=
' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
903$sql .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
904$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
905$sql .=
' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
906$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
907$sql .=
' c.fk_input_reason, c.import_key';
910if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
911 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
912 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
917$parameters = array();
918$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
919$sql .= $hookmanager->resPrint;
920$sql = preg_replace(
'/,\s*$/',
'', $sql);
924$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
925$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
926$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
927$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
928$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
929$sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
930if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
931 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
934 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
936$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
937$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
939$parameters = array();
940$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
941$sql .= $hookmanager->resPrint;
943$sql .=
' WHERE c.fk_soc = s.rowid';
944$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
946 $sql .=
' AND s.rowid = '.((int) $socid);
950if (!$permissiontoreadallthirdparty) {
951 $sql .=
" AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $user->id).
")";
953 $sql .=
" OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user IN (".$db->sanitize(implode(
',', $userschilds)).
"))";
964if ($search_ref_customer) {
968 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
970if ($search_billed !=
'' && $search_billed >= 0) {
971 $sql .=
' AND c.facture = '.((int) $search_billed);
973if ($search_status !=
'') {
974 if ($search_status <= 3 && $search_status >= -1) {
975 if ($search_status == 1 && !isModEnabled(
'shipping')) {
976 $sql .=
' AND c.fk_statut IN (1,2)';
978 $sql .=
' AND c.fk_statut = '.((int) $search_status);
981 if ($search_status == -2) {
983 $sql .=
" AND (c.fk_statut IN (1,2))";
985 if ($search_status == -3) {
988 $sql .=
' AND (c.fk_statut IN (1,2,3))';
991if ($search_option ==
'late') {
992 $sql .=
" AND c.date_commande < '".$db->idate(
dol_now() -
$conf->commande->client->warning_delay).
"'";
994if ($search_datecloture_start) {
995 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
997if ($search_datecloture_end) {
998 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
1000if ($search_dateorder_start) {
1001 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
1003if ($search_dateorder_end) {
1004 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
1006if ($search_datedelivery_start) {
1007 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
1009if ($search_datedelivery_end) {
1010 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
1021if ($search_country) {
1022 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
1024if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1025 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
1027if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
1028 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
1030 if ($search_company) {
1033 if ($search_company_alias) {
1037if ($search_parent_name) {
1040if ($search_total_ht !=
'') {
1043if ($search_total_vat !=
'') {
1046if ($search_total_ttc !=
'') {
1049if ($search_warehouse !=
'' && $search_warehouse > 0) {
1052if ($search_multicurrency_code !=
'') {
1053 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
1055if ($search_multicurrency_tx !=
'') {
1056 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
1058if ($search_multicurrency_montant_ht !=
'') {
1059 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
1061if ($search_multicurrency_montant_vat !=
'') {
1062 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
1064if ($search_multicurrency_montant_ttc !=
'') {
1065 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1068 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
1070if ($search_project_ref !=
'') {
1073if ($search_project !=
'') {
1076if ($search_fk_cond_reglement > 0) {
1077 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1079if ($search_fk_shipping_method > 0) {
1080 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1082if ($search_fk_mode_reglement > 0) {
1083 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1085if ($search_fk_input_reason > 0) {
1086 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1088if ($search_import_key) {
1092if ($search_user > 0) {
1093 $sql .=
" AND EXISTS (";
1094 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1095 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1096 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1097 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal'";
1098 $sql .=
" WHERE ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1101if ($search_sale && $search_sale !=
'-1') {
1102 if ($search_sale == -2) {
1103 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
1104 } elseif ($search_sale > 0) {
1105 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
1109$searchCategoryCustomerOperator = -1;
1110$searchCategoryCustomerList = array($search_categ_cus);
1111if (!empty($searchCategoryCustomerList)) {
1112 $searchCategoryCustomerSqlList = array();
1113 $listofcategoryid =
'';
1114 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1115 if (intval($searchCategoryCustomer) == -2) {
1116 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
1117 } elseif (intval($searchCategoryCustomer) > 0) {
1118 if ($searchCategoryCustomerOperator == 0) {
1119 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).
")";
1121 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1125 if ($listofcategoryid) {
1126 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
1128 if ($searchCategoryCustomerOperator == 1) {
1129 if (!empty($searchCategoryCustomerSqlList)) {
1130 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1133 if (!empty($searchCategoryCustomerSqlList)) {
1134 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1139$searchCategoryProductOperator = -1;
1140$searchCategoryProductList = array($search_product_category);
1141if (!empty($searchCategoryProductList)) {
1142 $searchCategoryProductSqlList = array();
1143 $listofcategoryid =
'';
1144 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1145 if (intval($searchCategoryProduct) == -2) {
1146 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product)";
1147 } elseif (intval($searchCategoryProduct) > 0) {
1148 if ($searchCategoryProductOperator == 0) {
1149 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
1151 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1155 if ($listofcategoryid) {
1156 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
1158 if ($searchCategoryProductOperator == 1) {
1159 if (!empty($searchCategoryProductSqlList)) {
1160 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1163 if (!empty($searchCategoryProductSqlList)) {
1164 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1169include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1171$parameters = array();
1172$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1173$sql .= $hookmanager->resPrint;
1176$parameters = array();
1177$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1178$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1182$nbtotalofrecords =
'';
1185 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1186 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1187 $resql = $db->query($sqlforcount);
1189 $objforcount = $db->fetch_object($resql);
1190 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1195 if (($page * $limit) > $nbtotalofrecords) {
1202$sql .= $db->order($sortfield, $sortorder);
1204 $sql .= $db->plimit($limit + 1, $offset);
1208$resql = $db->query($sql);
1216 $soc->fetch($socid);
1217 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1218 if (empty($search_company)) {
1219 $search_company = $soc->name;
1222 $title = $langs->trans(
'CustomersOrders');
1224if (strval($search_status) ==
'0') {
1225 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1227if ($search_status == 1) {
1228 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1230if ($search_status == 2) {
1231 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1233if ($search_status == 3) {
1234 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1236if ($search_status == -1) {
1237 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1239if ($search_status == -2) {
1240 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1242if ($search_status == -3) {
1243 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1245if ($search_status == -4) {
1246 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1249$num = $db->num_rows($resql);
1251$arrayofselected = is_array($toselect) ? $toselect : array();
1253if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1254 $obj = $db->fetch_object($resql);
1256 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.
$id);
1263llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-order page-list');
1265$arrayofselected = is_array($toselect) ? $toselect : array();
1269 $param .=
'&mode='.urlencode($mode);
1271if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1272 $param .=
'&contextpage='.urlencode($contextpage);
1274if ($limit > 0 && $limit !=
$conf->liste_limit) {
1275 $param .=
'&limit='.((int) $limit);
1277if ($optioncss !=
'') {
1278 $param .=
'&optioncss='.urlencode($optioncss);
1281 $param .=
'&show_files='.urlencode((
string) ($show_files));
1284 $param .=
'&search_all='.urlencode($search_all);
1287 $param .=
'&socid='.((int) $socid);
1289if ($search_status !=
'') {
1290 $param .=
'&search_status='.urlencode($search_status);
1292if ($search_option) {
1293 $param .=
"&search_option=".urlencode($search_option);
1295if ($search_datecloture_start) {
1296 $param .=
'&search_datecloture_startday='.dol_print_date($search_datecloture_start,
'%d').
'&search_datecloture_startmonth='.
dol_print_date($search_datecloture_start,
'%m').
'&search_datecloture_startyear='.
dol_print_date($search_datecloture_start,
'%Y');
1298if ($search_datecloture_end) {
1299 $param .=
'&search_datecloture_endday='.dol_print_date($search_datecloture_end,
'%d').
'&search_datecloture_endmonth='.
dol_print_date($search_datecloture_end,
'%m').
'&search_datecloture_endyear='.
dol_print_date($search_datecloture_end,
'%Y');
1301if ($search_dateorder_start) {
1302 $param .=
'&search_dateorder_start_day='.dol_print_date($search_dateorder_start,
'%d').
'&search_dateorder_start_month='.
dol_print_date($search_dateorder_start,
'%m').
'&search_dateorder_start_year='.
dol_print_date($search_dateorder_start,
'%Y');
1304if ($search_dateorder_end) {
1305 $param .=
'&search_dateorder_end_day='.dol_print_date($search_dateorder_end,
'%d').
'&search_dateorder_end_month='.
dol_print_date($search_dateorder_end,
'%m').
'&search_dateorder_end_year='.
dol_print_date($search_dateorder_end,
'%Y');
1307if ($search_datedelivery_start) {
1308 $param .=
'&search_datedelivery_start_day='.dol_print_date($search_datedelivery_start,
'%d').
'&search_datedelivery_start_month='.
dol_print_date($search_datedelivery_start,
'%m').
'&search_datedelivery_start_year='.
dol_print_date($search_datedelivery_start,
'%Y');
1310if ($search_datedelivery_end) {
1311 $param .=
'&search_datedelivery_end_day='.dol_print_date($search_datedelivery_end,
'%d').
'&search_datedelivery_end_month='.
dol_print_date($search_datedelivery_end,
'%m').
'&search_datedelivery_end_year='.
dol_print_date($search_datedelivery_end,
'%Y');
1314 $param .=
'&search_id='.urlencode((
string) $search_id);
1317 $param .=
'&search_ref='.urlencode($search_ref);
1319if ($search_company) {
1320 $param .=
'&search_company='.urlencode($search_company);
1322if ($search_company_alias) {
1323 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1325if ($search_parent_name !=
'') {
1326 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1328if ($search_ref_customer) {
1329 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1331if ($search_user > 0) {
1332 $param .=
'&search_user='.urlencode((
string) ($search_user));
1334if ($search_sale > 0) {
1335 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1337if ($search_total_ht !=
'') {
1338 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1340if ($search_total_vat !=
'') {
1341 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1343if ($search_total_ttc !=
'') {
1344 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1346if ($search_warehouse !=
'') {
1347 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
1350 $param .=
'&search_login='.urlencode($search_login);
1352if ($search_multicurrency_code !=
'') {
1353 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1355if ($search_multicurrency_tx !=
'') {
1356 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1358if ($search_multicurrency_montant_ht !=
'') {
1359 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1361if ($search_multicurrency_montant_vat !=
'') {
1362 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1364if ($search_multicurrency_montant_ttc !=
'') {
1365 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1367if ($search_project_ref >= 0) {
1368 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1370if ($search_town !=
'') {
1371 $param .=
'&search_town='.urlencode($search_town);
1373if ($search_zip !=
'') {
1374 $param .=
'&search_zip='.urlencode($search_zip);
1376if ($search_state !=
'') {
1377 $param .=
'&search_state='.urlencode($search_state);
1379if ($search_country !=
'') {
1380 $param .=
'&search_country='.urlencode((
string) ($search_country));
1382if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1383 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1385if ($search_product_category !=
'') {
1386 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1388if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1389 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1391if ($search_billed !=
'') {
1392 $param .=
'&search_billed='.urlencode($search_billed);
1394if ($search_fk_cond_reglement > 0) {
1395 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1397if ($search_fk_shipping_method > 0) {
1398 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1400if ($search_fk_mode_reglement > 0) {
1401 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1403if ($search_fk_input_reason > 0) {
1404 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1406if ($search_import_key !=
'') {
1407 $param .=
'&search_import_key='.urlencode($search_import_key);
1411include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1414$parameters = array();
1415$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1416$param .= $hookmanager->resPrint;
1419$arrayofmassactions = array(
1420 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1421 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1423if ($permissiontovalidate) {
1424 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1426if ($permissiontoclose) {
1427 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1429if (isModEnabled(
'invoice') && $user->hasRight(
"facture",
"creer")) {
1430 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1432if ($permissiontoclose) {
1433 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1435if ($permissiontocancel) {
1436 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"CancelOrder");
1438if (!empty($permissiontodelete)) {
1439 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1441if ($permissiontosendbymail) {
1442 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1444if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1445 $arrayofmassactions = array();
1447$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1449$url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1450if (!empty($socid)) {
1451 $url .=
'&socid='.$socid;
1454$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'));
1455$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'));
1457$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', (
int) (($contextpage ==
'orderlist' || $contextpage ==
'billableorders') && $permissiontoadd));
1460print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1461if ($optioncss !=
'') {
1462 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1464print
'<input type="hidden" name="token" value="'.newToken().
'">';
1465print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1466print
'<input type="hidden" name="action" value="list">';
1467print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1468print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1469print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1470print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1471print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1472print
'<input type="hidden" name="page_y" value="">';
1473print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1476print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1478$topicmail =
"SendOrderRef";
1479$modelmail =
"order_send";
1481$trackid =
'ord'.$object->id;
1482include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1484if ($massaction ==
'prevalidate') {
1485 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1487if ($massaction ==
'preshipped') {
1488 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1491if ($massaction ==
'createbills') {
1492 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1494 print
'<table class="noborder centpercent">';
1497 print $langs->trans(
'DateInvoice');
1500 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1505 print $langs->trans(
'CreateOneBillByThird');
1508 print $form->selectyesno(
'createbills_onebythird',
getDolGlobalString(
'MAIN_ORDERLIST_CREATEBILLS_ONEBYTHIRD',
'no'), 1);
1513 print $langs->trans(
'ValidateInvoices');
1517 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
1518 $langs->load(
"errors");
1519 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1521 print $form->selectyesno(
'validate_invoices', 0, 1);
1523 if (!empty(
$conf->workflow->enabled) &&
getDolGlobalString(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1524 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1526 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1532 print
'<div class="center">';
1533 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1534 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1541 foreach ($fieldstosearchall as $key => $val) {
1542 $fieldstosearchall[$key] = $langs->trans($val);
1543 $setupstring .= $key.
"=".$val.
";";
1545 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1546 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1552if ($user->hasRight(
"user",
"user",
"lire")) {
1553 $langs->load(
"commercial");
1554 $moreforfilter .=
'<div class="divsearchfield">';
1555 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1556 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1557 $moreforfilter .=
'</div>';
1560if ($user->hasRight(
"user",
"user",
"lire")) {
1561 $moreforfilter .=
'<div class="divsearchfield">';
1562 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1563 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1564 $moreforfilter .=
'</div>';
1568if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1569 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1570 $moreforfilter .=
'<div class="divsearchfield">';
1571 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1572 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, array(), 1);
1573 $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);
1574 $moreforfilter .=
'</div>';
1577if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1578 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1579 $moreforfilter .=
'<div class="divsearchfield">';
1580 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1581 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1582 $moreforfilter .=
'</div>';
1585if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
1586 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1588 $moreforfilter .=
'<div class="divsearchfield">';
1589 $tmptitle = $langs->trans(
'Warehouse');
1590 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1591 $moreforfilter .=
'</div>';
1594$parameters = array();
1595$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1596if (empty($reshook)) {
1597 $moreforfilter .= $hookmanager->resPrint;
1599 $moreforfilter = $hookmanager->resPrint;
1602if (!empty($moreforfilter)) {
1603 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1604 print $moreforfilter;
1608$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1609$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1610$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1611$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1614 $selectedfields .=
'<script>';
1615 $selectedfields .=
' $(document).ready(function() {';
1616 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1617 $selectedfields .=
' $("#checkforselects").click();';
1618 $selectedfields .=
' $("#massaction").val("createbills").change();';
1619 $selectedfields .=
' });';
1620 $selectedfields .=
'</script>';
1623print
'<div class="div-table-responsive">';
1624print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1628print
'<tr class="liste_titre_filter">';
1631 print
'<td class="liste_titre center maxwidthsearch">';
1632 $searchpicto = $form->showFilterButtons(
'left');
1638if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1639 print
'<td class="liste_titre">';
1640 print
'<input class="flat" size="6" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1645if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1646 print
'<td class="liste_titre">';
1647 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1651if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1652 print
'<td class="liste_titre" align="left">';
1653 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1657if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1658 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1661if (!empty($arrayfields[
'p.title'][
'checked'])) {
1662 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1665if (!empty($arrayfields[
's.nom'][
'checked'])) {
1666 print
'<td class="liste_titre" align="left">';
1667 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1671if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1672 print
'<td class="liste_titre" align="left">';
1673 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1677if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1678 print
'<td class="liste_titre">';
1679 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1683if (!empty($arrayfields[
's.town'][
'checked'])) {
1684 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1687if (!empty($arrayfields[
's.zip'][
'checked'])) {
1688 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1691if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1692 print
'<td class="liste_titre">';
1693 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1697if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1698 print
'<td class="liste_titre" align="center">';
1699 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1703if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1704 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1705 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);
1709if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1710 print
'<td class="liste_titre center">';
1711 print
'<div class="nowrapfordate">';
1712 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1714 print
'<div class="nowrapfordate">';
1715 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1719if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1720 print
'<td class="liste_titre center">';
1721 print
'<div class="nowrapfordate">';
1722 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1724 print
'<div class="nowrapfordate">';
1725 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1730if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1731 print
'<td class="liste_titre">';
1732 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1736if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1737 print
'<td class="liste_titre">';
1738 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1742if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1743 print
'<td class="liste_titre">';
1744 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1748if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1749 print
'<td class="liste_titre">';
1750 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1754if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1755 print
'<td class="liste_titre right">';
1756 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1760if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1761 print
'<td class="liste_titre right">';
1762 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1766if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1767 print
'<td class="liste_titre right">';
1768 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1772if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1773 print
'<td class="liste_titre">';
1774 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1778if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1779 print
'<td class="liste_titre">';
1780 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1784if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1785 print
'<td class="liste_titre right">';
1786 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1790if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1791 print
'<td class="liste_titre right">';
1792 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1796if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1797 print
'<td class="liste_titre right">';
1798 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1802if (!empty($arrayfields[
'u.login'][
'checked'])) {
1803 print
'<td class="liste_titre">';
1804 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1808if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1809 print
'<td class="liste_titre"></td>';
1811if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1812 print
'<td class="liste_titre right">';
1815if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1816 print
'<td class="liste_titre right">';
1819if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1820 print
'<td class="liste_titre right">';
1823if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1824 print
'<td class="liste_titre right">';
1829if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1830 print
'<td class="liste_titre">';
1834if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1835 print
'<td class="liste_titre">';
1839if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1840 print
'<td class="liste_titre center">';
1841 print
'<div class="nowrapfordate">';
1842 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1844 print
'<div class="nowrapfordate">';
1845 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1850if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1851 print
'<td class="liste_titre">';
1855if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1856 print
'<td class="liste_titre">';
1860if (!empty($arrayfields[
'shippable'][
'checked'])) {
1861 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1864 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1865 print $langs->trans(
'ShowShippableStatus');
1867 $show_shippable_command = 1;
1873include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1876$parameters = array(
'arrayfields' => $arrayfields);
1877$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1878print $hookmanager->resPrint;
1881if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1882 print
'<td class="liste_titre maxwidthonsmartphone center">';
1883 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1888if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1889 print
'<td class="liste_titre maxwidthonsmartphone center">';
1890 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1895if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1896 print
'<td class="liste_titre center parentonrightofpage">';
1897 $liststatus = array(
1901 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1902 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1907 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1912 print
'<td class="liste_titre center maxwidthsearch">';
1913 $searchpicto = $form->showFilterButtons();
1932print
'<tr class="liste_titre">';
1936 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1937 $totalarray[
'nbfield']++;
1939if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1940 print_liste_field_titre($arrayfields[
'c.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'c.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1941 $totalarray[
'nbfield']++;
1943if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1944 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1945 $totalarray[
'nbfield']++;
1947if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1948 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1949 $totalarray[
'nbfield']++;
1951if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1952 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1953 $totalarray[
'nbfield']++;
1955if (!empty($arrayfields[
'p.title'][
'checked'])) {
1956 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1957 $totalarray[
'nbfield']++;
1959if (!empty($arrayfields[
's.nom'][
'checked'])) {
1960 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1961 $totalarray[
'nbfield']++;
1963if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1965 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1966 $totalarray[
'nbfield']++;
1968if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1969 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1970 $totalarray[
'nbfield']++;
1972if (!empty($arrayfields[
's.town'][
'checked'])) {
1973 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1974 $totalarray[
'nbfield']++;
1976if (!empty($arrayfields[
's.zip'][
'checked'])) {
1977 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1978 $totalarray[
'nbfield']++;
1980if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1981 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1982 $totalarray[
'nbfield']++;
1984if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1985 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1986 $totalarray[
'nbfield']++;
1988if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1989 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1990 $totalarray[
'nbfield']++;
1992if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1993 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1994 $totalarray[
'nbfield']++;
1996if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1997 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1998 $totalarray[
'nbfield']++;
2000if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2001 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
2002 $totalarray[
'nbfield']++;
2004if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2005 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
2006 $totalarray[
'nbfield']++;
2008if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2009 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
2010 $totalarray[
'nbfield']++;
2012if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2013 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
2014 $totalarray[
'nbfield']++;
2016if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2017 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2018 $totalarray[
'nbfield']++;
2020if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2021 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2022 $totalarray[
'nbfield']++;
2024if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2025 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2026 $totalarray[
'nbfield']++;
2028if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2029 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2030 $totalarray[
'nbfield']++;
2032if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2033 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2034 $totalarray[
'nbfield']++;
2036if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2037 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
2038 $totalarray[
'nbfield']++;
2040if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2041 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
2042 $totalarray[
'nbfield']++;
2044if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2045 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
2046 $totalarray[
'nbfield']++;
2048if (!empty($arrayfields[
'u.login'][
'checked'])) {
2049 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
2050 $totalarray[
'nbfield']++;
2052if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2053 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2054 $totalarray[
'nbfield']++;
2056if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2057 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2058 $totalarray[
'nbfield']++;
2060if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2061 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2062 $totalarray[
'nbfield']++;
2064if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2065 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2066 $totalarray[
'nbfield']++;
2068if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2069 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2070 $totalarray[
'nbfield']++;
2073if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2074 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2075 $totalarray[
'nbfield']++;
2077if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2078 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2079 $totalarray[
'nbfield']++;
2081if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2082 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2083 $totalarray[
'nbfield']++;
2085if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2086 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
2087 $totalarray[
'nbfield']++;
2089if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2090 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
2091 $totalarray[
'nbfield']++;
2093if (!empty($arrayfields[
'shippable'][
'checked'])) {
2094 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
2095 $totalarray[
'nbfield']++;
2098include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2101$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2102$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2103print $hookmanager->resPrint;
2106if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2107 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
2108 $totalarray[
'nbfield']++;
2111if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2112 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2113 $totalarray[
'nbfield']++;
2116if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2117 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
2118 $totalarray[
'nbfield']++;
2122 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2123 $totalarray[
'nbfield']++;
2129$productstat_cache = array();
2130$productstat_cachevirtual = array();
2131$getNomUrl_cache = array();
2133$generic_commande =
new Commande($db);
2134$generic_product =
new Product($db);
2135$userstatic =
new User($db);
2137$with_margin_info =
false;
2138if (isModEnabled(
'margin') && (
2139 !empty($arrayfields[
'total_pa'][
'checked'])
2140 || !empty($arrayfields[
'total_margin'][
'checked'])
2141 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2142 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2145 $with_margin_info =
true;
2154$savnbfield = $totalarray[
'nbfield'];
2155$totalarray = array();
2156$totalarray[
'nbfield'] = 0;
2157$imaxinloop = ($limit ? min($num, $limit) : $num);
2158while ($i < $imaxinloop) {
2159 $obj = $db->fetch_object($resql);
2170 $companystatic->id = $obj->socid;
2171 $companystatic->name = $obj->name;
2172 $companystatic->name_alias = $obj->alias;
2173 $companystatic->client = $obj->client;
2174 $companystatic->fournisseur = $obj->fournisseur;
2175 $companystatic->code_client = $obj->code_client;
2176 $companystatic->email = $obj->email;
2177 $companystatic->phone = $obj->phone;
2178 $companystatic->address = $obj->address;
2179 $companystatic->zip = $obj->zip;
2180 $companystatic->town = $obj->town;
2181 $companystatic->country_code = $obj->country_code;
2182 if (!isset($getNomUrl_cache[$obj->socid])) {
2183 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2186 $generic_commande->id = $obj->rowid;
2187 $generic_commande->ref = $obj->ref;
2188 $generic_commande->statut = $obj->fk_statut;
2189 $generic_commande->billed = $obj->billed;
2190 $generic_commande->date = $db->jdate($obj->date_commande);
2191 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2192 $generic_commande->ref_client = $obj->ref_client;
2193 $generic_commande->total_ht = $obj->total_ht;
2194 $generic_commande->total_tva = $obj->total_tva;
2195 $generic_commande->total_ttc = $obj->total_ttc;
2196 $generic_commande->note_public = $obj->note_public;
2197 $generic_commande->note_private = $obj->note_private;
2199 $generic_commande->thirdparty = $companystatic;
2202 $projectstatic->id = $obj->project_id;
2203 $projectstatic->ref = $obj->project_ref;
2204 $projectstatic->title = $obj->project_label;
2206 $marginInfo = array();
2207 if ($with_margin_info) {
2208 $generic_commande->fetch_lines();
2209 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2210 $total_ht += $obj->total_ht;
2211 $total_margin += $marginInfo[
'total_margin'];
2214 if ($mode ==
'kanban') {
2216 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2217 print
'<div class="box-flex-container kanban">';
2222 if ($massactionbutton || $massaction) {
2224 if (in_array(
$object->id, $arrayofselected)) {
2228 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2229 if ($i == ($imaxinloop - 1)) {
2236 print
'<tr data-rowid="'.$object->id.
'" class="oddeven '.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->billed == 1) ?
'opacitymedium' :
'').
'">';
2240 print
'<td class="nowrap center">';
2241 if ($massactionbutton || $massaction) {
2243 if (in_array($obj->rowid, $arrayofselected)) {
2246 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2250 $totalarray[
'nbfield']++;
2255 if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
2256 print
'<td class="center" data-key="id">'.$obj->rowid.
'</td>';
2258 $totalarray[
'nbfield']++;
2263 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2264 print
'<td class="nowraponall">';
2265 $getNomUrlOption = $search_status != 2 ? 0 : $obj->fk_statut;
2271 $getNomUrlOption =
'';
2273 print $generic_commande->getNomUrl(1, $getNomUrlOption, 0, 0, 0, 1, 1);
2277 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2278 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2282 $totalarray[
'nbfield']++;
2287 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2288 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2292 $totalarray[
'nbfield']++;
2297 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2298 print
'<td class="nowrap">';
2299 if ($obj->project_id > 0) {
2300 print $projectstatic->getNomUrl(1);
2304 $totalarray[
'nbfield']++;
2309 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2310 print
'<td class="nowrap">';
2311 if ($obj->project_id > 0) {
2312 print $projectstatic->title;
2316 $totalarray[
'nbfield']++;
2321 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2322 print
'<td class="tdoverflowmax150">';
2324 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2326 print $getNomUrl_cache[$obj->socid];
2331 if ($user->hasRight(
'facture',
'creer')) {
2332 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2333 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2334 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2340 $totalarray[
'nbfield']++;
2345 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2346 print
'<td class="nocellnopadd tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->alias).
'">';
2350 $totalarray[
'nbfield']++;
2355 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2356 print
'<td class="tdoverflowmax200">';
2357 if ($obj->fk_parent > 0) {
2358 if (!isset($company_url_list[$obj->fk_parent])) {
2359 $companyparent =
new Societe($db);
2360 $res = $companyparent->fetch($obj->fk_parent);
2362 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2365 if (isset($company_url_list[$obj->fk_parent])) {
2366 print $company_url_list[$obj->fk_parent];
2371 $totalarray[
'nbfield']++;
2376 if (!empty($arrayfields[
's.town'][
'checked'])) {
2377 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->town).
'">';
2381 $totalarray[
'nbfield']++;
2386 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2387 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->zip).
'">';
2391 $totalarray[
'nbfield']++;
2396 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2397 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->state_name).
'">'.
dolPrintLabel($obj->state_name).
"</td>\n";
2399 $totalarray[
'nbfield']++;
2404 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2405 print
'<td class="center">';
2406 $tmparray =
getCountry($obj->fk_pays,
'all');
2407 print $tmparray[
'label'];
2410 $totalarray[
'nbfield']++;
2415 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2416 print
'<td class="center">';
2417 if (empty($typenArray)) {
2418 $typenArray = $formcompany->typent_array(1);
2420 print $typenArray[$obj->typent_code] ??
'';
2423 $totalarray[
'nbfield']++;
2428 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2429 print
'<td class="center nowraponall">';
2432 if ($generic_commande->hasDelay()) {
2433 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2437 $totalarray[
'nbfield']++;
2442 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2443 print
'<td class="center nowraponall">';
2444 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2447 $totalarray[
'nbfield']++;
2452 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2454 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2457 $totalarray[
'nbfield']++;
2462 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2464 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2467 $totalarray[
'nbfield']++;
2472 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2474 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2477 $totalarray[
'nbfield']++;
2482 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2484 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
2487 $totalarray[
'nbfield']++;
2492 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2493 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2495 $totalarray[
'nbfield']++;
2498 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2500 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2501 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2503 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2508 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2509 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2511 $totalarray[
'nbfield']++;
2514 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2516 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2517 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2519 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2524 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2525 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2527 $totalarray[
'nbfield']++;
2530 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2532 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2533 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2535 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2540 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2541 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2543 $totalarray[
'nbfield']++;
2548 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2549 print
'<td class="nowrap">';
2550 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2553 $totalarray[
'nbfield']++;
2558 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2559 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2561 $totalarray[
'nbfield']++;
2565 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2566 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2568 $totalarray[
'nbfield']++;
2572 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2573 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2575 $totalarray[
'nbfield']++;
2579 $userstatic->id = $obj->fk_user_author;
2580 $userstatic->login = $obj->login;
2581 $userstatic->lastname = $obj->lastname;
2582 $userstatic->firstname = $obj->firstname;
2583 $userstatic->email = $obj->user_email;
2584 $userstatic->status = $obj->user_statut;
2585 $userstatic->entity = $obj->entity;
2586 $userstatic->photo = $obj->photo;
2587 $userstatic->office_phone = $obj->office_phone;
2588 $userstatic->office_fax = $obj->office_fax;
2589 $userstatic->user_mobile = $obj->user_mobile;
2590 $userstatic->job = $obj->job;
2591 $userstatic->gender = $obj->gender;
2594 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2595 print
'<td class="tdoverflowmax125">';
2596 if ($userstatic->id) {
2597 print $userstatic->getNomUrl(-1);
2603 $totalarray[
'nbfield']++;
2608 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2610 if ($obj->socid > 0) {
2611 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2612 if ($listsalesrepresentatives < 0) {
2615 $nbofsalesrepresentative = count($listsalesrepresentatives);
2616 if ($nbofsalesrepresentative > 6) {
2618 print $nbofsalesrepresentative;
2619 } elseif ($nbofsalesrepresentative > 0) {
2621 foreach ($listsalesrepresentatives as $val) {
2622 $userstatic->id = $val[
'id'];
2623 $userstatic->lastname = $val[
'lastname'];
2624 $userstatic->firstname = $val[
'firstname'];
2625 $userstatic->email = $val[
'email'];
2626 $userstatic->status = $val[
'statut'];
2627 $userstatic->entity = $val[
'entity'];
2628 $userstatic->photo = $val[
'photo'];
2629 $userstatic->login = $val[
'login'];
2630 $userstatic->office_phone = $val[
'office_phone'];
2631 $userstatic->office_fax = $val[
'office_fax'];
2632 $userstatic->user_mobile = $val[
'user_mobile'];
2633 $userstatic->job = $val[
'job'];
2634 $userstatic->gender = $val[
'gender'];
2636 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2638 if ($j < $nbofsalesrepresentative) {
2650 $totalarray[
'nbfield']++;
2655 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2656 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2658 $totalarray[
'nbfield']++;
2663 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2664 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2666 $totalarray[
'nbfield']++;
2669 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2672 if (!isset($totalarray[
'val'][
'total_margin'])) {
2673 $totalarray[
'val'][
'total_margin'] = 0;
2676 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2680 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2681 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2683 $totalarray[
'nbfield']++;
2688 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2689 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2691 $totalarray[
'nbfield']++;
2694 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2696 if ($i >= $imaxinloop - 1) {
2697 if (!empty($total_ht)) {
2698 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2700 $totalarray[
'val'][
'total_mark_rate'] =
'';
2706 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2707 print
'<td align="center" class="nowrap">';
2708 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2711 $totalarray[
'nbfield']++;
2716 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2717 print
'<td align="center" class="nowrap">';
2718 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2721 $totalarray[
'nbfield']++;
2726 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2727 print
'<td align="center" class="nowrap">';
2728 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2731 $totalarray[
'nbfield']++;
2736 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2737 print
'<td class="sensiblehtmlcontent center">';
2741 $totalarray[
'nbfield']++;
2746 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2747 print
'<td class="sensiblehtmlcontent center">';
2751 $totalarray[
'nbfield']++;
2756 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2757 print
'<td class="center">';
2758 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2760 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2761 $generic_commande->getLinesArray();
2762 $generic_commande->loadExpeditions();
2764 $numlines = count($generic_commande->lines);
2765 for ($lig = 0; $lig < $numlines; $lig++) {
2766 $orderLine = $generic_commande->lines[$lig];
2767 '@phan-var-force OrderLine $orderLine';
2768 if (isset($generic_commande->expeditions[$orderLine->id])) {
2769 $reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id];
2771 $reliquat = $orderLine->qty;
2773 if ($orderLine->product_type == 0 && $orderLine->fk_product > 0) {
2775 $generic_product->id = $orderLine->fk_product;
2778 if (empty($productstat_cache[$orderLine->fk_product])) {
2779 $generic_product->load_stock(
'nobatch,warehouseopen');
2780 $productstat_cache[$orderLine->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2781 $productstat_cachevirtual[$orderLine->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2783 $generic_product->stock_reel = $productstat_cache[$orderLine->fk_product][
'stock_reel'];
2785 $generic_product->stock_theorique = $productstat_cachevirtual[$orderLine->fk_product][
'stock_reel'];
2788 if ($reliquat > $generic_product->stock_reel) {
2792 $text_info .= $reliquat.
' x '.$orderLine->product_ref.
' '.
dol_trunc($orderLine->product_label, 20);
2793 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2794 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2795 $text_info .= ($reliquat != $orderLine->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($orderLine->qty - $reliquat).
')</span>' :
'');
2796 $text_info .=
'<br>';
2803 $stock_order_supplier = 0;
2805 if (isModEnabled(
'order')) {
2806 if (empty($productstat_cache[$orderLine->fk_product][
'stats_order_customer'])) {
2807 $generic_product->load_stats_commande(0,
'1,2');
2808 $productstat_cache[$orderLine->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2811 $generic_product->stats_commande[
'qty'] = $productstat_cache[$orderLine->fk_product][
'stats_order_customer'];
2813 $stock_order = $generic_product->stats_commande[
'qty'];
2815 if (isModEnabled(
"supplier_order")) {
2816 if (empty($productstat_cache[$orderLine->fk_product][
'stats_order_supplier'])) {
2817 $generic_product->load_stats_commande_fournisseur(0,
'3');
2818 $productstat_cache[$orderLine->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2821 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$orderLine->fk_product][
'stats_order_supplier'];
2823 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2826 $text_info .= $reliquat.
' x '.$orderLine->ref.
' '.
dol_trunc($orderLine->product_label, 20);
2827 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2828 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $orderLine->qty)) {
2830 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2832 if ($reliquat > $generic_product->stock_reel) {
2833 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2835 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2837 if (isModEnabled(
"supplier_order")) {
2838 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2840 $text_info .= ($reliquat != $orderLine->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($orderLine->qty - $reliquat).
')</span>' :
'');
2841 $text_info .=
'<br>';
2845 if ($notshippable == 0) {
2846 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'green paddingleft');
2847 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2849 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'error paddingleft');
2850 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2855 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2858 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2863 $totalarray[
'nbfield']++;
2868 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2870 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2871 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2872 print $hookmanager->resPrint;
2875 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2876 print
'<td class="center">';
2878 print
yn($obj->billed, $langs->trans(
"Billed"));
2882 $totalarray[
'nbfield']++;
2887 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2888 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2890 $totalarray[
'nbfield']++;
2895 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2896 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2898 $totalarray[
'nbfield']++;
2904 print
'<td class="nowrap center">';
2905 if ($massactionbutton || $massaction) {
2907 if (in_array($obj->rowid, $arrayofselected)) {
2910 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2914 $totalarray[
'nbfield']++;
2920 $total += $obj->total_ht;
2921 $subtotal += $obj->total_ht;
2927include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2932 foreach ($arrayfields as $key => $val) {
2933 if (!empty($val[
'checked'])) {
2937 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2942$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2943$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2944print $hookmanager->resPrint;
2946print
'</table>'.
"\n";
2949print
'</form>'.
"\n";
2951if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2952 $hidegeneratedfilelistifempty = 1;
2953 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2954 $hidegeneratedfilelistifempty = 0;
2958 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2959 $urlsource .= str_replace(
'&',
'&', $param);
2961 $filedir = $diroutputmassaction;
2962 $genallowed = $permissiontoread;
2963 $delallowed = $permissiontoadd;
2965 print $formfile->showdocuments(
'massfilesarea_orders',
'', $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 customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage absolute discounts.
Class to manage invoices.
Class to manage products or services.
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)
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dolPrintLabel($s)
Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on...
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.