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_ext =
GETPOST(
'search_ref_ext',
'alpha');
106$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
107$search_company =
GETPOST(
'search_company',
'alpha');
108$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
109$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
110$search_town =
GETPOST(
'search_town',
'alpha');
111$search_zip =
GETPOST(
'search_zip',
'alpha');
112$search_state =
GETPOST(
'search_state',
'alpha');
113$search_country =
GETPOST(
'search_country',
'aZ09');
114$search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'intcomma');
115$search_user =
GETPOST(
'search_user',
'intcomma');
116$search_sale =
GETPOST(
'search_sale',
'intcomma');
117$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
118$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
119$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
120$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
122$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
123$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
124$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
125$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
126$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
128$search_login =
GETPOST(
'search_login',
'alpha');
129$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
130$search_billed =
GETPOST(
'search_billed',
'intcomma');
131$search_status =
GETPOST(
'search_status',
'intcomma');
132$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
133$search_project =
GETPOST(
'search_project',
'alpha');
134$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
136$search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'intcomma');
137$search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'intcomma');
138$search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'intcomma');
139$search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'intcomma');
141$search_option =
GETPOST(
'search_option',
'alpha');
142if ($search_option ==
'late') {
143 $search_status =
'-2';
145$search_orderday =
'';
146$search_ordermonth =
'';
147$search_orderyear =
'';
148$search_deliveryday =
'';
149$search_deliverymonth =
'';
150$search_deliveryyear =
'';
152$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
154$diroutputmassaction =
$conf->commande->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
158$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
159$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
161if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
165$offset = $limit * $page;
166$pageprev = $page - 1;
167$pagenext = $page + 1;
169 $sortfield =
'c.ref';
175$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
179$hookmanager->initHooks(array(
'orderlist'));
183$extrafields->fetch_name_optionals_label(
$object->table_element);
184$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
187$fieldstosearchall = array(
189 'c.ref_client' =>
'RefCustomerOrder',
190 'pd.description' =>
'Description',
191 's.nom' =>
"ThirdParty",
192 's.name_alias' =>
"AliasNameShort",
195 'c.note_public' =>
'NotePublic',
197if (empty($user->socid)) {
198 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
201$checkedtypetiers = 0;
203 'c.rowid' => array(
'label' =>
"ID",
'checked' => 1,
'enabled' =>
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 1),
204 'c.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5,
'searchall' => 1),
205 'c.ref_ext' => array(
'label' =>
"RefExt",
'checked' => 1,
'position' => 5,
'visible' => 0,
'searchall' => 1),
206 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' => -1,
'position' => 10,
'searchall' => 1),
207 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => -1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 20),
208 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 25),
209 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 30,
'searchall' => 1),
210 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 31,
'searchall' => 1),
211 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
212 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 35,
'searchall' => 1),
213 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 40,
'searchall' => 1),
214 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 45),
215 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 50),
216 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 55),
217 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' => 1,
'position' => 60,
'csslist' =>
'nowraponall'),
218 'c.date_delivery' => array(
'label' =>
"DateDeliveryPlanned",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65,
'csslist' =>
'nowraponall'),
219 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => -1,
'position' => 66 ,
'enabled' => isModEnabled(
"shipping")),
220 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => -1,
'position' => 67),
221 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => -1,
'position' => 68),
222 'c.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => -1,
'position' => 69),
223 'c.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 75),
224 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 80),
225 'c.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 85),
226 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 90),
227 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 95),
228 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 100),
229 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 105),
230 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 110),
231 'u.login' => array(
'label' =>
"Author",
'checked' => -1,
'position' => 115),
232 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 116),
233 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
234 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
235 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
236 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
237 'c.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 120),
238 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 125),
239 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 130),
240 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 135,
'searchall' => 1),
241 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 140),
242 'shippable' => array(
'label' =>
"Shippable",
'checked' => 1,
'enabled' => (isModEnabled(
"shipping")),
'position' => 990),
243 'c.facture' => array(
'label' =>
"Billed",
'checked' => 1,
'enabled' => (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
244 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
245 'c.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000)
248$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
249$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
251 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
252} elseif ($reshook == 0) {
253 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
257include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
262'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
268 $socid = $user->socid;
271$permissiontoreadallthirdparty = $user->hasRight(
'societe',
'client',
'voir');
272$permissiontoread =
false;
273$permissiontovalidate =
false;
274$permissiontoclose =
false;
275$permissiontocancel =
false;
276$permissiontosendbymail =
false;
289if (
GETPOST(
'cancel',
'alpha')) {
293if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
297$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
298$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
303if (empty($reshook)) {
305 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
308 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
311 $search_product_category =
'';
314 $search_ref_ext =
'';
315 $search_ref_customer =
'';
316 $search_company =
'';
317 $search_company_alias =
'';
318 $search_parent_name =
'';
323 $search_country =
'';
324 $search_type_thirdparty =
'';
325 $search_total_ht =
'';
326 $search_total_vat =
'';
327 $search_total_ttc =
'';
328 $search_warehouse =
'';
329 $search_multicurrency_code =
'';
330 $search_multicurrency_tx =
'';
331 $search_multicurrency_montant_ht =
'';
332 $search_multicurrency_montant_vat =
'';
333 $search_multicurrency_montant_ttc =
'';
335 $search_dateorder_start =
'';
336 $search_dateorder_end =
'';
337 $search_datedelivery_start =
'';
338 $search_datedelivery_end =
'';
339 $search_project_ref =
'';
340 $search_project =
'';
343 $search_datecloture_start =
'';
344 $search_datecloture_end =
'';
345 $search_fk_cond_reglement =
'';
346 $search_fk_shipping_method =
'';
347 $search_fk_mode_reglement =
'';
348 $search_fk_input_reason =
'';
350 $search_import_key =
'';
351 $search_categ_cus = 0;
355 $search_array_options = array();
357 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
358 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
363 $objectclass =
'Commande';
364 $objectlabel =
'Orders';
365 $permissiontoread = $user->hasRight(
"commande",
"lire");
366 $permissiontoadd = $user->hasRight(
"commande",
"creer");
367 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
369 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
370 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
371 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
372 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
374 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
375 $permissiontoclose = $user->hasRight(
"commande",
"creer");
376 $permissiontocancel = $user->hasRight(
"commande",
"creer");
377 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
379 $uploaddir =
$conf->commande->multidir_output[
$conf->entity];
380 $triggersendname =
'ORDER_SENTBYMAIL';
383 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
385 if ($massaction ==
'confirm_createbills') {
386 $orders =
GETPOST(
'toselect',
'array');
387 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
388 $validate_invoices =
GETPOSTINT(
'validate_invoices');
393 $TFactThird = array();
394 $TFactThirdNbLines = array();
396 $nb_bills_created = 0;
402 $nbOrders = is_array($orders) ? count($orders) : 1;
405 foreach ($orders as $id_order) {
407 if ($cmd->fetch($id_order) <= 0) {
410 $cmd->fetch_thirdparty();
413 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
416 $objecttmp = $TFactThird[$cmd->socid];
419 $objecttmp->socid = $cmd->socid;
420 $objecttmp->thirdparty = $cmd->thirdparty;
422 $objecttmp->type = $objecttmp::TYPE_STANDARD;
423 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
424 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
426 $objecttmp->fk_project = $cmd->fk_project;
427 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
428 if (empty($createbills_onebythird)) {
429 $objecttmp->ref_client = $cmd->ref_client;
432 if (empty($objecttmp->note_public)) {
433 $objecttmp->note_public = $langs->transnoentities(
"Orders");
437 if (empty($datefacture)) {
441 $objecttmp->date = $datefacture;
442 $objecttmp->origin =
'commande';
443 $objecttmp->origin_id = $id_order;
445 $objecttmp->array_options = $cmd->array_options;
447 $res = $objecttmp->create($user);
451 $lastref = $objecttmp->ref;
452 $lastid = $objecttmp->id;
454 $TFactThird[$cmd->socid] = $objecttmp;
455 $TFactThirdNbLines[$cmd->socid] = 0;
457 $langs->load(
"errors");
458 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
463 if ($objecttmp->id > 0) {
464 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
467 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
472 $lines = $cmd->lines;
473 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
475 $lines = $cmd->lines;
479 $num = count($lines);
480 $array_options = array();
482 for ($i = 0; $i < $num; $i++) {
483 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
485 if (!empty($createbills_onebythird)) {
489 if ($lines[$i]->subprice < 0 && !
getDolGlobalString(
'INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
492 $discount->fk_soc = $objecttmp->socid;
493 $discount->socid = $objecttmp->socid;
494 $discount->amount_ht = abs($lines[$i]->total_ht);
495 $discount->amount_tva = abs($lines[$i]->total_tva);
496 $discount->amount_ttc = abs($lines[$i]->total_ttc);
497 $discount->tva_tx = $lines[$i]->tva_tx;
498 $discount->fk_user = $user->id;
499 $discount->description = $desc;
500 $discountid = $discount->create($user);
501 if ($discountid > 0) {
502 $result = $objecttmp->insert_discount($discountid);
511 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
514 if ($lines[$i]->date_debut_prevue) {
515 $date_start = $lines[$i]->date_debut_prevue;
517 if ($lines[$i]->date_debut_reel) {
518 $date_start = $lines[$i]->date_debut_reel;
520 if ($lines[$i]->date_start) {
521 $date_start = $lines[$i]->date_start;
525 if ($lines[$i]->date_fin_prevue) {
526 $date_end = $lines[$i]->date_fin_prevue;
528 if ($lines[$i]->date_fin_reel) {
529 $date_end = $lines[$i]->date_fin_reel;
531 if ($lines[$i]->date_end) {
532 $date_end = $lines[$i]->date_end;
535 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
540 if (method_exists($lines[$i],
'fetch_optionals')) {
541 $lines[$i]->fetch_optionals();
542 $array_options = $lines[$i]->array_options;
545 $objecttmp->context[
'createfromclone'] =
'createfromclone';
547 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
549 if (!empty($createbills_onebythird)) {
550 $TFactThirdNbLines[$cmd->socid]++;
551 $rang = $TFactThirdNbLines[$cmd->socid];
554 $result = $objecttmp->addline(
556 $lines[$i]->subprice,
559 $lines[$i]->localtax1_tx,
560 $lines[$i]->localtax2_tx,
561 $lines[$i]->fk_product,
562 $lines[$i]->remise_percent,
566 $lines[$i]->info_bits,
567 $lines[$i]->fk_remise_except,
572 $lines[$i]->special_code,
576 $lines[$i]->fk_fournprice,
589 $errors[] = $objecttmp->error;
593 if ($result > 0 && $lines[$i]->product_type == 9) {
594 $fk_parent_line = $result;
602 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_client) ?
'' :
' ('.$cmd->ref_client.
')'));
603 $objecttmp->update($user);
608 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
609 $TFactThird[$cmd->socid] = $objecttmp;
611 $TFact[$objecttmp->id] = $objecttmp;
616 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
619 if (!$error && $validate_invoices) {
620 $massaction = $action =
'builddoc';
622 foreach ($TAllFact as &$objecttmp) {
623 $result = $objecttmp->validate($user);
630 $id = $objecttmp->id;
634 $upload_dir =
$conf->facture->dir_output;
635 $permissiontoadd = $user->hasRight(
'facture',
'creer');
640 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
644 $massaction = $action =
'confirm_createbills';
650 if ($nb_bills_created == 1) {
651 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_ONE') == 1) {
653 header(
'Location: '.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) $lastid));
656 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
657 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
660 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_MANY') == 1) {
662 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills');
665 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
671 $param .=
'&mode='.urlencode($mode);
673 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
674 $param .=
'&contextpage='.urlencode($contextpage);
676 if ($limit > 0 && $limit !=
$conf->liste_limit) {
677 $param .=
'&limit='.((int) $limit);
679 if ($optioncss !=
'') {
680 $param .=
'&optioncss='.urlencode($optioncss);
683 $param .=
'&search_all='.urlencode($search_all);
686 $param .=
'&show_files='.urlencode((
string) ($show_files));
689 $param .=
'&socid='.urlencode((
string) ($socid));
691 if ($search_status !=
'') {
692 $param .=
'&search_status='.urlencode($search_status);
694 if ($search_option) {
695 $param .=
"&search_option=".urlencode($search_option);
697 if ($search_orderday) {
698 $param .=
'&search_orderday='.urlencode($search_orderday);
700 if ($search_ordermonth) {
701 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
703 if ($search_orderyear) {
704 $param .=
'&search_orderyear='.urlencode($search_orderyear);
706 if ($search_deliveryday) {
707 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
709 if ($search_deliverymonth) {
710 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
712 if ($search_deliveryyear) {
713 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
716 $param .=
'&search_id='.urlencode((
string) $search_id);
719 $param .=
'&search_ref='.urlencode($search_ref);
721 if ($search_ref_ext) {
722 $param .=
'&search_ref_ext='.urlencode($search_ref_ext);
724 if ($search_company) {
725 $param .=
'&search_company='.urlencode($search_company);
727 if ($search_ref_customer) {
728 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
730 if ($search_user > 0) {
731 $param .=
'&search_user='.urlencode((
string) ($search_user));
733 if ($search_sale > 0) {
734 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
736 if ($search_total_ht !=
'') {
737 $param .=
'&search_total_ht='.urlencode($search_total_ht);
739 if ($search_total_vat !=
'') {
740 $param .=
'&search_total_vat='.urlencode($search_total_vat);
742 if ($search_total_ttc !=
'') {
743 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
745 if ($search_project_ref >= 0) {
746 $param .=
"&search_project_ref=".urlencode($search_project_ref);
748 if ($search_billed !=
'') {
749 $param .=
'&search_billed='.urlencode($search_billed);
752 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
758 $_GET[
"origin"] = $_POST[
"origin"];
759 $_GET[
"originid"] = $_POST[
"originid"];
760 if (!empty($errors)) {
770if ($action ==
'validate' && $permissiontoadd && $objectclass !==
null) {
771 if (
GETPOST(
'confirm') ==
'yes') {
773 $objecttmp =
new $objectclass($db);
776 foreach ($toselect as $checked) {
777 if ($objecttmp->fetch($checked)) {
778 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
779 if (!empty($objecttmp->fk_warehouse)) {
780 $idwarehouse = $objecttmp->fk_warehouse;
784 if ($objecttmp->valid($user, $idwarehouse)) {
785 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
791 $langs->load(
"errors");
792 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
807if ($action ==
'shipped' && $permissiontoadd && $objectclass !==
null) {
808 if (
GETPOST(
'confirm') ==
'yes') {
810 $objecttmp =
new $objectclass($db);
813 foreach ($toselect as $checked) {
814 if ($objecttmp->fetch($checked)) {
815 if ($objecttmp->status == $objecttmp::STATUS_VALIDATED || $objecttmp->status == $objecttmp::STATUS_SHIPMENTONPROCESS || $objecttmp->status == $objecttmp::STATUS_CLOSED) {
816 $result = $objecttmp->cloture($user);
818 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
819 } elseif ($result < 0) {
820 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
824 $langs->load(
"errors");
825 setEventMessages($langs->trans(
'ErrorObjectHasWrongStatus', $objecttmp->ref),
null,
'errors');
842if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
845 $objecttmp =
new $objectclass($db);
847 foreach ($toselect as $toselectid) {
848 $result = $objecttmp->fetch($toselectid);
850 $result = $objecttmp->classifyBilled($user, 0);
878$form =
new Form($db);
882if (isModEnabled(
'margin')) {
885$companystatic =
new Societe($db);
886$company_url_list = array();
888$projectstatic =
new Project($db);
892$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
893$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
895$title = $langs->trans(
"Orders");
896$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
902 $sql =
'SELECT DISTINCT';
904$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,';
905$sql .=
" s.parent as fk_parent,";
906$sql .=
" s2.nom as name2,";
907$sql .=
" typent.code as typent_code,";
908$sql .=
" state.code_departement as state_code, state.nom as state_name,";
909$sql .=
" country.code as country_code,";
910$sql .=
' c.rowid, c.ref, c.ref_ext, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
911$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,';
912$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,';
913$sql .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
914$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
915$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,';
916$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
917$sql .=
' c.fk_input_reason, c.import_key';
920if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
921 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
922 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
927$parameters = array();
928$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
929$sql .= $hookmanager->resPrint;
930$sql = preg_replace(
'/,\s*$/',
'', $sql);
934$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
935$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
936$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
937$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
938$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
939$sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
940if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
941 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
944 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid = pd.fk_commande';
946$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
947$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
949$parameters = array();
950$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
951$sql .= $hookmanager->resPrint;
953$sql .=
' WHERE c.fk_soc = s.rowid';
954$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
956 $sql .=
' AND s.rowid = '.((int) $socid);
959if (empty($user->socid) && !$permissiontoreadallthirdparty) {
960 $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).
")";
962 $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)).
"))";
973if ($search_ref_ext) {
976if ($search_ref_customer) {
980 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
982if ($search_billed !=
'' && $search_billed >= 0) {
983 $sql .=
' AND c.facture = '.((int) $search_billed);
985if ($search_status !=
'') {
986 if ($search_status <= 3 && $search_status >= -1) {
987 if ($search_status == 1 && !isModEnabled(
'shipping')) {
988 $sql .=
' AND c.fk_statut IN (1,2)';
990 $sql .=
' AND c.fk_statut = '.((int) $search_status);
993 if ($search_status == -2) {
995 $sql .=
" AND (c.fk_statut IN (1,2))";
997 if ($search_status == -3) {
1000 $sql .=
' AND (c.fk_statut IN (1,2,3))';
1003if ($search_option ==
'late') {
1006 $sql .=
" AND ((c.date_livraison IS NOT NULL AND c.date_livraison < '".$db->idate(
dol_now() -
$conf->order->client->warning_delay).
"') OR (c.date_livraison IS NULL AND c.date_commande < '".$db->idate(
dol_now() -
$conf->order->client->warning_delay).
"'))";
1008 $sql .=
" AND c.date_commande < '".$db->idate(
dol_now() -
$conf->order->client->warning_delay).
"'";
1011if ($search_datecloture_start) {
1012 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
1014if ($search_datecloture_end) {
1015 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
1017if ($search_dateorder_start) {
1018 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
1020if ($search_dateorder_end) {
1021 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
1023if ($search_datedelivery_start) {
1024 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
1026if ($search_datedelivery_end) {
1027 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
1038if ($search_country) {
1039 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
1041if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1042 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
1044if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
1045 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
1047 if ($search_company) {
1050 if ($search_company_alias) {
1054if ($search_parent_name) {
1057if ($search_total_ht !=
'') {
1060if ($search_total_vat !=
'') {
1063if ($search_total_ttc !=
'') {
1066if ($search_warehouse !=
'' && $search_warehouse > 0) {
1069if ($search_multicurrency_code !=
'') {
1070 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
1072if ($search_multicurrency_tx !=
'') {
1073 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
1075if ($search_multicurrency_montant_ht !=
'') {
1076 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
1078if ($search_multicurrency_montant_vat !=
'') {
1079 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
1081if ($search_multicurrency_montant_ttc !=
'') {
1082 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1085 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
1087if ($search_project_ref !=
'') {
1090if ($search_project !=
'') {
1093if ($search_fk_cond_reglement > 0) {
1094 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1096if ($search_fk_shipping_method > 0) {
1097 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1099if ($search_fk_mode_reglement > 0) {
1100 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1102if ($search_fk_input_reason > 0) {
1103 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1105if ($search_import_key) {
1109if ($search_user > 0) {
1110 $sql .=
" AND EXISTS (";
1111 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1112 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1113 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1114 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal'";
1115 $sql .=
" WHERE ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1118if ($search_sale && $search_sale !=
'-1') {
1119 if ($search_sale == -2) {
1120 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
1121 } elseif ($search_sale > 0) {
1122 $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).
")";
1126$searchCategoryCustomerOperator = -1;
1127$searchCategoryCustomerList = array($search_categ_cus);
1128if (!empty($searchCategoryCustomerList)) {
1129 $searchCategoryCustomerSqlList = array();
1130 $listofcategoryid =
'';
1131 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1132 if (intval($searchCategoryCustomer) == -2) {
1133 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
1134 } elseif (intval($searchCategoryCustomer) > 0) {
1135 if ($searchCategoryCustomerOperator == 0) {
1136 $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).
")";
1138 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1142 if ($listofcategoryid) {
1143 $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).
"))";
1145 if ($searchCategoryCustomerOperator == 1) {
1146 if (!empty($searchCategoryCustomerSqlList)) {
1147 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1150 if (!empty($searchCategoryCustomerSqlList)) {
1151 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1156$searchCategoryProductOperator = -1;
1157$searchCategoryProductList = array($search_product_category);
1158if (!empty($searchCategoryProductList)) {
1159 $searchCategoryProductSqlList = array();
1160 $listofcategoryid =
'';
1161 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1162 if (intval($searchCategoryProduct) == -2) {
1163 $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)";
1164 } elseif (intval($searchCategoryProduct) > 0) {
1165 if ($searchCategoryProductOperator == 0) {
1166 $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).
")";
1168 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1172 if ($listofcategoryid) {
1173 $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).
"))";
1175 if ($searchCategoryProductOperator == 1) {
1176 if (!empty($searchCategoryProductSqlList)) {
1177 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1180 if (!empty($searchCategoryProductSqlList)) {
1181 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1186include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1188$parameters = array();
1189$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1190$sql .= $hookmanager->resPrint;
1193$parameters = array();
1194$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1195$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1199$nbtotalofrecords =
'';
1202 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1203 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1204 $resql = $db->query($sqlforcount);
1206 $objforcount = $db->fetch_object($resql);
1207 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1212 if (($page * $limit) > $nbtotalofrecords) {
1219$sql .= $db->order($sortfield, $sortorder);
1221 $sql .= $db->plimit($limit + 1, $offset);
1225$resql = $db->query($sql);
1233 $soc->fetch($socid);
1234 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1235 if (empty($search_company)) {
1236 $search_company = $soc->name;
1239 $title = $langs->trans(
'CustomersOrders');
1241if (strval($search_status) ==
'0') {
1242 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1244if ($search_status == 1) {
1245 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1247if ($search_status == 2) {
1248 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1250if ($search_status == 3) {
1251 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1253if ($search_status == -1) {
1254 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1256if ($search_status == -2) {
1257 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1259if ($search_status == -3) {
1260 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1262if ($search_status == -4) {
1263 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1266$num = $db->num_rows($resql);
1268$arrayofselected = is_array($toselect) ? $toselect : array();
1270if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1271 $obj = $db->fetch_object($resql);
1273 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.
$id);
1280llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-order page-list');
1282$arrayofselected = is_array($toselect) ? $toselect : array();
1286 $param .=
'&mode='.urlencode($mode);
1288if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1289 $param .=
'&contextpage='.urlencode($contextpage);
1291if ($limit > 0 && $limit !=
$conf->liste_limit) {
1292 $param .=
'&limit='.((int) $limit);
1294if ($optioncss !=
'') {
1295 $param .=
'&optioncss='.urlencode($optioncss);
1298 $param .=
'&show_files='.urlencode((
string) ($show_files));
1301 $param .=
'&search_all='.urlencode($search_all);
1304 $param .=
'&socid='.((int) $socid);
1306if ($search_status !=
'') {
1307 $param .=
'&search_status='.urlencode($search_status);
1309if ($search_option) {
1310 $param .=
"&search_option=".urlencode($search_option);
1312if ($search_datecloture_start) {
1313 $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');
1315if ($search_datecloture_end) {
1316 $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');
1318if ($search_dateorder_start) {
1319 $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');
1321if ($search_dateorder_end) {
1322 $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');
1324if ($search_datedelivery_start) {
1325 $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');
1327if ($search_datedelivery_end) {
1328 $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');
1331 $param .=
'&search_id='.urlencode((
string) $search_id);
1334 $param .=
'&search_ref='.urlencode($search_ref);
1336if ($search_ref_ext) {
1337 $param .=
'&search_ref_ext='.urlencode($search_ref_ext);
1339if ($search_company) {
1340 $param .=
'&search_company='.urlencode($search_company);
1342if ($search_company_alias) {
1343 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1345if ($search_parent_name !=
'') {
1346 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1348if ($search_ref_customer) {
1349 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1351if ($search_user > 0) {
1352 $param .=
'&search_user='.urlencode((
string) ($search_user));
1354if ($search_sale > 0) {
1355 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1357if ($search_total_ht !=
'') {
1358 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1360if ($search_total_vat !=
'') {
1361 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1363if ($search_total_ttc !=
'') {
1364 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1366if ($search_warehouse !=
'') {
1367 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
1370 $param .=
'&search_login='.urlencode($search_login);
1372if ($search_multicurrency_code !=
'') {
1373 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1375if ($search_multicurrency_tx !=
'') {
1376 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1378if ($search_multicurrency_montant_ht !=
'') {
1379 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1381if ($search_multicurrency_montant_vat !=
'') {
1382 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1384if ($search_multicurrency_montant_ttc !=
'') {
1385 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1387if ($search_project_ref >= 0) {
1388 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1390if ($search_town !=
'') {
1391 $param .=
'&search_town='.urlencode($search_town);
1393if ($search_zip !=
'') {
1394 $param .=
'&search_zip='.urlencode($search_zip);
1396if ($search_state !=
'') {
1397 $param .=
'&search_state='.urlencode($search_state);
1399if ($search_country !=
'') {
1400 $param .=
'&search_country='.urlencode((
string) ($search_country));
1402if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1403 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1405if ($search_product_category !=
'') {
1406 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1408if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1409 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1411if ($search_billed !=
'') {
1412 $param .=
'&search_billed='.urlencode($search_billed);
1414if ($search_fk_cond_reglement > 0) {
1415 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1417if ($search_fk_shipping_method > 0) {
1418 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1420if ($search_fk_mode_reglement > 0) {
1421 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1423if ($search_fk_input_reason > 0) {
1424 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1426if ($search_import_key !=
'') {
1427 $param .=
'&search_import_key='.urlencode($search_import_key);
1431include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1434$parameters = array();
1435$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1436$param .= $hookmanager->resPrint;
1439$arrayofmassactions = array(
1440 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1441 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1443if ($permissiontovalidate) {
1444 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1446if ($permissiontoclose) {
1447 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1449if (isModEnabled(
'invoice') && $user->hasRight(
"facture",
"creer")) {
1450 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1452if ($permissiontoclose) {
1453 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1455if ($permissiontocancel) {
1456 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"CancelOrder");
1458if (!empty($permissiontodelete)) {
1459 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1461if ($permissiontosendbymail) {
1462 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1464if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1465 $arrayofmassactions = array();
1467$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1469$url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1470if (!empty($socid)) {
1471 $url .=
'&socid='.$socid;
1474$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'));
1475$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'));
1477$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', (
int) (($contextpage ==
'orderlist' || $contextpage ==
'billableorders') && $permissiontoadd));
1480print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1481if ($optioncss !=
'') {
1482 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1484print
'<input type="hidden" name="token" value="'.newToken().
'">';
1485print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1486print
'<input type="hidden" name="action" value="list">';
1487print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1488print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1489print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1490print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1491print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1492print
'<input type="hidden" name="page_y" value="">';
1493print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1496print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1498$topicmail =
"SendOrderRef";
1499$modelmail =
"order_send";
1501$trackid =
'ord'.$object->id;
1502include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1504if ($massaction ==
'prevalidate') {
1505 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1507if ($massaction ==
'preshipped') {
1508 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1511if ($massaction ==
'createbills') {
1512 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1514 print
'<table class="noborder centpercent">';
1517 print $langs->trans(
'DateInvoice');
1520 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1525 print $langs->trans(
'CreateOneBillByThird');
1528 print $form->selectyesno(
'createbills_onebythird',
getDolGlobalString(
'MAIN_ORDERLIST_CREATEBILLS_ONEBYTHIRD',
'no'), 1);
1533 print $langs->trans(
'ValidateInvoices');
1537 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
1538 $langs->load(
"errors");
1539 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1541 print $form->selectyesno(
'validate_invoices', 0, 1);
1543 if (!empty(
$conf->workflow->enabled) &&
getDolGlobalString(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1544 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1546 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1552 print
'<div class="center">';
1553 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1554 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1561 foreach ($fieldstosearchall as $key => $val) {
1562 $fieldstosearchall[$key] = $langs->trans($val);
1563 $setupstring .= $key.
"=".$val.
";";
1565 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1566 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1572if ($user->hasRight(
"user",
"user",
"lire")) {
1573 $langs->load(
"commercial");
1574 $moreforfilter .=
'<div class="divsearchfield">';
1575 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1576 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1577 $moreforfilter .=
'</div>';
1580if ($user->hasRight(
"user",
"user",
"lire")) {
1581 $moreforfilter .=
'<div class="divsearchfield">';
1582 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1583 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1584 $moreforfilter .=
'</div>';
1588if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1589 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1590 $moreforfilter .=
'<div class="divsearchfield">';
1591 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1592 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, array(), 1);
1593 $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);
1594 $moreforfilter .=
'</div>';
1597if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1598 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1599 $moreforfilter .=
'<div class="divsearchfield">';
1600 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1601 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1602 $moreforfilter .=
'</div>';
1605if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
1606 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1608 $moreforfilter .=
'<div class="divsearchfield">';
1609 $tmptitle = $langs->trans(
'Warehouse');
1610 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1611 $moreforfilter .=
'</div>';
1614$parameters = array();
1615$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1616if (empty($reshook)) {
1617 $moreforfilter .= $hookmanager->resPrint;
1619 $moreforfilter = $hookmanager->resPrint;
1622if (!empty($moreforfilter)) {
1623 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1624 print $moreforfilter;
1628$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1629$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1630$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1631$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1634 $selectedfields .=
'<script>';
1635 $selectedfields .=
' $(document).ready(function() {';
1636 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1637 $selectedfields .=
' $("#checkforselects").click();';
1638 $selectedfields .=
' $("#massaction").val("createbills").change();';
1639 $selectedfields .=
' });';
1640 $selectedfields .=
'</script>';
1643print
'<div class="div-table-responsive">';
1644print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1648print
'<tr class="liste_titre_filter">';
1651 print
'<td class="liste_titre center maxwidthsearch">';
1652 $searchpicto = $form->showFilterButtons(
'left');
1658if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1659 print
'<td class="liste_titre">';
1660 print
'<input class="flat" size="6" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1665if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1666 print
'<td class="liste_titre">';
1667 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1671if (!empty($arrayfields[
'c.ref_ext'][
'checked'])) {
1672 print
'<td class="liste_titre">';
1673 print
'<input class="flat" size="6" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1677if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1678 print
'<td class="liste_titre" align="left">';
1679 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1683if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1684 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1687if (!empty($arrayfields[
'p.title'][
'checked'])) {
1688 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1691if (!empty($arrayfields[
's.nom'][
'checked'])) {
1692 print
'<td class="liste_titre" align="left">';
1693 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.(!empty($user->socid) ?
" disabled" :
"").
'>';
1697if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1698 print
'<td class="liste_titre" align="left">';
1699 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1703if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1704 print
'<td class="liste_titre">';
1705 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1709if (!empty($arrayfields[
's.town'][
'checked'])) {
1710 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1713if (!empty($arrayfields[
's.zip'][
'checked'])) {
1714 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1717if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1718 print
'<td class="liste_titre">';
1719 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1723if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1724 print
'<td class="liste_titre" align="center">';
1725 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1729if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1730 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1731 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);
1735if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1736 print
'<td class="liste_titre center">';
1737 print
'<div class="nowrapfordate">';
1738 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1740 print
'<div class="nowrapfordate">';
1741 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1745if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1746 print
'<td class="liste_titre center">';
1747 print
'<div class="nowrapfordate">';
1748 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1750 print
'<div class="nowrapfordate">';
1751 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1756if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1757 print
'<td class="liste_titre">';
1758 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1762if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1763 print
'<td class="liste_titre">';
1764 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1768if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1769 print
'<td class="liste_titre">';
1770 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1774if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1775 print
'<td class="liste_titre">';
1776 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1780if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1781 print
'<td class="liste_titre right">';
1782 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1786if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1787 print
'<td class="liste_titre right">';
1788 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1792if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1793 print
'<td class="liste_titre right">';
1794 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1798if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1799 print
'<td class="liste_titre">';
1800 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1804if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1805 print
'<td class="liste_titre">';
1806 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1810if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1811 print
'<td class="liste_titre right">';
1812 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1816if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1817 print
'<td class="liste_titre right">';
1818 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1822if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1823 print
'<td class="liste_titre right">';
1824 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1828if (!empty($arrayfields[
'u.login'][
'checked'])) {
1829 print
'<td class="liste_titre">';
1830 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1834if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1835 print
'<td class="liste_titre"></td>';
1837if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1838 print
'<td class="liste_titre right">';
1841if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1842 print
'<td class="liste_titre right">';
1845if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1846 print
'<td class="liste_titre right">';
1849if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1850 print
'<td class="liste_titre right">';
1855if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1856 print
'<td class="liste_titre">';
1860if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1861 print
'<td class="liste_titre">';
1865if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1866 print
'<td class="liste_titre center">';
1867 print
'<div class="nowrapfordate">';
1868 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1870 print
'<div class="nowrapfordate">';
1871 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1876if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1877 print
'<td class="liste_titre">';
1881if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1882 print
'<td class="liste_titre">';
1886if (!empty($arrayfields[
'shippable'][
'checked'])) {
1887 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1890 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1891 print $langs->trans(
'ShowShippableStatus');
1893 $show_shippable_command = 1;
1899include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1902$parameters = array(
'arrayfields' => $arrayfields);
1903$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1904print $hookmanager->resPrint;
1907if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1908 print
'<td class="liste_titre maxwidthonsmartphone center">';
1909 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1914if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1915 print
'<td class="liste_titre maxwidthonsmartphone center">';
1916 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1921if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1922 print
'<td class="liste_titre center parentonrightofpage">';
1923 $liststatus = array(
1927 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1928 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1933 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1938 print
'<td class="liste_titre center maxwidthsearch">';
1939 $searchpicto = $form->showFilterButtons();
1958print
'<tr class="liste_titre">';
1962 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1963 $totalarray[
'nbfield']++;
1965if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1966 print_liste_field_titre($arrayfields[
'c.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'c.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1967 $totalarray[
'nbfield']++;
1969if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1970 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1971 $totalarray[
'nbfield']++;
1973if (!empty($arrayfields[
'c.ref_ext'][
'checked'])) {
1974 print_liste_field_titre($arrayfields[
'c.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_ext',
'', $param,
'', $sortfield, $sortorder);
1975 $totalarray[
'nbfield']++;
1977if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1978 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1979 $totalarray[
'nbfield']++;
1981if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1982 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1983 $totalarray[
'nbfield']++;
1985if (!empty($arrayfields[
'p.title'][
'checked'])) {
1986 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1987 $totalarray[
'nbfield']++;
1989if (!empty($arrayfields[
's.nom'][
'checked'])) {
1990 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1991 $totalarray[
'nbfield']++;
1993if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1995 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1996 $totalarray[
'nbfield']++;
1998if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1999 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
2000 $totalarray[
'nbfield']++;
2002if (!empty($arrayfields[
's.town'][
'checked'])) {
2003 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
2004 $totalarray[
'nbfield']++;
2006if (!empty($arrayfields[
's.zip'][
'checked'])) {
2007 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
2008 $totalarray[
'nbfield']++;
2010if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2011 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
2012 $totalarray[
'nbfield']++;
2014if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2015 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
2016 $totalarray[
'nbfield']++;
2018if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2019 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
2020 $totalarray[
'nbfield']++;
2022if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2023 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
2024 $totalarray[
'nbfield']++;
2026if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2027 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
2028 $totalarray[
'nbfield']++;
2030if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2031 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
2032 $totalarray[
'nbfield']++;
2034if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2035 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
2036 $totalarray[
'nbfield']++;
2038if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2039 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
2040 $totalarray[
'nbfield']++;
2042if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2043 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
2044 $totalarray[
'nbfield']++;
2046if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2047 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2048 $totalarray[
'nbfield']++;
2050if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2051 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2052 $totalarray[
'nbfield']++;
2054if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2055 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2056 $totalarray[
'nbfield']++;
2058if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2059 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2060 $totalarray[
'nbfield']++;
2062if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2063 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2064 $totalarray[
'nbfield']++;
2066if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2067 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
2068 $totalarray[
'nbfield']++;
2070if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2071 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
2072 $totalarray[
'nbfield']++;
2074if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2075 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
2076 $totalarray[
'nbfield']++;
2078if (!empty($arrayfields[
'u.login'][
'checked'])) {
2079 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
2080 $totalarray[
'nbfield']++;
2082if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2083 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2084 $totalarray[
'nbfield']++;
2086if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2087 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2088 $totalarray[
'nbfield']++;
2090if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2091 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2092 $totalarray[
'nbfield']++;
2094if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2095 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2096 $totalarray[
'nbfield']++;
2098if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2099 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2100 $totalarray[
'nbfield']++;
2103if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2104 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2105 $totalarray[
'nbfield']++;
2107if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2108 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2109 $totalarray[
'nbfield']++;
2111if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2112 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2113 $totalarray[
'nbfield']++;
2115if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2116 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
2117 $totalarray[
'nbfield']++;
2119if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2120 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
2121 $totalarray[
'nbfield']++;
2123if (!empty($arrayfields[
'shippable'][
'checked'])) {
2124 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
2125 $totalarray[
'nbfield']++;
2128include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2131$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2132$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2133print $hookmanager->resPrint;
2136if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2137 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
2138 $totalarray[
'nbfield']++;
2141if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2142 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2143 $totalarray[
'nbfield']++;
2146if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2147 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
2148 $totalarray[
'nbfield']++;
2152 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2153 $totalarray[
'nbfield']++;
2159$productstat_cache = array();
2160$productstat_cachevirtual = array();
2161$getNomUrl_cache = array();
2163$generic_commande =
new Commande($db);
2164$generic_product =
new Product($db);
2165$userstatic =
new User($db);
2167$with_margin_info =
false;
2168if (isModEnabled(
'margin') && (
2169 !empty($arrayfields[
'total_pa'][
'checked'])
2170 || !empty($arrayfields[
'total_margin'][
'checked'])
2171 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2172 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2175 $with_margin_info =
true;
2184$savnbfield = $totalarray[
'nbfield'];
2185$totalarray = array();
2186$totalarray[
'nbfield'] = 0;
2187$imaxinloop = ($limit ? min($num, $limit) : $num);
2188while ($i < $imaxinloop) {
2189 $obj = $db->fetch_object($resql);
2200 $companystatic->id = $obj->socid;
2201 $companystatic->name = $obj->name;
2202 $companystatic->name_alias = $obj->alias;
2203 $companystatic->client = $obj->client;
2204 $companystatic->fournisseur = $obj->fournisseur;
2205 $companystatic->code_client = $obj->code_client;
2206 $companystatic->email = $obj->email;
2207 $companystatic->phone = $obj->phone;
2208 $companystatic->address = $obj->address;
2209 $companystatic->zip = $obj->zip;
2210 $companystatic->town = $obj->town;
2211 $companystatic->country_code = $obj->country_code;
2212 if (!isset($getNomUrl_cache[$obj->socid])) {
2213 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2216 $generic_commande->id = $obj->rowid;
2217 $generic_commande->ref = $obj->ref;
2218 $generic_commande->statut = $obj->fk_statut;
2219 $generic_commande->billed = $obj->billed;
2220 $generic_commande->date = $db->jdate($obj->date_commande);
2221 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2222 $generic_commande->ref_client = $obj->ref_client;
2223 $generic_commande->total_ht = $obj->total_ht;
2224 $generic_commande->total_tva = $obj->total_tva;
2225 $generic_commande->total_ttc = $obj->total_ttc;
2226 $generic_commande->note_public = $obj->note_public;
2227 $generic_commande->note_private = $obj->note_private;
2229 $generic_commande->thirdparty = $companystatic;
2232 $projectstatic->id = $obj->project_id;
2233 $projectstatic->ref = $obj->project_ref;
2234 $projectstatic->title = $obj->project_label;
2236 $marginInfo = array();
2237 if ($with_margin_info) {
2238 $generic_commande->fetch_lines();
2239 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2240 $total_ht += $obj->total_ht;
2241 $total_margin += $marginInfo[
'total_margin'];
2244 if ($mode ==
'kanban') {
2246 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2247 print
'<div class="box-flex-container kanban">';
2252 if ($massactionbutton || $massaction) {
2254 if (in_array(
$object->id, $arrayofselected)) {
2258 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2259 if ($i == ($imaxinloop - 1)) {
2266 print
'<tr data-rowid="'.$object->id.
'" class="oddeven '.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->billed == 1) ?
'opacitymedium' :
'').
'">';
2270 print
'<td class="nowrap center">';
2271 if ($massactionbutton || $massaction) {
2273 if (in_array($obj->rowid, $arrayofselected)) {
2276 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2280 $totalarray[
'nbfield']++;
2285 if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
2286 print
'<td class="center" data-key="id">'.$obj->rowid.
'</td>';
2288 $totalarray[
'nbfield']++;
2293 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2294 print
'<td class="nowraponall">';
2295 $getNomUrlOption = $search_status != 2 ? 0 : $obj->fk_statut;
2301 $getNomUrlOption =
'';
2303 print $generic_commande->getNomUrl(1, $getNomUrlOption, 0, 0, 0, 1, 1);
2307 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2308 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2312 $totalarray[
'nbfield']++;
2317 if (!empty($arrayfields[
'c.ref_ext'][
'checked'])) {
2318 print
'<td class="nowrap tdoverflowmax75" title="'.dol_escape_htmltag($obj->ref_ext).
'">';
2322 $totalarray[
'nbfield']++;
2327 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2328 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2332 $totalarray[
'nbfield']++;
2337 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2338 print
'<td class="nowrap">';
2339 if ($obj->project_id > 0) {
2340 print $projectstatic->getNomUrl(1);
2344 $totalarray[
'nbfield']++;
2349 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2350 print
'<td class="nowrap">';
2351 if ($obj->project_id > 0) {
2352 print $projectstatic->title;
2356 $totalarray[
'nbfield']++;
2361 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2362 print
'<td class="tdoverflowmax150">';
2364 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2366 print $getNomUrl_cache[$obj->socid];
2371 if ($user->hasRight(
'facture',
'creer')) {
2372 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2373 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2374 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2380 $totalarray[
'nbfield']++;
2385 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2386 print
'<td class="nocellnopadd tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->alias).
'">';
2390 $totalarray[
'nbfield']++;
2395 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2396 print
'<td class="tdoverflowmax200">';
2397 if ($obj->fk_parent > 0) {
2398 if (!isset($company_url_list[$obj->fk_parent])) {
2399 $companyparent =
new Societe($db);
2400 $res = $companyparent->fetch($obj->fk_parent);
2402 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2405 if (isset($company_url_list[$obj->fk_parent])) {
2406 print $company_url_list[$obj->fk_parent];
2411 $totalarray[
'nbfield']++;
2416 if (!empty($arrayfields[
's.town'][
'checked'])) {
2417 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->town).
'">';
2421 $totalarray[
'nbfield']++;
2426 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2427 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->zip).
'">';
2431 $totalarray[
'nbfield']++;
2436 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2437 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->state_name).
'">'.
dolPrintLabel($obj->state_name).
"</td>\n";
2439 $totalarray[
'nbfield']++;
2444 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2445 print
'<td class="center">';
2446 $tmparray =
getCountry($obj->fk_pays,
'all');
2447 print $tmparray[
'label'];
2450 $totalarray[
'nbfield']++;
2455 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2456 print
'<td class="center">';
2457 if (empty($typenArray)) {
2458 $typenArray = $formcompany->typent_array(1);
2460 print $typenArray[$obj->typent_code] ??
'';
2463 $totalarray[
'nbfield']++;
2468 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2469 print
'<td class="center nowraponall">';
2472 if ($generic_commande->hasDelay()) {
2473 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2477 $totalarray[
'nbfield']++;
2482 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2483 print
'<td class="center nowraponall">';
2484 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2487 $totalarray[
'nbfield']++;
2492 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2494 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2497 $totalarray[
'nbfield']++;
2502 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2504 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2507 $totalarray[
'nbfield']++;
2512 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2514 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2517 $totalarray[
'nbfield']++;
2522 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2524 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
2527 $totalarray[
'nbfield']++;
2532 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2533 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2535 $totalarray[
'nbfield']++;
2538 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2540 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2541 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2543 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2548 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2549 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2551 $totalarray[
'nbfield']++;
2554 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2556 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2557 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2559 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2564 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2565 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2567 $totalarray[
'nbfield']++;
2570 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2572 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2573 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2575 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2580 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2581 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2583 $totalarray[
'nbfield']++;
2588 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2589 print
'<td class="nowrap">';
2590 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2593 $totalarray[
'nbfield']++;
2598 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2599 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2601 $totalarray[
'nbfield']++;
2605 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2606 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2608 $totalarray[
'nbfield']++;
2612 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2613 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2615 $totalarray[
'nbfield']++;
2619 $userstatic->id = $obj->fk_user_author;
2620 $userstatic->login = $obj->login;
2621 $userstatic->lastname = $obj->lastname;
2622 $userstatic->firstname = $obj->firstname;
2623 $userstatic->email = $obj->user_email;
2624 $userstatic->status = $obj->user_statut;
2625 $userstatic->entity = $obj->entity;
2626 $userstatic->photo = $obj->photo;
2627 $userstatic->office_phone = $obj->office_phone;
2628 $userstatic->office_fax = $obj->office_fax;
2629 $userstatic->user_mobile = $obj->user_mobile;
2630 $userstatic->job = $obj->job;
2631 $userstatic->gender = $obj->gender;
2634 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2635 print
'<td class="tdoverflowmax125">';
2636 if ($userstatic->id) {
2637 print $userstatic->getNomUrl(-1);
2643 $totalarray[
'nbfield']++;
2648 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2650 if ($obj->socid > 0) {
2651 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2652 if ($listsalesrepresentatives < 0) {
2655 $nbofsalesrepresentative = count($listsalesrepresentatives);
2656 if ($nbofsalesrepresentative > 6) {
2658 print $nbofsalesrepresentative;
2659 } elseif ($nbofsalesrepresentative > 0) {
2661 foreach ($listsalesrepresentatives as $val) {
2662 $userstatic->id = $val[
'id'];
2663 $userstatic->lastname = $val[
'lastname'];
2664 $userstatic->firstname = $val[
'firstname'];
2665 $userstatic->email = $val[
'email'];
2666 $userstatic->status = $val[
'statut'];
2667 $userstatic->entity = $val[
'entity'];
2668 $userstatic->photo = $val[
'photo'];
2669 $userstatic->login = $val[
'login'];
2670 $userstatic->office_phone = $val[
'office_phone'];
2671 $userstatic->office_fax = $val[
'office_fax'];
2672 $userstatic->user_mobile = $val[
'user_mobile'];
2673 $userstatic->job = $val[
'job'];
2674 $userstatic->gender = $val[
'gender'];
2676 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2678 if ($j < $nbofsalesrepresentative) {
2690 $totalarray[
'nbfield']++;
2695 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2696 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2698 $totalarray[
'nbfield']++;
2703 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2704 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2706 $totalarray[
'nbfield']++;
2709 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2712 if (!isset($totalarray[
'val'][
'total_margin'])) {
2713 $totalarray[
'val'][
'total_margin'] = 0;
2716 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2720 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2721 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2723 $totalarray[
'nbfield']++;
2728 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2729 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2731 $totalarray[
'nbfield']++;
2734 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2736 if ($i >= $imaxinloop - 1) {
2737 if (!empty($total_ht)) {
2738 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2740 $totalarray[
'val'][
'total_mark_rate'] =
'';
2746 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2747 print
'<td class="center nowraponall">';
2748 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2751 $totalarray[
'nbfield']++;
2756 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2757 print
'<td class="center nowraponall">';
2758 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2761 $totalarray[
'nbfield']++;
2766 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2767 print
'<td class="center nowraponall">';
2768 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2771 $totalarray[
'nbfield']++;
2776 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2777 print
'<td class="sensiblehtmlcontent center">';
2781 $totalarray[
'nbfield']++;
2786 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2787 print
'<td class="sensiblehtmlcontent center">';
2791 $totalarray[
'nbfield']++;
2796 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2797 print
'<td class="center">';
2798 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2800 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2801 $generic_commande->getLinesArray();
2802 $generic_commande->loadExpeditions();
2804 $numlines = count($generic_commande->lines);
2805 for ($lig = 0; $lig < $numlines; $lig++) {
2806 $orderLine = $generic_commande->lines[$lig];
2807 '@phan-var-force OrderLine $orderLine';
2808 if (isset($generic_commande->expeditions[$orderLine->id])) {
2809 $reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id];
2811 $reliquat = $orderLine->qty;
2813 if ($orderLine->product_type == 0 && $orderLine->fk_product > 0) {
2815 $generic_product->id = $orderLine->fk_product;
2818 if (empty($productstat_cache[$orderLine->fk_product])) {
2819 $generic_product->load_stock(
'nobatch,warehouseopen');
2820 $productstat_cache[$orderLine->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2821 $productstat_cachevirtual[$orderLine->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2823 $generic_product->stock_reel = $productstat_cache[$orderLine->fk_product][
'stock_reel'];
2825 $generic_product->stock_theorique = $productstat_cachevirtual[$orderLine->fk_product][
'stock_reel'];
2828 if ($reliquat > $generic_product->stock_reel) {
2832 $text_info .= $reliquat.
' x '.$orderLine->product_ref.
' '.
dol_trunc($orderLine->product_label, 20);
2833 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2834 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2835 $text_info .= ($reliquat != $orderLine->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($orderLine->qty - $reliquat).
')</span>' :
'');
2836 $text_info .=
'<br>';
2843 $stock_order_supplier = 0;
2845 if (isModEnabled(
'order')) {
2846 if (empty($productstat_cache[$orderLine->fk_product][
'stats_order_customer'])) {
2847 $generic_product->load_stats_commande(0,
'1,2');
2848 $productstat_cache[$orderLine->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2851 $generic_product->stats_commande[
'qty'] = $productstat_cache[$orderLine->fk_product][
'stats_order_customer'];
2853 $stock_order = $generic_product->stats_commande[
'qty'];
2855 if (isModEnabled(
"supplier_order")) {
2856 if (empty($productstat_cache[$orderLine->fk_product][
'stats_order_supplier'])) {
2857 $generic_product->load_stats_commande_fournisseur(0,
'3');
2858 $productstat_cache[$orderLine->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2861 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$orderLine->fk_product][
'stats_order_supplier'];
2863 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2866 $text_info .= $reliquat.
' x '.$orderLine->ref.
' '.
dol_trunc($orderLine->product_label, 20);
2867 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2868 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $orderLine->qty)) {
2870 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2872 if ($reliquat > $generic_product->stock_reel) {
2873 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2875 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2877 if (isModEnabled(
"supplier_order")) {
2878 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2880 $text_info .= ($reliquat != $orderLine->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($orderLine->qty - $reliquat).
')</span>' :
'');
2881 $text_info .=
'<br>';
2885 if ($notshippable == 0) {
2886 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'green paddingleft');
2887 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2889 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'error paddingleft');
2890 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2895 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2898 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2903 $totalarray[
'nbfield']++;
2908 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2910 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2911 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2912 print $hookmanager->resPrint;
2915 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2916 print
'<td class="center">';
2918 print
yn($obj->billed, $langs->trans(
"Billed"));
2922 $totalarray[
'nbfield']++;
2927 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2928 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2930 $totalarray[
'nbfield']++;
2935 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2936 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2938 $totalarray[
'nbfield']++;
2944 print
'<td class="nowrap center">';
2945 if ($massactionbutton || $massaction) {
2947 if (in_array($obj->rowid, $arrayofselected)) {
2950 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2954 $totalarray[
'nbfield']++;
2960 $total += $obj->total_ht;
2961 $subtotal += $obj->total_ht;
2967include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2972 foreach ($arrayfields as $key => $val) {
2973 if (!empty($val[
'checked'])) {
2977 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2982$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2983$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2984print $hookmanager->resPrint;
2986print
'</table>'.
"\n";
2989print
'</form>'.
"\n";
2991if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2992 $hidegeneratedfilelistifempty = 1;
2993 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2994 $hidegeneratedfilelistifempty = 0;
2998 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2999 $urlsource .= str_replace(
'&',
'&', $param);
3001 $filedir = $diroutputmassaction;
3002 $genallowed = $permissiontoread;
3003 $delallowed = $permissiontoadd;
3005 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, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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...
dolPrintLabel($s, $escapeonlyhtmltags=0)
Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.