43require
'../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50if (isModEnabled(
'margin')) {
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
67$langs->loadLangs(array(
'orders',
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
70$action =
GETPOST(
'action',
'aZ09');
71$massaction =
GETPOST(
'massaction',
'alpha');
73$confirm =
GETPOST(
'confirm',
'alpha');
74$toselect =
GETPOST(
'toselect',
'array');
75$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlist';
76$optioncss =
GETPOST(
'optioncss',
'alpha');
77$mode =
GETPOST(
'mode',
'alpha');
80 $userschilds = $user->getAllChildIds();
82 $userschilds = array();
86$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
87if (empty($search_datecloture_start)) {
90$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
91if (empty($search_datecloture_end)) {
101$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
102$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
103$search_id =
GETPOST(
'search_id',
'int');
104$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
105$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
106$search_company =
GETPOST(
'search_company',
'alpha');
107$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
108$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
109$search_town =
GETPOST(
'search_town',
'alpha');
110$search_zip =
GETPOST(
'search_zip',
'alpha');
111$search_state =
GETPOST(
'search_state',
'alpha');
112$search_country =
GETPOST(
'search_country',
'aZ09');
113$search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'intcomma');
114$search_user =
GETPOST(
'search_user',
'intcomma');
115$search_sale =
GETPOST(
'search_sale',
'intcomma');
116$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
117$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
118$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
119$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
121$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
122$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
123$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
124$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
125$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
127$search_login =
GETPOST(
'search_login',
'alpha');
128$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
129$search_billed =
GETPOST(
'search_billed',
'intcomma');
130$search_status =
GETPOST(
'search_status',
'intcomma');
131$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
132$search_project =
GETPOST(
'search_project',
'alpha');
133$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
135$search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'intcomma');
136$search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'intcomma');
137$search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'intcomma');
138$search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'intcomma');
140$search_option =
GETPOST(
'search_option',
'alpha');
141if ($search_option ==
'late') {
142 $search_status =
'-2';
144$search_orderday =
'';
145$search_ordermonth =
'';
146$search_orderyear =
'';
147$search_deliveryday =
'';
148$search_deliverymonth =
'';
149$search_deliveryyear =
'';
151$diroutputmassaction =
$conf->commande->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
155$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
156$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
158if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
162$offset = $limit * $page;
163$pageprev = $page - 1;
164$pagenext = $page + 1;
166 $sortfield =
'c.ref';
172$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
176$hookmanager->initHooks(array(
'orderlist'));
180$extrafields->fetch_name_optionals_label(
$object->table_element);
181$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
184$fieldstosearchall = array(
186 'c.ref_client' =>
'RefCustomerOrder',
187 'pd.description' =>
'Description',
188 's.nom' =>
"ThirdParty",
189 's.name_alias' =>
"AliasNameShort",
192 'c.note_public' =>
'NotePublic',
194if (empty($user->socid)) {
195 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
198$checkedtypetiers = 0;
200 'c.rowid' => array(
'label' =>
"ID",
'checked' => 1,
'enabled' =>
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 1),
201 'c.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5,
'searchall' => 1),
202 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' => -1,
'position' => 10,
'searchall' => 1),
203 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => -1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 20),
204 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 25),
205 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 30,
'searchall' => 1),
206 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 31,
'searchall' => 1),
207 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
208 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 35,
'searchall' => 1),
209 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 40,
'searchall' => 1),
210 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 45),
211 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 50),
212 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 55),
213 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' => 1,
'position' => 60,
'csslist' =>
'nowraponall'),
214 'c.date_delivery' => array(
'label' =>
"DateDeliveryPlanned",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65,
'csslist' =>
'nowraponall'),
215 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => -1,
'position' => 66 ,
'enabled' => isModEnabled(
"shipping")),
216 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => -1,
'position' => 67),
217 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => -1,
'position' => 68),
218 'c.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => -1,
'position' => 69),
219 'c.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 75),
220 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 80),
221 'c.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 85),
222 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 90),
223 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 95),
224 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 100),
225 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 105),
226 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 110),
227 'u.login' => array(
'label' =>
"Author",
'checked' => -1,
'position' => 115),
228 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 116),
229 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
230 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
231 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
232 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
233 'c.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 120),
234 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 125),
235 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 130),
236 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 135,
'searchall' => 1),
237 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 140),
238 'shippable' => array(
'label' =>
"Shippable",
'checked' => 1,
'enabled' => (isModEnabled(
"shipping")),
'position' => 990),
239 'c.facture' => array(
'label' =>
"Billed",
'checked' => 1,
'enabled' => (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
240 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
241 'c.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000)
244$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
245$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
247 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
248} elseif ($reshook == 0) {
249 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
253include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
258'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
264 $socid = $user->socid;
267$permissiontoreadallthirdparty = $user->hasRight(
'societe',
'client',
'voir');
268$permissiontoread =
false;
269$permissiontovalidate =
false;
270$permissiontoclose =
false;
271$permissiontocancel =
false;
272$permissiontosendbymail =
false;
285if (
GETPOST(
'cancel',
'alpha')) {
289if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
293$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
294$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
299if (empty($reshook)) {
301 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
304 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
307 $search_product_category =
'';
310 $search_ref_customer =
'';
311 $search_company =
'';
312 $search_company_alias =
'';
313 $search_parent_name =
'';
318 $search_country =
'';
319 $search_type_thirdparty =
'';
320 $search_total_ht =
'';
321 $search_total_vat =
'';
322 $search_total_ttc =
'';
323 $search_warehouse =
'';
324 $search_multicurrency_code =
'';
325 $search_multicurrency_tx =
'';
326 $search_multicurrency_montant_ht =
'';
327 $search_multicurrency_montant_vat =
'';
328 $search_multicurrency_montant_ttc =
'';
330 $search_dateorder_start =
'';
331 $search_dateorder_end =
'';
332 $search_datedelivery_start =
'';
333 $search_datedelivery_end =
'';
334 $search_project_ref =
'';
335 $search_project =
'';
339 $search_array_options = array();
340 $search_categ_cus = 0;
341 $search_datecloture_start =
'';
342 $search_datecloture_end =
'';
343 $search_fk_cond_reglement =
'';
344 $search_fk_shipping_method =
'';
345 $search_fk_mode_reglement =
'';
346 $search_fk_input_reason =
'';
349 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
350 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
355 $objectclass =
'Commande';
356 $objectlabel =
'Orders';
357 $permissiontoread = $user->hasRight(
"commande",
"lire");
358 $permissiontoadd = $user->hasRight(
"commande",
"creer");
359 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
361 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
362 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
363 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
364 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
366 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
367 $permissiontoclose = $user->hasRight(
"commande",
"creer");
368 $permissiontocancel = $user->hasRight(
"commande",
"creer");
369 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
371 $uploaddir =
$conf->commande->multidir_output[
$conf->entity];
372 $triggersendname =
'ORDER_SENTBYMAIL';
375 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
377 if ($massaction ==
'confirm_createbills') {
378 $orders =
GETPOST(
'toselect',
'array');
379 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
380 $validate_invoices =
GETPOSTINT(
'validate_invoices');
385 $TFactThird = array();
386 $TFactThirdNbLines = array();
388 $nb_bills_created = 0;
394 $nbOrders = is_array($orders) ? count($orders) : 1;
397 foreach ($orders as $id_order) {
399 if ($cmd->fetch($id_order) <= 0) {
402 $cmd->fetch_thirdparty();
405 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
408 $objecttmp = $TFactThird[$cmd->socid];
411 $objecttmp->socid = $cmd->socid;
412 $objecttmp->thirdparty = $cmd->thirdparty;
414 $objecttmp->type = $objecttmp::TYPE_STANDARD;
415 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
416 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
418 $objecttmp->fk_project = $cmd->fk_project;
419 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
420 if (empty($createbills_onebythird)) {
421 $objecttmp->ref_client = $cmd->ref_client;
424 if (empty($objecttmp->note_public)) {
425 $objecttmp->note_public = $langs->transnoentities(
"Orders");
429 if (empty($datefacture)) {
433 $objecttmp->date = $datefacture;
434 $objecttmp->origin =
'commande';
435 $objecttmp->origin_id = $id_order;
437 $objecttmp->array_options = $cmd->array_options;
439 $res = $objecttmp->create($user);
443 $lastref = $objecttmp->ref;
444 $lastid = $objecttmp->id;
446 $TFactThird[$cmd->socid] = $objecttmp;
447 $TFactThirdNbLines[$cmd->socid] = 0;
449 $langs->load(
"errors");
450 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
455 if ($objecttmp->id > 0) {
456 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
459 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
464 $lines = $cmd->lines;
465 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
467 $lines = $cmd->lines;
471 $num = count($lines);
472 $array_options = array();
474 for ($i = 0; $i < $num; $i++) {
475 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
477 if (!empty($createbills_onebythird)) {
481 if ($lines[$i]->subprice < 0 && !
getDolGlobalString(
'INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
484 $discount->fk_soc = $objecttmp->socid;
485 $discount->socid = $objecttmp->socid;
486 $discount->amount_ht = abs($lines[$i]->total_ht);
487 $discount->amount_tva = abs($lines[$i]->total_tva);
488 $discount->amount_ttc = abs($lines[$i]->total_ttc);
489 $discount->tva_tx = $lines[$i]->tva_tx;
490 $discount->fk_user = $user->id;
491 $discount->description = $desc;
492 $discountid = $discount->create($user);
493 if ($discountid > 0) {
494 $result = $objecttmp->insert_discount($discountid);
503 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
506 if ($lines[$i]->date_debut_prevue) {
507 $date_start = $lines[$i]->date_debut_prevue;
509 if ($lines[$i]->date_debut_reel) {
510 $date_start = $lines[$i]->date_debut_reel;
512 if ($lines[$i]->date_start) {
513 $date_start = $lines[$i]->date_start;
517 if ($lines[$i]->date_fin_prevue) {
518 $date_end = $lines[$i]->date_fin_prevue;
520 if ($lines[$i]->date_fin_reel) {
521 $date_end = $lines[$i]->date_fin_reel;
523 if ($lines[$i]->date_end) {
524 $date_end = $lines[$i]->date_end;
527 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
532 if (method_exists($lines[$i],
'fetch_optionals')) {
533 $lines[$i]->fetch_optionals();
534 $array_options = $lines[$i]->array_options;
537 $objecttmp->context[
'createfromclone'] =
'createfromclone';
539 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
541 if (!empty($createbills_onebythird)) {
542 $TFactThirdNbLines[$cmd->socid]++;
543 $rang = $TFactThirdNbLines[$cmd->socid];
546 $result = $objecttmp->addline(
548 $lines[$i]->subprice,
551 $lines[$i]->localtax1_tx,
552 $lines[$i]->localtax2_tx,
553 $lines[$i]->fk_product,
554 $lines[$i]->remise_percent,
558 $lines[$i]->info_bits,
559 $lines[$i]->fk_remise_except,
564 $lines[$i]->special_code,
568 $lines[$i]->fk_fournprice,
581 $errors[] = $objecttmp->error;
585 if ($result > 0 && $lines[$i]->product_type == 9) {
586 $fk_parent_line = $result;
594 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_client) ?
'' :
' ('.$cmd->ref_client.
')'));
595 $objecttmp->update($user);
600 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
601 $TFactThird[$cmd->socid] = $objecttmp;
603 $TFact[$objecttmp->id] = $objecttmp;
608 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
611 if (!$error && $validate_invoices) {
612 $massaction = $action =
'builddoc';
614 foreach ($TAllFact as &$objecttmp) {
615 $result = $objecttmp->validate($user);
622 $id = $objecttmp->id;
626 $upload_dir =
$conf->facture->dir_output;
627 $permissiontoadd = $user->hasRight(
'facture',
'creer');
632 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
636 $massaction = $action =
'confirm_createbills';
642 if ($nb_bills_created == 1) {
643 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_ONE') == 1) {
645 header(
'Location: '.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) $lastid));
648 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
649 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
652 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_MANY') == 1) {
654 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills');
657 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
663 $param .=
'&mode='.urlencode($mode);
665 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
666 $param .=
'&contextpage='.urlencode($contextpage);
668 if ($limit > 0 && $limit !=
$conf->liste_limit) {
669 $param .=
'&limit='.((int) $limit);
671 if ($optioncss !=
'') {
672 $param .=
'&optioncss='.urlencode($optioncss);
675 $param .=
'&search_all='.urlencode($search_all);
678 $param .=
'&show_files='.urlencode((
string) ($show_files));
681 $param .=
'&socid='.urlencode((
string) ($socid));
683 if ($search_status !=
'') {
684 $param .=
'&search_status='.urlencode($search_status);
686 if ($search_option) {
687 $param .=
"&search_option=".urlencode($search_option);
689 if ($search_orderday) {
690 $param .=
'&search_orderday='.urlencode($search_orderday);
692 if ($search_ordermonth) {
693 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
695 if ($search_orderyear) {
696 $param .=
'&search_orderyear='.urlencode($search_orderyear);
698 if ($search_deliveryday) {
699 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
701 if ($search_deliverymonth) {
702 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
704 if ($search_deliveryyear) {
705 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
708 $param .=
'&search_id='.urlencode((
string) $search_id);
711 $param .=
'&search_ref='.urlencode($search_ref);
713 if ($search_company) {
714 $param .=
'&search_company='.urlencode($search_company);
716 if ($search_ref_customer) {
717 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
719 if ($search_user > 0) {
720 $param .=
'&search_user='.urlencode((
string) ($search_user));
722 if ($search_sale > 0) {
723 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
725 if ($search_total_ht !=
'') {
726 $param .=
'&search_total_ht='.urlencode($search_total_ht);
728 if ($search_total_vat !=
'') {
729 $param .=
'&search_total_vat='.urlencode($search_total_vat);
731 if ($search_total_ttc !=
'') {
732 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
734 if ($search_project_ref >= 0) {
735 $param .=
"&search_project_ref=".urlencode($search_project_ref);
737 if ($search_billed !=
'') {
738 $param .=
'&search_billed='.urlencode($search_billed);
741 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
747 $_GET[
"origin"] = $_POST[
"origin"];
748 $_GET[
"originid"] = $_POST[
"originid"];
749 if (!empty($errors)) {
758if ($action ==
'validate' && $permissiontoadd && $objectclass !==
null) {
759 if (
GETPOST(
'confirm') ==
'yes') {
760 $objecttmp =
new $objectclass($db);
763 foreach ($toselect as $checked) {
764 if ($objecttmp->fetch($checked)) {
765 if ($objecttmp->statut == 0) {
766 if (!empty($objecttmp->fk_warehouse)) {
767 $idwarehouse = $objecttmp->fk_warehouse;
771 if ($objecttmp->valid($user, $idwarehouse)) {
772 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
778 $langs->load(
"errors");
779 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
794if ($action ==
'shipped' && $permissiontoadd && $objectclass !==
null) {
795 if (
GETPOST(
'confirm') ==
'yes') {
796 $objecttmp =
new $objectclass($db);
799 foreach ($toselect as $checked) {
800 if ($objecttmp->fetch($checked)) {
801 if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
802 if ($objecttmp->cloture($user)) {
803 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
805 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
809 $langs->load(
"errors");
810 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
827if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
830 $objecttmp =
new $objectclass($db);
832 foreach ($toselect as $toselectid) {
833 $result = $objecttmp->fetch($toselectid);
835 $result = $objecttmp->classifyBilled($user, 0);
863$form =
new Form($db);
867if (isModEnabled(
'margin')) {
870$companystatic =
new Societe($db);
871$company_url_list = array();
873$projectstatic =
new Project($db);
877$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
878$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
880$title = $langs->trans(
"Orders");
881$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
887 $sql =
'SELECT DISTINCT';
889$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,';
890$sql .=
" s.parent as fk_parent,";
891$sql .=
" s2.nom as name2,";
892$sql .=
" typent.code as typent_code,";
893$sql .=
" state.code_departement as state_code, state.nom as state_name,";
894$sql .=
" country.code as country_code,";
895$sql .=
' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
896$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,';
897$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,';
898$sql .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
899$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
900$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,';
901$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
902$sql .=
' c.fk_input_reason, c.import_key';
905if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
906 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
907 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
912$parameters = array();
913$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
914$sql .= $hookmanager->resPrint;
915$sql = preg_replace(
'/,\s*$/',
'', $sql);
919$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
920$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
921$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
922$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
923$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
924$sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
925if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
926 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
929 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
931$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
932$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
934$parameters = array();
935$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
936$sql .= $hookmanager->resPrint;
938$sql .=
' WHERE c.fk_soc = s.rowid';
939$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
941 $sql .=
' AND s.rowid = '.((int) $socid);
945if (!$permissiontoreadallthirdparty) {
946 $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).
")";
948 $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)).
"))";
959if ($search_ref_customer) {
963 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
965if ($search_billed !=
'' && $search_billed >= 0) {
966 $sql .=
' AND c.facture = '.((int) $search_billed);
968if ($search_status !=
'') {
969 if ($search_status <= 3 && $search_status >= -1) {
970 if ($search_status == 1 && !isModEnabled(
'shipping')) {
971 $sql .=
' AND c.fk_statut IN (1,2)';
973 $sql .=
' AND c.fk_statut = '.((int) $search_status);
976 if ($search_status == -2) {
978 $sql .=
" AND (c.fk_statut IN (1,2))";
980 if ($search_status == -3) {
983 $sql .=
' AND (c.fk_statut IN (1,2,3))';
986if ($search_option ==
'late') {
987 $sql .=
" AND c.date_commande < '".$db->idate(
dol_now() -
$conf->commande->client->warning_delay).
"'";
989if ($search_datecloture_start) {
990 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
992if ($search_datecloture_end) {
993 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
995if ($search_dateorder_start) {
996 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
998if ($search_dateorder_end) {
999 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
1001if ($search_datedelivery_start) {
1002 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
1004if ($search_datedelivery_end) {
1005 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
1016if ($search_country) {
1017 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
1019if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1020 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
1022if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
1023 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
1025 if ($search_company) {
1028 if ($search_company_alias) {
1032if ($search_parent_name) {
1035if ($search_total_ht !=
'') {
1038if ($search_total_vat !=
'') {
1041if ($search_total_ttc !=
'') {
1044if ($search_warehouse !=
'' && $search_warehouse > 0) {
1047if ($search_multicurrency_code !=
'') {
1048 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
1050if ($search_multicurrency_tx !=
'') {
1051 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
1053if ($search_multicurrency_montant_ht !=
'') {
1054 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
1056if ($search_multicurrency_montant_vat !=
'') {
1057 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
1059if ($search_multicurrency_montant_ttc !=
'') {
1060 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1063 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
1065if ($search_project_ref !=
'') {
1068if ($search_project !=
'') {
1071if ($search_fk_cond_reglement > 0) {
1072 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1074if ($search_fk_shipping_method > 0) {
1075 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1077if ($search_fk_mode_reglement > 0) {
1078 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1080if ($search_fk_input_reason > 0) {
1081 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1084if ($search_user > 0) {
1085 $sql .=
" AND EXISTS (";
1086 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1087 $sql .=
" FROM llx_element_contact as ec";
1088 $sql .=
" INNER JOIN llx_c_type_contact as tc";
1089 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal'";
1090 $sql .=
" WHERE ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1093if ($search_sale && $search_sale !=
'-1') {
1094 if ($search_sale == -2) {
1095 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
1096 } elseif ($search_sale > 0) {
1097 $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).
")";
1101$searchCategoryCustomerOperator = -1;
1102$searchCategoryCustomerList = array($search_categ_cus);
1103if (!empty($searchCategoryCustomerList)) {
1104 $searchCategoryCustomerSqlList = array();
1105 $listofcategoryid =
'';
1106 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1107 if (intval($searchCategoryCustomer) == -2) {
1108 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
1109 } elseif (intval($searchCategoryCustomer) > 0) {
1110 if ($searchCategoryCustomerOperator == 0) {
1111 $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).
")";
1113 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1117 if ($listofcategoryid) {
1118 $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).
"))";
1120 if ($searchCategoryCustomerOperator == 1) {
1121 if (!empty($searchCategoryCustomerSqlList)) {
1122 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1125 if (!empty($searchCategoryCustomerSqlList)) {
1126 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1131$searchCategoryProductOperator = -1;
1132$searchCategoryProductList = array($search_product_category);
1133if (!empty($searchCategoryProductList)) {
1134 $searchCategoryProductSqlList = array();
1135 $listofcategoryid =
'';
1136 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1137 if (intval($searchCategoryProduct) == -2) {
1138 $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)";
1139 } elseif (intval($searchCategoryProduct) > 0) {
1140 if ($searchCategoryProductOperator == 0) {
1141 $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).
")";
1143 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1147 if ($listofcategoryid) {
1148 $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).
"))";
1150 if ($searchCategoryProductOperator == 1) {
1151 if (!empty($searchCategoryProductSqlList)) {
1152 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1155 if (!empty($searchCategoryProductSqlList)) {
1156 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1161include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1163$parameters = array();
1164$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1165$sql .= $hookmanager->resPrint;
1168$parameters = array();
1169$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1170$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1174$nbtotalofrecords =
'';
1177 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1178 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1179 $resql = $db->query($sqlforcount);
1181 $objforcount = $db->fetch_object($resql);
1182 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1187 if (($page * $limit) > $nbtotalofrecords) {
1194$sql .= $db->order($sortfield, $sortorder);
1196 $sql .= $db->plimit($limit + 1, $offset);
1200$resql = $db->query($sql);
1208 $soc->fetch($socid);
1209 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1210 if (empty($search_company)) {
1211 $search_company = $soc->name;
1214 $title = $langs->trans(
'CustomersOrders');
1216if (strval($search_status) ==
'0') {
1217 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1219if ($search_status == 1) {
1220 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1222if ($search_status == 2) {
1223 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1225if ($search_status == 3) {
1226 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1228if ($search_status == -1) {
1229 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1231if ($search_status == -2) {
1232 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1234if ($search_status == -3) {
1235 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1237if ($search_status == -4) {
1238 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1241$num = $db->num_rows($resql);
1243$arrayofselected = is_array($toselect) ? $toselect : array();
1245if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1246 $obj = $db->fetch_object($resql);
1248 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.
$id);
1255llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-order page-list');
1257$arrayofselected = is_array($toselect) ? $toselect : array();
1261 $param .=
'&mode='.urlencode($mode);
1263if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1264 $param .=
'&contextpage='.urlencode($contextpage);
1266if ($limit > 0 && $limit !=
$conf->liste_limit) {
1267 $param .=
'&limit='.((int) $limit);
1270 $param .=
'&search_all='.urlencode($search_all);
1273 $param .=
'&socid='.((int) $socid);
1275if ($search_status !=
'') {
1276 $param .=
'&search_status='.urlencode($search_status);
1278if ($search_option) {
1279 $param .=
"&search_option=".urlencode($search_option);
1281if ($search_datecloture_start) {
1282 $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');
1284if ($search_datecloture_end) {
1285 $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');
1287if ($search_dateorder_start) {
1288 $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');
1290if ($search_dateorder_end) {
1291 $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');
1293if ($search_datedelivery_start) {
1294 $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');
1296if ($search_datedelivery_end) {
1297 $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');
1300 $param .=
'&search_id='.urlencode((
string) $search_id);
1303 $param .=
'&search_ref='.urlencode($search_ref);
1305if ($search_company) {
1306 $param .=
'&search_company='.urlencode($search_company);
1308if ($search_company_alias) {
1309 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1311if ($search_parent_name !=
'') {
1312 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1314if ($search_ref_customer) {
1315 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1317if ($search_user > 0) {
1318 $param .=
'&search_user='.urlencode((
string) ($search_user));
1320if ($search_sale > 0) {
1321 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1323if ($search_total_ht !=
'') {
1324 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1326if ($search_total_vat !=
'') {
1327 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1329if ($search_total_ttc !=
'') {
1330 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1332if ($search_warehouse !=
'') {
1333 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
1336 $param .=
'&search_login='.urlencode($search_login);
1338if ($search_multicurrency_code !=
'') {
1339 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1341if ($search_multicurrency_tx !=
'') {
1342 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1344if ($search_multicurrency_montant_ht !=
'') {
1345 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1347if ($search_multicurrency_montant_vat !=
'') {
1348 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1350if ($search_multicurrency_montant_ttc !=
'') {
1351 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1353if ($search_project_ref >= 0) {
1354 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1356if ($search_town !=
'') {
1357 $param .=
'&search_town='.urlencode($search_town);
1359if ($search_zip !=
'') {
1360 $param .=
'&search_zip='.urlencode($search_zip);
1362if ($search_state !=
'') {
1363 $param .=
'&search_state='.urlencode($search_state);
1365if ($search_country !=
'') {
1366 $param .=
'&search_country='.urlencode((
string) ($search_country));
1368if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1369 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1371if ($search_product_category !=
'') {
1372 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1374if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1375 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1378 $param .=
'&show_files='.urlencode((
string) ($show_files));
1380if ($optioncss !=
'') {
1381 $param .=
'&optioncss='.urlencode($optioncss);
1383if ($search_billed !=
'') {
1384 $param .=
'&search_billed='.urlencode($search_billed);
1386if ($search_fk_cond_reglement > 0) {
1387 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1389if ($search_fk_shipping_method > 0) {
1390 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1392if ($search_fk_mode_reglement > 0) {
1393 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1395if ($search_fk_input_reason > 0) {
1396 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1400include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1403$parameters = array();
1404$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1405$param .= $hookmanager->resPrint;
1408$arrayofmassactions = array(
1409 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1410 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1412if ($permissiontovalidate) {
1413 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1415if ($permissiontoclose) {
1416 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1418if (isModEnabled(
'invoice') && $user->hasRight(
"facture",
"creer")) {
1419 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1421if ($permissiontoclose) {
1422 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1424if ($permissiontocancel) {
1425 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"CancelOrder");
1427if (!empty($permissiontodelete)) {
1428 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1430if ($permissiontosendbymail) {
1431 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1433if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1434 $arrayofmassactions = array();
1436$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1438$url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1439if (!empty($socid)) {
1440 $url .=
'&socid='.$socid;
1443$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'));
1444$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'));
1446$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', (
int) (($contextpage ==
'orderlist' || $contextpage ==
'billableorders') && $permissiontoadd));
1449print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1450if ($optioncss !=
'') {
1451 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1453print
'<input type="hidden" name="token" value="'.newToken().
'">';
1454print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1455print
'<input type="hidden" name="action" value="list">';
1456print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1457print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1458print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1459print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1460print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1461print
'<input type="hidden" name="page_y" value="">';
1462print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1465print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1467$topicmail =
"SendOrderRef";
1468$modelmail =
"order_send";
1470$trackid =
'ord'.$object->id;
1471include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1473if ($massaction ==
'prevalidate') {
1474 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1476if ($massaction ==
'preshipped') {
1477 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1480if ($massaction ==
'createbills') {
1481 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1483 print
'<table class="noborder centpercent">';
1486 print $langs->trans(
'DateInvoice');
1489 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1494 print $langs->trans(
'CreateOneBillByThird');
1497 print $form->selectyesno(
'createbills_onebythird',
getDolGlobalString(
'MAIN_ORDERLIST_CREATEBILLS_ONEBYTHIRD',
'no'), 1);
1502 print $langs->trans(
'ValidateInvoices');
1506 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
1507 $langs->load(
"errors");
1508 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1510 print $form->selectyesno(
'validate_invoices', 0, 1);
1512 if (!empty(
$conf->workflow->enabled) &&
getDolGlobalString(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1513 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1515 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1521 print
'<div class="center">';
1522 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1523 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1530 foreach ($fieldstosearchall as $key => $val) {
1531 $fieldstosearchall[$key] = $langs->trans($val);
1532 $setupstring .= $key.
"=".$val.
";";
1534 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1535 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1541if ($user->hasRight(
"user",
"user",
"lire")) {
1542 $langs->load(
"commercial");
1543 $moreforfilter .=
'<div class="divsearchfield">';
1544 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1545 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1546 $moreforfilter .=
'</div>';
1549if ($user->hasRight(
"user",
"user",
"lire")) {
1550 $moreforfilter .=
'<div class="divsearchfield">';
1551 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1552 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1553 $moreforfilter .=
'</div>';
1557if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1558 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1559 $moreforfilter .=
'<div class="divsearchfield">';
1560 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1561 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, array(), 1);
1562 $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);
1563 $moreforfilter .=
'</div>';
1566if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1567 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1568 $moreforfilter .=
'<div class="divsearchfield">';
1569 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1570 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1571 $moreforfilter .=
'</div>';
1574if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
1575 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1577 $moreforfilter .=
'<div class="divsearchfield">';
1578 $tmptitle = $langs->trans(
'Warehouse');
1579 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1580 $moreforfilter .=
'</div>';
1583$parameters = array();
1584$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1585if (empty($reshook)) {
1586 $moreforfilter .= $hookmanager->resPrint;
1588 $moreforfilter = $hookmanager->resPrint;
1591if (!empty($moreforfilter)) {
1592 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1593 print $moreforfilter;
1597$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1598$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1599$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1600$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1603 $selectedfields .=
'<script>';
1604 $selectedfields .=
' $(document).ready(function() {';
1605 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1606 $selectedfields .=
' $("#checkforselects").click();';
1607 $selectedfields .=
' $("#massaction").val("createbills").change();';
1608 $selectedfields .=
' });';
1609 $selectedfields .=
'</script>';
1612print
'<div class="div-table-responsive">';
1613print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1617print
'<tr class="liste_titre_filter">';
1620 print
'<td class="liste_titre center maxwidthsearch">';
1621 $searchpicto = $form->showFilterButtons(
'left');
1627if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1628 print
'<td class="liste_titre">';
1629 print
'<input class="flat" size="6" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1634if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1635 print
'<td class="liste_titre">';
1636 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1640if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1641 print
'<td class="liste_titre" align="left">';
1642 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1646if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1647 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1650if (!empty($arrayfields[
'p.title'][
'checked'])) {
1651 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1654if (!empty($arrayfields[
's.nom'][
'checked'])) {
1655 print
'<td class="liste_titre" align="left">';
1656 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1660if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1661 print
'<td class="liste_titre" align="left">';
1662 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1666if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1667 print
'<td class="liste_titre">';
1668 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1672if (!empty($arrayfields[
's.town'][
'checked'])) {
1673 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1676if (!empty($arrayfields[
's.zip'][
'checked'])) {
1677 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1680if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1681 print
'<td class="liste_titre">';
1682 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1686if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1687 print
'<td class="liste_titre" align="center">';
1688 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1692if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1693 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1694 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);
1698if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1699 print
'<td class="liste_titre center">';
1700 print
'<div class="nowrapfordate">';
1701 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1703 print
'<div class="nowrapfordate">';
1704 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1708if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1709 print
'<td class="liste_titre center">';
1710 print
'<div class="nowrapfordate">';
1711 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1713 print
'<div class="nowrapfordate">';
1714 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1719if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1720 print
'<td class="liste_titre">';
1721 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1725if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1726 print
'<td class="liste_titre">';
1727 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1731if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1732 print
'<td class="liste_titre">';
1733 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1737if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1738 print
'<td class="liste_titre">';
1739 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1743if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1744 print
'<td class="liste_titre right">';
1745 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1749if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1750 print
'<td class="liste_titre right">';
1751 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1755if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1756 print
'<td class="liste_titre right">';
1757 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1761if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1762 print
'<td class="liste_titre">';
1763 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1767if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1768 print
'<td class="liste_titre">';
1769 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1773if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1774 print
'<td class="liste_titre right">';
1775 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1779if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1780 print
'<td class="liste_titre right">';
1781 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1785if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1786 print
'<td class="liste_titre right">';
1787 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1791if (!empty($arrayfields[
'u.login'][
'checked'])) {
1792 print
'<td class="liste_titre">';
1793 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1797if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1798 print
'<td class="liste_titre"></td>';
1800if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1801 print
'<td class="liste_titre right">';
1804if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1805 print
'<td class="liste_titre right">';
1808if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1809 print
'<td class="liste_titre right">';
1812if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1813 print
'<td class="liste_titre right">';
1818if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1819 print
'<td class="liste_titre">';
1823if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1824 print
'<td class="liste_titre">';
1828if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1829 print
'<td class="liste_titre center">';
1830 print
'<div class="nowrapfordate">';
1831 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1833 print
'<div class="nowrapfordate">';
1834 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1839if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1840 print
'<td class="liste_titre">';
1844if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1845 print
'<td class="liste_titre">';
1849if (!empty($arrayfields[
'shippable'][
'checked'])) {
1850 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1853 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1854 print $langs->trans(
'ShowShippableStatus');
1856 $show_shippable_command = 1;
1862include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1865$parameters = array(
'arrayfields' => $arrayfields);
1866$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1867print $hookmanager->resPrint;
1870if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1871 print
'<td class="liste_titre maxwidthonsmartphone center">';
1872 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1877if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1878 print
'<td class="liste_titre maxwidthonsmartphone center">';
1883if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1884 print
'<td class="liste_titre center parentonrightofpage">';
1885 $liststatus = array(
1889 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1890 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1895 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1900 print
'<td class="liste_titre center maxwidthsearch">';
1901 $searchpicto = $form->showFilterButtons();
1920print
'<tr class="liste_titre">';
1924 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1925 $totalarray[
'nbfield']++;
1927if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1928 print_liste_field_titre($arrayfields[
'c.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'c.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1929 $totalarray[
'nbfield']++;
1931if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1932 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1933 $totalarray[
'nbfield']++;
1935if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1936 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1937 $totalarray[
'nbfield']++;
1939if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1940 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1941 $totalarray[
'nbfield']++;
1943if (!empty($arrayfields[
'p.title'][
'checked'])) {
1944 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1945 $totalarray[
'nbfield']++;
1947if (!empty($arrayfields[
's.nom'][
'checked'])) {
1948 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1949 $totalarray[
'nbfield']++;
1951if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1953 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1954 $totalarray[
'nbfield']++;
1956if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1957 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1958 $totalarray[
'nbfield']++;
1960if (!empty($arrayfields[
's.town'][
'checked'])) {
1961 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1962 $totalarray[
'nbfield']++;
1964if (!empty($arrayfields[
's.zip'][
'checked'])) {
1965 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1966 $totalarray[
'nbfield']++;
1968if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1969 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1970 $totalarray[
'nbfield']++;
1972if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1973 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1974 $totalarray[
'nbfield']++;
1976if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1977 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1978 $totalarray[
'nbfield']++;
1980if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1981 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1982 $totalarray[
'nbfield']++;
1984if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1985 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1986 $totalarray[
'nbfield']++;
1988if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1989 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1990 $totalarray[
'nbfield']++;
1992if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1993 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1994 $totalarray[
'nbfield']++;
1996if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1997 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1998 $totalarray[
'nbfield']++;
2000if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2001 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
2002 $totalarray[
'nbfield']++;
2004if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2005 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2006 $totalarray[
'nbfield']++;
2008if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2009 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2010 $totalarray[
'nbfield']++;
2012if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2013 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2014 $totalarray[
'nbfield']++;
2016if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2017 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2018 $totalarray[
'nbfield']++;
2020if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2021 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2022 $totalarray[
'nbfield']++;
2024if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2025 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
2026 $totalarray[
'nbfield']++;
2028if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2029 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
2030 $totalarray[
'nbfield']++;
2032if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2033 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
2034 $totalarray[
'nbfield']++;
2036if (!empty($arrayfields[
'u.login'][
'checked'])) {
2037 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
2038 $totalarray[
'nbfield']++;
2040if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2041 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2042 $totalarray[
'nbfield']++;
2044if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2045 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2046 $totalarray[
'nbfield']++;
2048if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2049 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2050 $totalarray[
'nbfield']++;
2052if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2053 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2054 $totalarray[
'nbfield']++;
2056if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2057 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2058 $totalarray[
'nbfield']++;
2061if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2062 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2063 $totalarray[
'nbfield']++;
2065if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2066 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2067 $totalarray[
'nbfield']++;
2069if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2070 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2071 $totalarray[
'nbfield']++;
2073if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2074 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
2075 $totalarray[
'nbfield']++;
2077if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2078 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
2079 $totalarray[
'nbfield']++;
2081if (!empty($arrayfields[
'shippable'][
'checked'])) {
2082 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
2083 $totalarray[
'nbfield']++;
2086include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2089$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2090$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2091print $hookmanager->resPrint;
2093if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2094 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
2095 $totalarray[
'nbfield']++;
2097if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2098 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2099 $totalarray[
'nbfield']++;
2101if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2102 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
2103 $totalarray[
'nbfield']++;
2107 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2108 $totalarray[
'nbfield']++;
2114$productstat_cache = array();
2115$productstat_cachevirtual = array();
2116$getNomUrl_cache = array();
2118$generic_commande =
new Commande($db);
2119$generic_product =
new Product($db);
2120$userstatic =
new User($db);
2122$with_margin_info =
false;
2123if (isModEnabled(
'margin') && (
2124 !empty($arrayfields[
'total_pa'][
'checked'])
2125 || !empty($arrayfields[
'total_margin'][
'checked'])
2126 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2127 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2130 $with_margin_info =
true;
2139$savnbfield = $totalarray[
'nbfield'];
2140$totalarray = array();
2141$totalarray[
'nbfield'] = 0;
2142$imaxinloop = ($limit ? min($num, $limit) : $num);
2143while ($i < $imaxinloop) {
2144 $obj = $db->fetch_object($resql);
2155 $companystatic->id = $obj->socid;
2156 $companystatic->name = $obj->name;
2157 $companystatic->name_alias = $obj->alias;
2158 $companystatic->client = $obj->client;
2159 $companystatic->fournisseur = $obj->fournisseur;
2160 $companystatic->code_client = $obj->code_client;
2161 $companystatic->email = $obj->email;
2162 $companystatic->phone = $obj->phone;
2163 $companystatic->address = $obj->address;
2164 $companystatic->zip = $obj->zip;
2165 $companystatic->town = $obj->town;
2166 $companystatic->country_code = $obj->country_code;
2167 if (!isset($getNomUrl_cache[$obj->socid])) {
2168 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2171 $generic_commande->id = $obj->rowid;
2172 $generic_commande->ref = $obj->ref;
2173 $generic_commande->statut = $obj->fk_statut;
2174 $generic_commande->billed = $obj->billed;
2175 $generic_commande->date = $db->jdate($obj->date_commande);
2176 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2177 $generic_commande->ref_client = $obj->ref_client;
2178 $generic_commande->total_ht = $obj->total_ht;
2179 $generic_commande->total_tva = $obj->total_tva;
2180 $generic_commande->total_ttc = $obj->total_ttc;
2181 $generic_commande->note_public = $obj->note_public;
2182 $generic_commande->note_private = $obj->note_private;
2184 $generic_commande->thirdparty = $companystatic;
2187 $projectstatic->id = $obj->project_id;
2188 $projectstatic->ref = $obj->project_ref;
2189 $projectstatic->title = $obj->project_label;
2191 $marginInfo = array();
2192 if ($with_margin_info) {
2193 $generic_commande->fetch_lines();
2194 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2195 $total_ht += $obj->total_ht;
2196 $total_margin += $marginInfo[
'total_margin'];
2199 if ($mode ==
'kanban') {
2201 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2202 print
'<div class="box-flex-container kanban">';
2207 if ($massactionbutton || $massaction) {
2209 if (in_array(
$object->id, $arrayofselected)) {
2213 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2214 if ($i == ($imaxinloop - 1)) {
2221 print
'<tr data-rowid="'.$object->id.
'" class="oddeven '.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->billed == 1) ?
'opacitymedium' :
'').
'">';
2225 print
'<td class="nowrap center">';
2226 if ($massactionbutton || $massaction) {
2228 if (in_array($obj->rowid, $arrayofselected)) {
2231 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2235 $totalarray[
'nbfield']++;
2240 if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
2241 print
'<td class="center" data-key="id">'.$obj->rowid.
'</td>';
2243 $totalarray[
'nbfield']++;
2248 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2249 print
'<td class="nowraponall">';
2250 $getNomUrlOption = $search_status != 2 ? 0 : $obj->fk_statut;
2256 $getNomUrlOption =
'';
2258 print $generic_commande->getNomUrl(1, $getNomUrlOption, 0, 0, 0, 1, 1);
2262 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2263 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2267 $totalarray[
'nbfield']++;
2272 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2273 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2277 $totalarray[
'nbfield']++;
2282 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2283 print
'<td class="nowrap">';
2284 if ($obj->project_id > 0) {
2285 print $projectstatic->getNomUrl(1);
2289 $totalarray[
'nbfield']++;
2294 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2295 print
'<td class="nowrap">';
2296 if ($obj->project_id > 0) {
2297 print $projectstatic->title;
2301 $totalarray[
'nbfield']++;
2306 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2307 print
'<td class="tdoverflowmax150">';
2309 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2311 print $getNomUrl_cache[$obj->socid];
2316 if ($user->hasRight(
'facture',
'creer')) {
2317 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2318 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2319 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2325 $totalarray[
'nbfield']++;
2330 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2331 print
'<td class="nocellnopadd tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->alias).
'">';
2335 $totalarray[
'nbfield']++;
2340 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2341 print
'<td class="tdoverflowmax200">';
2342 if ($obj->fk_parent > 0) {
2343 if (!isset($company_url_list[$obj->fk_parent])) {
2344 $companyparent =
new Societe($db);
2345 $res = $companyparent->fetch($obj->fk_parent);
2347 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2350 if (isset($company_url_list[$obj->fk_parent])) {
2351 print $company_url_list[$obj->fk_parent];
2356 $totalarray[
'nbfield']++;
2361 if (!empty($arrayfields[
's.town'][
'checked'])) {
2362 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->town).
'">';
2366 $totalarray[
'nbfield']++;
2371 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2372 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->zip).
'">';
2376 $totalarray[
'nbfield']++;
2381 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2382 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->state_name).
'">'.
dolPrintLabel($obj->state_name).
"</td>\n";
2384 $totalarray[
'nbfield']++;
2389 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2390 print
'<td class="center">';
2391 $tmparray =
getCountry($obj->fk_pays,
'all');
2392 print $tmparray[
'label'];
2395 $totalarray[
'nbfield']++;
2400 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2401 print
'<td class="center">';
2402 if (empty($typenArray)) {
2403 $typenArray = $formcompany->typent_array(1);
2405 print $typenArray[$obj->typent_code] ??
'';
2408 $totalarray[
'nbfield']++;
2413 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2414 print
'<td class="center nowraponall">';
2417 if ($generic_commande->hasDelay()) {
2418 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2422 $totalarray[
'nbfield']++;
2427 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2428 print
'<td class="center nowraponall">';
2429 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2432 $totalarray[
'nbfield']++;
2437 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2439 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2442 $totalarray[
'nbfield']++;
2447 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2449 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2452 $totalarray[
'nbfield']++;
2457 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2459 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2462 $totalarray[
'nbfield']++;
2467 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2469 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
2472 $totalarray[
'nbfield']++;
2477 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2478 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2480 $totalarray[
'nbfield']++;
2483 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2485 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2486 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2488 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2493 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2494 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2496 $totalarray[
'nbfield']++;
2499 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2501 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2502 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2504 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2509 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2510 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2512 $totalarray[
'nbfield']++;
2515 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2517 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2518 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2520 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2525 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2526 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2528 $totalarray[
'nbfield']++;
2533 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2534 print
'<td class="nowrap">';
2535 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2538 $totalarray[
'nbfield']++;
2543 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2544 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2546 $totalarray[
'nbfield']++;
2550 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2551 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2553 $totalarray[
'nbfield']++;
2557 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2558 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2560 $totalarray[
'nbfield']++;
2564 $userstatic->id = $obj->fk_user_author;
2565 $userstatic->login = $obj->login;
2566 $userstatic->lastname = $obj->lastname;
2567 $userstatic->firstname = $obj->firstname;
2568 $userstatic->email = $obj->user_email;
2569 $userstatic->status = $obj->user_statut;
2570 $userstatic->entity = $obj->entity;
2571 $userstatic->photo = $obj->photo;
2572 $userstatic->office_phone = $obj->office_phone;
2573 $userstatic->office_fax = $obj->office_fax;
2574 $userstatic->user_mobile = $obj->user_mobile;
2575 $userstatic->job = $obj->job;
2576 $userstatic->gender = $obj->gender;
2579 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2580 print
'<td class="tdoverflowmax125">';
2581 if ($userstatic->id) {
2582 print $userstatic->getNomUrl(-1);
2588 $totalarray[
'nbfield']++;
2593 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2595 if ($obj->socid > 0) {
2596 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2597 if ($listsalesrepresentatives < 0) {
2600 $nbofsalesrepresentative = count($listsalesrepresentatives);
2601 if ($nbofsalesrepresentative > 6) {
2603 print $nbofsalesrepresentative;
2604 } elseif ($nbofsalesrepresentative > 0) {
2606 foreach ($listsalesrepresentatives as $val) {
2607 $userstatic->id = $val[
'id'];
2608 $userstatic->lastname = $val[
'lastname'];
2609 $userstatic->firstname = $val[
'firstname'];
2610 $userstatic->email = $val[
'email'];
2611 $userstatic->status = $val[
'statut'];
2612 $userstatic->entity = $val[
'entity'];
2613 $userstatic->photo = $val[
'photo'];
2614 $userstatic->login = $val[
'login'];
2615 $userstatic->office_phone = $val[
'office_phone'];
2616 $userstatic->office_fax = $val[
'office_fax'];
2617 $userstatic->user_mobile = $val[
'user_mobile'];
2618 $userstatic->job = $val[
'job'];
2619 $userstatic->gender = $val[
'gender'];
2621 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2623 if ($j < $nbofsalesrepresentative) {
2635 $totalarray[
'nbfield']++;
2640 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2641 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2643 $totalarray[
'nbfield']++;
2648 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2649 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2651 $totalarray[
'nbfield']++;
2654 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2657 if (!isset($totalarray[
'val'][
'total_margin'])) {
2658 $totalarray[
'val'][
'total_margin'] = 0;
2661 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2665 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2666 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2668 $totalarray[
'nbfield']++;
2673 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2674 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2676 $totalarray[
'nbfield']++;
2679 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2681 if ($i >= $imaxinloop - 1) {
2682 if (!empty($total_ht)) {
2683 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2685 $totalarray[
'val'][
'total_mark_rate'] =
'';
2691 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2692 print
'<td align="center" class="nowrap">';
2693 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2696 $totalarray[
'nbfield']++;
2701 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2702 print
'<td align="center" class="nowrap">';
2703 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2706 $totalarray[
'nbfield']++;
2711 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2712 print
'<td align="center" class="nowrap">';
2713 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2716 $totalarray[
'nbfield']++;
2721 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2722 print
'<td class="sensiblehtmlcontent center">';
2726 $totalarray[
'nbfield']++;
2731 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2732 print
'<td class="sensiblehtmlcontent center">';
2736 $totalarray[
'nbfield']++;
2741 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2742 print
'<td class="center">';
2743 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2745 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2746 $generic_commande->getLinesArray();
2747 $generic_commande->loadExpeditions();
2749 $numlines = count($generic_commande->lines);
2750 for ($lig = 0; $lig < $numlines; $lig++) {
2751 $orderLine = $generic_commande->lines[$lig];
2752 '@phan-var-force OrderLine $orderLine';
2753 if (isset($generic_commande->expeditions[$orderLine->id])) {
2754 $reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id];
2756 $reliquat = $orderLine->qty;
2758 if ($orderLine->product_type == 0 && $orderLine->fk_product > 0) {
2760 $generic_product->id = $orderLine->fk_product;
2763 if (empty($productstat_cache[$orderLine->fk_product])) {
2764 $generic_product->load_stock(
'nobatch,warehouseopen');
2765 $productstat_cache[$orderLine->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2766 $productstat_cachevirtual[$orderLine->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2768 $generic_product->stock_reel = $productstat_cache[$orderLine->fk_product][
'stock_reel'];
2770 $generic_product->stock_theorique = $productstat_cachevirtual[$orderLine->fk_product][
'stock_reel'];
2773 if ($reliquat > $generic_product->stock_reel) {
2777 $text_info .= $reliquat.
' x '.$orderLine->product_ref.
' '.
dol_trunc($orderLine->product_label, 20);
2778 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2779 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2780 $text_info .= ($reliquat != $orderLine->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($orderLine->qty - $reliquat).
')</span>' :
'');
2781 $text_info .=
'<br>';
2788 $stock_order_supplier = 0;
2790 if (isModEnabled(
'order')) {
2791 if (empty($productstat_cache[$orderLine->fk_product][
'stats_order_customer'])) {
2792 $generic_product->load_stats_commande(0,
'1,2');
2793 $productstat_cache[$orderLine->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2796 $generic_product->stats_commande[
'qty'] = $productstat_cache[$orderLine->fk_product][
'stats_order_customer'];
2798 $stock_order = $generic_product->stats_commande[
'qty'];
2800 if (isModEnabled(
"supplier_order")) {
2801 if (empty($productstat_cache[$orderLine->fk_product][
'stats_order_supplier'])) {
2802 $generic_product->load_stats_commande_fournisseur(0,
'3');
2803 $productstat_cache[$orderLine->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2806 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$orderLine->fk_product][
'stats_order_supplier'];
2808 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2811 $text_info .= $reliquat.
' x '.$orderLine->ref.
' '.
dol_trunc($orderLine->product_label, 20);
2812 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2813 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $orderLine->qty)) {
2815 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2817 if ($reliquat > $generic_product->stock_reel) {
2818 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2820 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2822 if (isModEnabled(
"supplier_order")) {
2823 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2825 $text_info .= ($reliquat != $orderLine->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($orderLine->qty - $reliquat).
')</span>' :
'');
2826 $text_info .=
'<br>';
2830 if ($notshippable == 0) {
2831 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'green paddingleft');
2832 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2834 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'error paddingleft');
2835 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2840 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2843 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2848 $totalarray[
'nbfield']++;
2853 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2855 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2856 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2857 print $hookmanager->resPrint;
2860 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2861 print
'<td class="center">';
2863 print
yn($obj->billed, $langs->trans(
"Billed"));
2867 $totalarray[
'nbfield']++;
2872 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2873 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2875 $totalarray[
'nbfield']++;
2880 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2881 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2883 $totalarray[
'nbfield']++;
2889 print
'<td class="nowrap center">';
2890 if ($massactionbutton || $massaction) {
2892 if (in_array($obj->rowid, $arrayofselected)) {
2895 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2899 $totalarray[
'nbfield']++;
2905 $total += $obj->total_ht;
2906 $subtotal += $obj->total_ht;
2912include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2917 foreach ($arrayfields as $key => $val) {
2918 if (!empty($val[
'checked'])) {
2922 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2927$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2928$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2929print $hookmanager->resPrint;
2931print
'</table>'.
"\n";
2934print
'</form>'.
"\n";
2936if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2937 $hidegeneratedfilelistifempty = 1;
2938 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2939 $hidegeneratedfilelistifempty = 0;
2943 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2944 $urlsource .= str_replace(
'&',
'&', $param);
2946 $filedir = $diroutputmassaction;
2947 $genallowed = $permissiontoread;
2948 $delallowed = $permissiontoadd;
2950 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
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage absolute discounts.
Class to manage invoices.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dolPrintLabel($s)
Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.