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';
59$langs->loadLangs(array(
'orders',
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
62$action =
GETPOST(
'action',
'aZ09');
63$massaction =
GETPOST(
'massaction',
'alpha');
65$confirm =
GETPOST(
'confirm',
'alpha');
66$toselect =
GETPOST(
'toselect',
'array');
67$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlist';
68$optioncss =
GETPOST(
'optioncss',
'alpha');
69$mode =
GETPOST(
'mode',
'alpha');
72 $userschilds = $user->getAllChildIds();
76$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
77if (empty($search_datecloture_start)) {
80$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
81if (empty($search_datecloture_end)) {
91$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
92$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
93$search_id =
GETPOST(
'search_id',
'int');
94$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
95$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
96$search_company =
GETPOST(
'search_company',
'alpha');
97$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
98$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
99$search_town =
GETPOST(
'search_town',
'alpha');
100$search_zip =
GETPOST(
'search_zip',
'alpha');
101$search_state =
GETPOST(
'search_state',
'alpha');
102$search_country =
GETPOST(
'search_country',
'aZ09');
103$search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'intcomma');
104$search_user =
GETPOST(
'search_user',
'intcomma');
105$search_sale =
GETPOST(
'search_sale',
'intcomma');
106$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
107$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
108$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
109$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
111$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
112$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
113$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
114$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
115$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
117$search_login =
GETPOST(
'search_login',
'alpha');
118$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
119$search_billed =
GETPOST(
'search_billed',
'intcomma');
120$search_status =
GETPOST(
'search_status',
'intcomma');
121$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
122$search_project =
GETPOST(
'search_project',
'alpha');
123$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
125$search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'intcomma');
126$search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'intcomma');
127$search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'intcomma');
128$search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'intcomma');
130$search_option =
GETPOST(
'search_option',
'alpha');
131if ($search_option ==
'late') {
132 $search_status =
'-2';
135$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
139$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
140$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
142if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
146$offset = $limit * $page;
147$pageprev = $page - 1;
148$pagenext = $page + 1;
150 $sortfield =
'c.ref';
156$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
160$hookmanager->initHooks(array(
'orderlist'));
164$extrafields->fetch_name_optionals_label(
$object->table_element);
165$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
168$fieldstosearchall = array(
170 'c.ref_client' =>
'RefCustomerOrder',
171 'pd.description' =>
'Description',
172 's.nom' =>
"ThirdParty",
173 's.name_alias' =>
"AliasNameShort",
176 'c.note_public' =>
'NotePublic',
178if (empty($user->socid)) {
179 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
182$checkedtypetiers = 0;
184 'c.rowid' => array(
'label' =>
"ID",
'checked' => 1,
'enabled' =>
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 1),
185 'c.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5,
'searchall' => 1),
186 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' => -1,
'position' => 10,
'searchall' => 1),
187 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => -1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 20),
188 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 25),
189 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 30,
'searchall' => 1),
190 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 31,
'searchall' => 1),
191 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
192 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 35,
'searchall' => 1),
193 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 40,
'searchall' => 1),
194 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 45),
195 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 50),
196 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 55),
197 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' => 1,
'position' => 60,
'csslist' =>
'nowraponall'),
198 'c.date_delivery' => array(
'label' =>
"DateDeliveryPlanned",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65,
'csslist' =>
'nowraponall'),
199 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => -1,
'position' => 66 ,
'enabled' => isModEnabled(
"shipping")),
200 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => -1,
'position' => 67),
201 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => -1,
'position' => 68),
202 'c.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => -1,
'position' => 69),
203 'c.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 75),
204 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 80),
205 'c.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 85),
206 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 90),
207 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 95),
208 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 100),
209 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 105),
210 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 110),
211 'u.login' => array(
'label' =>
"Author",
'checked' => 1,
'position' => 115),
212 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 116),
213 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
214 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
215 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
216 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
217 'c.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 120),
218 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 125),
219 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 130),
220 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 135,
'searchall' => 1),
221 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 140),
222 'shippable' => array(
'label' =>
"Shippable",
'checked' => 1,
'enabled' => (isModEnabled(
"shipping")),
'position' => 990),
223 'c.facture' => array(
'label' =>
"Billed",
'checked' => 1,
'enabled' => (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
224 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
225 'c.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000)
228$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
229$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
231 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
232} elseif ($reshook == 0) {
233 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
237include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
242'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
248 $socid = $user->socid;
251$permissiontoreadallthirdparty = $user->hasRight(
'societe',
'client',
'voir');
263if (
GETPOST(
'cancel',
'alpha')) {
267if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
271$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
272$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
277if (empty($reshook)) {
279 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
282 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
285 $search_product_category =
'';
288 $search_ref_customer =
'';
289 $search_company =
'';
290 $search_company_alias =
'';
291 $search_parent_name =
'';
296 $search_country =
'';
297 $search_type_thirdparty =
'';
298 $search_total_ht =
'';
299 $search_total_vat =
'';
300 $search_total_ttc =
'';
301 $search_warehouse =
'';
302 $search_multicurrency_code =
'';
303 $search_multicurrency_tx =
'';
304 $search_multicurrency_montant_ht =
'';
305 $search_multicurrency_montant_vat =
'';
306 $search_multicurrency_montant_ttc =
'';
308 $search_dateorder_start =
'';
309 $search_dateorder_end =
'';
310 $search_datedelivery_start =
'';
311 $search_datedelivery_end =
'';
312 $search_project_ref =
'';
313 $search_project =
'';
317 $search_array_options = array();
318 $search_categ_cus = 0;
319 $search_datecloture_start =
'';
320 $search_datecloture_end =
'';
321 $search_fk_cond_reglement =
'';
322 $search_fk_shipping_method =
'';
323 $search_fk_mode_reglement =
'';
324 $search_fk_input_reason =
'';
327 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
328 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
333 $objectclass =
'Commande';
334 $objectlabel =
'Orders';
335 $permissiontoread = $user->hasRight(
"commande",
"lire");
336 $permissiontoadd = $user->hasRight(
"commande",
"creer");
337 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
339 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
340 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
341 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
342 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
344 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
345 $permissiontoclose = $user->hasRight(
"commande",
"creer");
346 $permissiontocancel = $user->hasRight(
"commande",
"creer");
347 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
349 $uploaddir = $conf->commande->multidir_output[$conf->entity];
350 $triggersendname =
'ORDER_SENTBYMAIL';
353 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
355 if ($massaction ==
'confirm_createbills') {
356 $orders =
GETPOST(
'toselect',
'array');
357 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
358 $validate_invoices =
GETPOSTINT(
'validate_invoices');
363 $TFactThird = array();
364 $TFactThirdNbLines = array();
366 $nb_bills_created = 0;
372 $nbOrders = is_array($orders) ? count($orders) : 1;
374 foreach ($orders as $id_order) {
376 if ($cmd->fetch($id_order) <= 0) {
379 $cmd->fetch_thirdparty();
382 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
384 $objecttmp = $TFactThird[$cmd->socid];
387 $objecttmp->socid = $cmd->socid;
388 $objecttmp->thirdparty = $cmd->thirdparty;
390 $objecttmp->type = $objecttmp::TYPE_STANDARD;
391 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
392 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
394 $objecttmp->fk_project = $cmd->fk_project;
395 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
396 if (empty($createbills_onebythird)) {
397 $objecttmp->ref_client = $cmd->ref_client;
401 if (empty($datefacture)) {
405 $objecttmp->date = $datefacture;
406 $objecttmp->origin =
'commande';
407 $objecttmp->origin_id = $id_order;
409 $objecttmp->array_options = $cmd->array_options;
411 $res = $objecttmp->create($user);
415 $lastref = $objecttmp->ref;
416 $lastid = $objecttmp->id;
418 $TFactThird[$cmd->socid] = $objecttmp;
419 $TFactThirdNbLines[$cmd->socid] = 0;
421 $langs->load(
"errors");
422 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
427 if ($objecttmp->id > 0) {
428 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
431 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
436 $lines = $cmd->lines;
437 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
439 $lines = $cmd->lines;
443 $num = count($lines);
445 for ($i = 0; $i < $num; $i++) {
446 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
448 if (!empty($createbills_onebythird)) {
452 if ($lines[$i]->subprice < 0 && !
getDolGlobalString(
'INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
455 $discount->fk_soc = $objecttmp->socid;
456 $discount->socid = $objecttmp->socid;
457 $discount->amount_ht = abs($lines[$i]->total_ht);
458 $discount->amount_tva = abs($lines[$i]->total_tva);
459 $discount->amount_ttc = abs($lines[$i]->total_ttc);
460 $discount->tva_tx = $lines[$i]->tva_tx;
461 $discount->fk_user = $user->id;
462 $discount->description = $desc;
463 $discountid = $discount->create($user);
464 if ($discountid > 0) {
465 $result = $objecttmp->insert_discount($discountid);
474 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
477 if ($lines[$i]->date_debut_prevue) {
478 $date_start = $lines[$i]->date_debut_prevue;
480 if ($lines[$i]->date_debut_reel) {
481 $date_start = $lines[$i]->date_debut_reel;
483 if ($lines[$i]->date_start) {
484 $date_start = $lines[$i]->date_start;
488 if ($lines[$i]->date_fin_prevue) {
489 $date_end = $lines[$i]->date_fin_prevue;
491 if ($lines[$i]->date_fin_reel) {
492 $date_end = $lines[$i]->date_fin_reel;
494 if ($lines[$i]->date_end) {
495 $date_end = $lines[$i]->date_end;
498 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
503 if (method_exists($lines[$i],
'fetch_optionals')) {
504 $lines[$i]->fetch_optionals();
505 $array_options = $lines[$i]->array_options;
508 $objecttmp->context[
'createfromclone'] =
'createfromclone';
510 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
512 if (!empty($createbills_onebythird)) {
513 $TFactThirdNbLines[$cmd->socid]++;
514 $rang = $TFactThirdNbLines[$cmd->socid];
517 $result = $objecttmp->addline(
519 $lines[$i]->subprice,
522 $lines[$i]->localtax1_tx,
523 $lines[$i]->localtax2_tx,
524 $lines[$i]->fk_product,
525 $lines[$i]->remise_percent,
529 $lines[$i]->info_bits,
530 $lines[$i]->fk_remise_except,
535 $lines[$i]->special_code,
539 $lines[$i]->fk_fournprice,
552 $errors[] = $objecttmp->error;
556 if ($result > 0 && $lines[$i]->product_type == 9) {
557 $fk_parent_line = $result;
566 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
567 $TFactThird[$cmd->socid] = $objecttmp;
569 $TFact[$objecttmp->id] = $objecttmp;
574 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
577 if (!$error && $validate_invoices) {
578 $massaction = $action =
'builddoc';
580 foreach ($TAllFact as &$objecttmp) {
581 $result = $objecttmp->validate($user);
588 $id = $objecttmp->id;
592 $upload_dir = $conf->facture->dir_output;
593 $permissiontoadd = $user->hasRight(
'facture',
'creer');
598 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
602 $massaction = $action =
'confirm_createbills';
608 if ($nb_bills_created == 1) {
609 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_ONE') == 1) {
611 header(
'Location: '.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) $lastid));
614 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
615 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
618 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_MANY') == 1) {
620 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills');
623 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
629 $param .=
'&mode='.urlencode($mode);
631 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
632 $param .=
'&contextpage='.urlencode($contextpage);
634 if ($limit > 0 && $limit != $conf->liste_limit) {
635 $param .=
'&limit='.((int) $limit);
637 if ($optioncss !=
'') {
638 $param .=
'&optioncss='.urlencode($optioncss);
641 $param .=
'&search_all='.urlencode($search_all);
644 $param .=
'&show_files='.urlencode((
string) ($show_files));
647 $param .=
'&socid='.urlencode((
string) ($socid));
649 if ($search_status !=
'') {
650 $param .=
'&search_status='.urlencode($search_status);
652 if ($search_option) {
653 $param .=
"&search_option=".urlencode($search_option);
655 if ($search_orderday) {
656 $param .=
'&search_orderday='.urlencode($search_orderday);
658 if ($search_ordermonth) {
659 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
661 if ($search_orderyear) {
662 $param .=
'&search_orderyear='.urlencode($search_orderyear);
664 if ($search_deliveryday) {
665 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
667 if ($search_deliverymonth) {
668 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
670 if ($search_deliveryyear) {
671 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
674 $param .=
'&search_id='.urlencode((
string) $search_id);
677 $param .=
'&search_ref='.urlencode($search_ref);
679 if ($search_company) {
680 $param .=
'&search_company='.urlencode($search_company);
682 if ($search_ref_customer) {
683 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
685 if ($search_user > 0) {
686 $param .=
'&search_user='.urlencode((
string) ($search_user));
688 if ($search_sale > 0) {
689 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
691 if ($search_total_ht !=
'') {
692 $param .=
'&search_total_ht='.urlencode($search_total_ht);
694 if ($search_total_vat !=
'') {
695 $param .=
'&search_total_vat='.urlencode($search_total_vat);
697 if ($search_total_ttc !=
'') {
698 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
700 if ($search_project_ref >= 0) {
701 $param .=
"&search_project_ref=".urlencode($search_project_ref);
703 if ($search_billed !=
'') {
704 $param .=
'&search_billed='.urlencode($search_billed);
707 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
713 $_GET[
"origin"] = $_POST[
"origin"];
714 $_GET[
"originid"] = $_POST[
"originid"];
715 if (!empty($errors)) {
724if ($action ==
'validate' && $permissiontoadd) {
725 if (
GETPOST(
'confirm') ==
'yes') {
726 $objecttmp =
new $objectclass($db);
729 foreach ($toselect as $checked) {
730 if ($objecttmp->fetch($checked)) {
731 if ($objecttmp->statut == 0) {
732 if (!empty($objecttmp->fk_warehouse)) {
733 $idwarehouse = $objecttmp->fk_warehouse;
737 if ($objecttmp->valid($user, $idwarehouse)) {
738 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
744 $langs->load(
"errors");
745 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
760if ($action ==
'shipped' && $permissiontoadd) {
761 if (
GETPOST(
'confirm') ==
'yes') {
762 $objecttmp =
new $objectclass($db);
765 foreach ($toselect as $checked) {
766 if ($objecttmp->fetch($checked)) {
767 if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
768 if ($objecttmp->cloture($user)) {
769 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
771 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
775 $langs->load(
"errors");
776 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
793if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
796 $objecttmp =
new $objectclass($db);
798 foreach ($toselect as $toselectid) {
799 $result = $objecttmp->fetch($toselectid);
801 $result = $objecttmp->classifyBilled($user, 0);
829$form =
new Form($db);
833if (isModEnabled(
'margin')) {
836$companystatic =
new Societe($db);
837$company_url_list = array();
839$projectstatic =
new Project($db);
843$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
844$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
846$title = $langs->trans(
"Orders");
847$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
853 $sql =
'SELECT DISTINCT';
855$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,';
856$sql .=
" s.parent as fk_parent,";
857$sql .=
" s2.nom as name2,";
858$sql .=
" typent.code as typent_code,";
859$sql .=
" state.code_departement as state_code, state.nom as state_name,";
860$sql .=
" country.code as country_code,";
861$sql .=
' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
862$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,';
863$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,';
864$sql .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
865$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
866$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,';
867$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
868$sql .=
' c.fk_input_reason, c.import_key';
871if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
872 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
873 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
878$parameters = array();
879$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
880$sql .= $hookmanager->resPrint;
881$sql = preg_replace(
'/,\s*$/',
'', $sql);
885$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
886$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
887$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
888$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
889$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
890$sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
891if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
892 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
895 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
897$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
898$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
900$parameters = array();
901$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
902$sql .= $hookmanager->resPrint;
904$sql .=
' WHERE c.fk_soc = s.rowid';
905$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
907 $sql .=
' AND s.rowid = '.((int) $socid);
911if (!$permissiontoreadallthirdparty) {
912 $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).
")";
914 $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)).
"))";
925if ($search_ref_customer) {
929 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
931if ($search_billed !=
'' && $search_billed >= 0) {
932 $sql .=
' AND c.facture = '.((int) $search_billed);
934if ($search_status !=
'') {
935 if ($search_status <= 3 && $search_status >= -1) {
936 if ($search_status == 1 && !isModEnabled(
'shipping')) {
937 $sql .=
' AND c.fk_statut IN (1,2)';
939 $sql .=
' AND c.fk_statut = '.((int) $search_status);
942 if ($search_status == -2) {
944 $sql .=
" AND (c.fk_statut IN (1,2))";
946 if ($search_status == -3) {
949 $sql .=
' AND (c.fk_statut IN (1,2,3))';
952if ($search_option ==
'late') {
953 $sql .=
" AND c.date_commande < '".$db->idate(
dol_now() - $conf->commande->client->warning_delay).
"'";
955if ($search_datecloture_start) {
956 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
958if ($search_datecloture_end) {
959 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
961if ($search_dateorder_start) {
962 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
964if ($search_dateorder_end) {
965 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
967if ($search_datedelivery_start) {
968 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
970if ($search_datedelivery_end) {
971 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
982if ($search_country) {
983 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
985if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
986 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
988if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
989 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
991 if ($search_company) {
994 if ($search_company_alias) {
998if ($search_parent_name) {
1001if ($search_total_ht !=
'') {
1004if ($search_total_vat !=
'') {
1007if ($search_total_ttc !=
'') {
1010if ($search_warehouse !=
'' && $search_warehouse > 0) {
1013if ($search_multicurrency_code !=
'') {
1014 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
1016if ($search_multicurrency_tx !=
'') {
1017 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
1019if ($search_multicurrency_montant_ht !=
'') {
1020 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
1022if ($search_multicurrency_montant_vat !=
'') {
1023 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
1025if ($search_multicurrency_montant_ttc !=
'') {
1026 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1029 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
1031if ($search_project_ref !=
'') {
1034if ($search_project !=
'') {
1037if ($search_fk_cond_reglement > 0) {
1038 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1040if ($search_fk_shipping_method > 0) {
1041 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1043if ($search_fk_mode_reglement > 0) {
1044 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1046if ($search_fk_input_reason > 0) {
1047 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1050if ($search_user > 0) {
1051 $sql .=
" AND EXISTS (";
1052 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1053 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1054 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1055 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal'";
1056 $sql .=
" WHERE ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1059if ($search_sale && $search_sale !=
'-1') {
1060 if ($search_sale == -2) {
1061 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
1062 } elseif ($search_sale > 0) {
1063 $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).
")";
1067$searchCategoryCustomerOperator = -1;
1068$searchCategoryCustomerList = array($search_categ_cus);
1069if (!empty($searchCategoryCustomerList)) {
1070 $searchCategoryCustomerSqlList = array();
1071 $listofcategoryid =
'';
1072 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1073 if (intval($searchCategoryCustomer) == -2) {
1074 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
1075 } elseif (intval($searchCategoryCustomer) > 0) {
1076 if ($searchCategoryCustomerOperator == 0) {
1077 $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).
")";
1079 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1083 if ($listofcategoryid) {
1084 $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).
"))";
1086 if ($searchCategoryCustomerOperator == 1) {
1087 if (!empty($searchCategoryCustomerSqlList)) {
1088 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1091 if (!empty($searchCategoryCustomerSqlList)) {
1092 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1097$searchCategoryProductOperator = -1;
1098$searchCategoryProductList = array($search_product_category);
1099if (!empty($searchCategoryProductList)) {
1100 $searchCategoryProductSqlList = array();
1101 $listofcategoryid =
'';
1102 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1103 if (intval($searchCategoryProduct) == -2) {
1104 $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)";
1105 } elseif (intval($searchCategoryProduct) > 0) {
1106 if ($searchCategoryProductOperator == 0) {
1107 $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).
")";
1109 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1113 if ($listofcategoryid) {
1114 $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).
"))";
1116 if ($searchCategoryProductOperator == 1) {
1117 if (!empty($searchCategoryProductSqlList)) {
1118 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1121 if (!empty($searchCategoryProductSqlList)) {
1122 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1127include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1129$parameters = array();
1130$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1131$sql .= $hookmanager->resPrint;
1134$parameters = array();
1135$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1136$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1140$nbtotalofrecords =
'';
1143 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1144 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1145 $resql = $db->query($sqlforcount);
1147 $objforcount = $db->fetch_object($resql);
1148 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1153 if (($page * $limit) > $nbtotalofrecords) {
1160$sql .= $db->order($sortfield, $sortorder);
1162 $sql .= $db->plimit($limit + 1, $offset);
1166$resql = $db->query($sql);
1174 $soc->fetch($socid);
1175 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1176 if (empty($search_company)) {
1177 $search_company = $soc->name;
1180 $title = $langs->trans(
'CustomersOrders');
1182if (strval($search_status) ==
'0') {
1183 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1185if ($search_status == 1) {
1186 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1188if ($search_status == 2) {
1189 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1191if ($search_status == 3) {
1192 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1194if ($search_status == -1) {
1195 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1197if ($search_status == -2) {
1198 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1200if ($search_status == -3) {
1201 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1203if ($search_status == -4) {
1204 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1207$num = $db->num_rows($resql);
1209$arrayofselected = is_array($toselect) ? $toselect : array();
1211if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1212 $obj = $db->fetch_object($resql);
1214 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
1221llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-order page-list');
1223$arrayofselected = is_array($toselect) ? $toselect : array();
1227 $param .=
'&mode='.urlencode($mode);
1229if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1230 $param .=
'&contextpage='.urlencode($contextpage);
1232if ($limit > 0 && $limit != $conf->liste_limit) {
1233 $param .=
'&limit='.((int) $limit);
1236 $param .=
'&search_all='.urlencode($search_all);
1239 $param .=
'&socid='.((int) $socid);
1241if ($search_status !=
'') {
1242 $param .=
'&search_status='.urlencode($search_status);
1244if ($search_option) {
1245 $param .=
"&search_option=".urlencode($search_option);
1247if ($search_datecloture_start) {
1248 $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');
1250if ($search_datecloture_end) {
1251 $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');
1253if ($search_dateorder_start) {
1254 $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');
1256if ($search_dateorder_end) {
1257 $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');
1259if ($search_datedelivery_start) {
1260 $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');
1262if ($search_datedelivery_end) {
1263 $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');
1266 $param .=
'&search_id='.urlencode((
string) $search_id);
1269 $param .=
'&search_ref='.urlencode($search_ref);
1271if ($search_company) {
1272 $param .=
'&search_company='.urlencode($search_company);
1274if ($search_company_alias) {
1275 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1277if ($search_parent_name !=
'') {
1278 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1280if ($search_ref_customer) {
1281 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1283if ($search_user > 0) {
1284 $param .=
'&search_user='.urlencode((
string) ($search_user));
1286if ($search_sale > 0) {
1287 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1289if ($search_total_ht !=
'') {
1290 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1292if ($search_total_vat !=
'') {
1293 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1295if ($search_total_ttc !=
'') {
1296 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1298if ($search_warehouse !=
'') {
1299 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
1302 $param .=
'&search_login='.urlencode($search_login);
1304if ($search_multicurrency_code !=
'') {
1305 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1307if ($search_multicurrency_tx !=
'') {
1308 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1310if ($search_multicurrency_montant_ht !=
'') {
1311 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1313if ($search_multicurrency_montant_vat !=
'') {
1314 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1316if ($search_multicurrency_montant_ttc !=
'') {
1317 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1319if ($search_project_ref >= 0) {
1320 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1322if ($search_town !=
'') {
1323 $param .=
'&search_town='.urlencode($search_town);
1325if ($search_zip !=
'') {
1326 $param .=
'&search_zip='.urlencode($search_zip);
1328if ($search_state !=
'') {
1329 $param .=
'&search_state='.urlencode($search_state);
1331if ($search_country !=
'') {
1332 $param .=
'&search_country='.urlencode((
string) ($search_country));
1334if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1335 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1337if ($search_product_category !=
'') {
1338 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1340if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1341 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1344 $param .=
'&show_files='.urlencode((
string) ($show_files));
1346if ($optioncss !=
'') {
1347 $param .=
'&optioncss='.urlencode($optioncss);
1349if ($search_billed !=
'') {
1350 $param .=
'&search_billed='.urlencode($search_billed);
1352if ($search_fk_cond_reglement > 0) {
1353 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1355if ($search_fk_shipping_method > 0) {
1356 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1358if ($search_fk_mode_reglement > 0) {
1359 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1361if ($search_fk_input_reason > 0) {
1362 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1366include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1369$parameters = array();
1370$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1371$param .= $hookmanager->resPrint;
1374$arrayofmassactions = array(
1375 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1376 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1378if ($permissiontovalidate) {
1379 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1381if ($permissiontoclose) {
1382 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1384if (isModEnabled(
'invoice') && $user->hasRight(
"facture",
"creer")) {
1385 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1387if ($permissiontoclose) {
1388 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1390if ($permissiontocancel) {
1391 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"CancelOrder");
1393if (!empty($permissiontodelete)) {
1394 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1396if ($permissiontosendbymail) {
1397 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1399if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1400 $arrayofmassactions = array();
1402$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1404$url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1405if (!empty($socid)) {
1406 $url .=
'&socid='.$socid;
1409$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'));
1410$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'));
1412$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', ($contextpage ==
'orderlist' || $contextpage ==
'billableorders') && $permissiontoadd);
1415print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1416if ($optioncss !=
'') {
1417 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1419print
'<input type="hidden" name="token" value="'.newToken().
'">';
1420print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1421print
'<input type="hidden" name="action" value="list">';
1422print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1423print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1424print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1425print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1426print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1427print
'<input type="hidden" name="page_y" value="">';
1428print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1431print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1433$topicmail =
"SendOrderRef";
1434$modelmail =
"order_send";
1436$trackid =
'ord'.$object->id;
1437include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1439if ($massaction ==
'prevalidate') {
1440 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1442if ($massaction ==
'preshipped') {
1443 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1446if ($massaction ==
'createbills') {
1447 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1449 print
'<table class="noborder centpercent">';
1452 print $langs->trans(
'DateInvoice');
1455 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1460 print $langs->trans(
'CreateOneBillByThird');
1463 print $form->selectyesno(
'createbills_onebythird',
getDolGlobalString(
'MAIN_ORDERLIST_CREATEBILLS_ONEBYTHIRD',
'no'), 1);
1468 print $langs->trans(
'ValidateInvoices');
1472 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
1473 $langs->load(
"errors");
1474 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1476 print $form->selectyesno(
'validate_invoices', 0, 1);
1478 if (!empty($conf->workflow->enabled) &&
getDolGlobalString(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1479 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1481 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1487 print
'<div class="center">';
1488 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1489 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1496 foreach ($fieldstosearchall as $key => $val) {
1497 $fieldstosearchall[$key] = $langs->trans($val);
1498 $setupstring .= $key.
"=".$val.
";";
1500 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1501 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1507if ($user->hasRight(
"user",
"user",
"lire")) {
1508 $langs->load(
"commercial");
1509 $moreforfilter .=
'<div class="divsearchfield">';
1510 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1511 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1512 $moreforfilter .=
'</div>';
1515if ($user->hasRight(
"user",
"user",
"lire")) {
1516 $moreforfilter .=
'<div class="divsearchfield">';
1517 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1518 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1519 $moreforfilter .=
'</div>';
1523if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1524 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1525 $moreforfilter .=
'<div class="divsearchfield">';
1526 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1527 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1528 $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);
1529 $moreforfilter .=
'</div>';
1532if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1533 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1534 $moreforfilter .=
'<div class="divsearchfield">';
1535 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1536 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1537 $moreforfilter .=
'</div>';
1540if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
1541 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1543 $moreforfilter .=
'<div class="divsearchfield">';
1544 $tmptitle = $langs->trans(
'Warehouse');
1545 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1546 $moreforfilter .=
'</div>';
1549$parameters = array();
1550$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1551if (empty($reshook)) {
1552 $moreforfilter .= $hookmanager->resPrint;
1554 $moreforfilter = $hookmanager->resPrint;
1557if (!empty($moreforfilter)) {
1558 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1559 print $moreforfilter;
1563$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1564$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1565$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1566$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1569 $selectedfields .=
'<script>';
1570 $selectedfields .=
' $(document).ready(function() {';
1571 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1572 $selectedfields .=
' $("#checkforselects").click();';
1573 $selectedfields .=
' $("#massaction").val("createbills").change();';
1574 $selectedfields .=
' });';
1575 $selectedfields .=
'</script>';
1578print
'<div class="div-table-responsive">';
1579print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1583print
'<tr class="liste_titre_filter">';
1586 print
'<td class="liste_titre center maxwidthsearch">';
1587 $searchpicto = $form->showFilterButtons(
'left');
1593if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1594 print
'<td class="liste_titre">';
1595 print
'<input class="flat" size="6" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1600if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1601 print
'<td class="liste_titre">';
1602 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1606if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1607 print
'<td class="liste_titre" align="left">';
1608 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1612if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1613 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1616if (!empty($arrayfields[
'p.title'][
'checked'])) {
1617 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1620if (!empty($arrayfields[
's.nom'][
'checked'])) {
1621 print
'<td class="liste_titre" align="left">';
1622 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1626if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1627 print
'<td class="liste_titre" align="left">';
1628 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1632if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1633 print
'<td class="liste_titre">';
1634 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1638if (!empty($arrayfields[
's.town'][
'checked'])) {
1639 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1642if (!empty($arrayfields[
's.zip'][
'checked'])) {
1643 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1646if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1647 print
'<td class="liste_titre">';
1648 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1652if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1653 print
'<td class="liste_titre" align="center">';
1654 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1658if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1659 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1660 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);
1664if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1665 print
'<td class="liste_titre center">';
1666 print
'<div class="nowrapfordate">';
1667 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1669 print
'<div class="nowrapfordate">';
1670 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1674if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1675 print
'<td class="liste_titre center">';
1676 print
'<div class="nowrapfordate">';
1677 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1679 print
'<div class="nowrapfordate">';
1680 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1685if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1686 print
'<td class="liste_titre">';
1687 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1691if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1692 print
'<td class="liste_titre">';
1693 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1697if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1698 print
'<td class="liste_titre">';
1699 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1703if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1704 print
'<td class="liste_titre">';
1705 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1709if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1710 print
'<td class="liste_titre right">';
1711 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1715if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1716 print
'<td class="liste_titre right">';
1717 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1721if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1722 print
'<td class="liste_titre right">';
1723 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1727if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1728 print
'<td class="liste_titre">';
1729 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1733if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1734 print
'<td class="liste_titre">';
1735 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1739if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1740 print
'<td class="liste_titre right">';
1741 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1745if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1746 print
'<td class="liste_titre right">';
1747 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1751if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1752 print
'<td class="liste_titre right">';
1753 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1757if (!empty($arrayfields[
'u.login'][
'checked'])) {
1758 print
'<td class="liste_titre">';
1759 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1763if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1764 print
'<td class="liste_titre"></td>';
1766if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1767 print
'<td class="liste_titre right">';
1770if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1771 print
'<td class="liste_titre right">';
1774if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1775 print
'<td class="liste_titre right">';
1778if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1779 print
'<td class="liste_titre right">';
1784if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1785 print
'<td class="liste_titre">';
1789if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1790 print
'<td class="liste_titre">';
1794if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1795 print
'<td class="liste_titre center">';
1796 print
'<div class="nowrapfordate">';
1797 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1799 print
'<div class="nowrapfordate">';
1800 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1805if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1806 print
'<td class="liste_titre">';
1810if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1811 print
'<td class="liste_titre">';
1815if (!empty($arrayfields[
'shippable'][
'checked'])) {
1816 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1819 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1820 print $langs->trans(
'ShowShippableStatus');
1822 $show_shippable_command = 1;
1828include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1831$parameters = array(
'arrayfields' => $arrayfields);
1832$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1833print $hookmanager->resPrint;
1836if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1837 print
'<td class="liste_titre maxwidthonsmartphone center">';
1838 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1843if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1844 print
'<td class="liste_titre maxwidthonsmartphone center">';
1849if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1850 print
'<td class="liste_titre center parentonrightofpage">';
1851 $liststatus = array(
1855 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1856 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1861 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1866 print
'<td class="liste_titre center maxwidthsearch">';
1867 $searchpicto = $form->showFilterButtons();
1886print
'<tr class="liste_titre">';
1890 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1891 $totalarray[
'nbfield']++;
1893if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1894 print_liste_field_titre($arrayfields[
'c.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'c.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1895 $totalarray[
'nbfield']++;
1897if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1898 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1899 $totalarray[
'nbfield']++;
1901if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1902 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1903 $totalarray[
'nbfield']++;
1905if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1906 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1907 $totalarray[
'nbfield']++;
1909if (!empty($arrayfields[
'p.title'][
'checked'])) {
1910 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1911 $totalarray[
'nbfield']++;
1913if (!empty($arrayfields[
's.nom'][
'checked'])) {
1914 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1915 $totalarray[
'nbfield']++;
1917if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1918 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1919 $totalarray[
'nbfield']++;
1921if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1922 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1923 $totalarray[
'nbfield']++;
1925if (!empty($arrayfields[
's.town'][
'checked'])) {
1926 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1927 $totalarray[
'nbfield']++;
1929if (!empty($arrayfields[
's.zip'][
'checked'])) {
1930 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1931 $totalarray[
'nbfield']++;
1933if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1934 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1935 $totalarray[
'nbfield']++;
1937if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1938 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1939 $totalarray[
'nbfield']++;
1941if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1942 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1943 $totalarray[
'nbfield']++;
1945if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1946 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1947 $totalarray[
'nbfield']++;
1949if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1950 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1951 $totalarray[
'nbfield']++;
1953if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1954 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1955 $totalarray[
'nbfield']++;
1957if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1958 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1959 $totalarray[
'nbfield']++;
1961if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1962 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1963 $totalarray[
'nbfield']++;
1965if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1966 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1967 $totalarray[
'nbfield']++;
1969if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1970 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1971 $totalarray[
'nbfield']++;
1973if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1974 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1975 $totalarray[
'nbfield']++;
1977if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1978 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1979 $totalarray[
'nbfield']++;
1981if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1982 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1983 $totalarray[
'nbfield']++;
1985if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1986 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1987 $totalarray[
'nbfield']++;
1989if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1990 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1991 $totalarray[
'nbfield']++;
1993if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1994 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1995 $totalarray[
'nbfield']++;
1997if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1998 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1999 $totalarray[
'nbfield']++;
2001if (!empty($arrayfields[
'u.login'][
'checked'])) {
2002 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
2003 $totalarray[
'nbfield']++;
2005if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2006 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2007 $totalarray[
'nbfield']++;
2009if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2010 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2011 $totalarray[
'nbfield']++;
2013if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2014 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2015 $totalarray[
'nbfield']++;
2017if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2018 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2019 $totalarray[
'nbfield']++;
2021if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2022 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2023 $totalarray[
'nbfield']++;
2026if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2027 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2028 $totalarray[
'nbfield']++;
2030if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2031 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2032 $totalarray[
'nbfield']++;
2034if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2035 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2036 $totalarray[
'nbfield']++;
2038if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2039 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
2040 $totalarray[
'nbfield']++;
2042if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2043 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
2044 $totalarray[
'nbfield']++;
2046if (!empty($arrayfields[
'shippable'][
'checked'])) {
2047 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
2048 $totalarray[
'nbfield']++;
2051include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2054$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2055$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2056print $hookmanager->resPrint;
2058if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2059 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
2060 $totalarray[
'nbfield']++;
2062if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2063 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2064 $totalarray[
'nbfield']++;
2066if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2067 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
2068 $totalarray[
'nbfield']++;
2072 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2073 $totalarray[
'nbfield']++;
2079$productstat_cache = array();
2080$productstat_cachevirtual = array();
2081$getNomUrl_cache = array();
2083$generic_commande =
new Commande($db);
2084$generic_product =
new Product($db);
2085$userstatic =
new User($db);
2087$with_margin_info =
false;
2088if (isModEnabled(
'margin') && (
2089 !empty($arrayfields[
'total_pa'][
'checked'])
2090 || !empty($arrayfields[
'total_margin'][
'checked'])
2091 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2092 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2095 $with_margin_info =
true;
2104$savnbfield = $totalarray[
'nbfield'];
2105$totalarray = array();
2106$totalarray[
'nbfield'] = 0;
2107$imaxinloop = ($limit ? min($num, $limit) : $num);
2108while ($i < $imaxinloop) {
2109 $obj = $db->fetch_object($resql);
2120 $companystatic->id = $obj->socid;
2121 $companystatic->name = $obj->name;
2122 $companystatic->name_alias = $obj->alias;
2123 $companystatic->client = $obj->client;
2124 $companystatic->fournisseur = $obj->fournisseur;
2125 $companystatic->code_client = $obj->code_client;
2126 $companystatic->email = $obj->email;
2127 $companystatic->phone = $obj->phone;
2128 $companystatic->address = $obj->address;
2129 $companystatic->zip = $obj->zip;
2130 $companystatic->town = $obj->town;
2131 $companystatic->country_code = $obj->country_code;
2132 if (!isset($getNomUrl_cache[$obj->socid])) {
2133 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2136 $generic_commande->id = $obj->rowid;
2137 $generic_commande->ref = $obj->ref;
2138 $generic_commande->statut = $obj->fk_statut;
2139 $generic_commande->billed = $obj->billed;
2140 $generic_commande->date = $db->jdate($obj->date_commande);
2141 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2142 $generic_commande->ref_client = $obj->ref_client;
2143 $generic_commande->total_ht = $obj->total_ht;
2144 $generic_commande->total_tva = $obj->total_tva;
2145 $generic_commande->total_ttc = $obj->total_ttc;
2146 $generic_commande->note_public = $obj->note_public;
2147 $generic_commande->note_private = $obj->note_private;
2149 $generic_commande->thirdparty = $companystatic;
2152 $projectstatic->id = $obj->project_id;
2153 $projectstatic->ref = $obj->project_ref;
2154 $projectstatic->title = $obj->project_label;
2156 $marginInfo = array();
2157 if ($with_margin_info ===
true) {
2158 $generic_commande->fetch_lines();
2159 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2160 $total_ht += $obj->total_ht;
2161 $total_margin += $marginInfo[
'total_margin'];
2164 if ($mode ==
'kanban') {
2166 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2167 print
'<div class="box-flex-container kanban">';
2172 if ($massactionbutton || $massaction) {
2174 if (in_array(
$object->id, $arrayofselected)) {
2178 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2179 if ($i == ($imaxinloop - 1)) {
2186 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
2190 print
'<td class="nowrap center">';
2191 if ($massactionbutton || $massaction) {
2193 if (in_array($obj->rowid, $arrayofselected)) {
2196 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2200 $totalarray[
'nbfield']++;
2205 if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
2206 print
'<td class="center" data-key="id">'.$obj->rowid.
'</td>';
2208 $totalarray[
'nbfield']++;
2213 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2214 print
'<td class="nowraponall">';
2215 $getNomUrlOption = $search_status != 2 ? 0 : $obj->fk_statut;
2221 $getNomUrlOption =
'';
2223 print $generic_commande->getNomUrl(1, $getNomUrlOption, 0, 0, 0, 1, 1);
2226 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
2227 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2228 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2232 $totalarray[
'nbfield']++;
2237 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2238 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2242 $totalarray[
'nbfield']++;
2247 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2248 print
'<td class="nowrap">';
2249 if ($obj->project_id > 0) {
2250 print $projectstatic->getNomUrl(1);
2254 $totalarray[
'nbfield']++;
2259 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2260 print
'<td class="nowrap">';
2261 if ($obj->project_id > 0) {
2262 print $projectstatic->title;
2266 $totalarray[
'nbfield']++;
2271 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2272 print
'<td class="tdoverflowmax150">';
2274 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2276 print $getNomUrl_cache[$obj->socid];
2281 if ($user->hasRight(
'facture',
'creer')) {
2282 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2283 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2284 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2290 $totalarray[
'nbfield']++;
2295 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2296 print
'<td class="nocellnopadd tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->alias).
'">';
2300 $totalarray[
'nbfield']++;
2305 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2306 print
'<td class="tdoverflowmax200">';
2307 if ($obj->fk_parent > 0) {
2308 if (!isset($company_url_list[$obj->fk_parent])) {
2309 $companyparent =
new Societe($db);
2310 $res = $companyparent->fetch($obj->fk_parent);
2312 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2315 if (isset($company_url_list[$obj->fk_parent])) {
2316 print $company_url_list[$obj->fk_parent];
2321 $totalarray[
'nbfield']++;
2326 if (!empty($arrayfields[
's.town'][
'checked'])) {
2327 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->town).
'">';
2331 $totalarray[
'nbfield']++;
2336 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2337 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->zip).
'">';
2341 $totalarray[
'nbfield']++;
2346 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2347 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->state_name).
'">'.
dolPrintLabel($obj->state_name).
"</td>\n";
2349 $totalarray[
'nbfield']++;
2354 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2355 print
'<td class="center">';
2356 $tmparray =
getCountry($obj->fk_pays,
'all');
2357 print $tmparray[
'label'];
2360 $totalarray[
'nbfield']++;
2365 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2366 print
'<td class="center">';
2367 if (empty($typenArray)) {
2368 $typenArray = $formcompany->typent_array(1);
2370 print $typenArray[$obj->typent_code]??
'';
2373 $totalarray[
'nbfield']++;
2378 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2379 print
'<td class="center nowraponall">';
2382 if ($generic_commande->hasDelay()) {
2383 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2387 $totalarray[
'nbfield']++;
2392 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2393 print
'<td class="center nowraponall">';
2394 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2397 $totalarray[
'nbfield']++;
2402 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2404 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2407 $totalarray[
'nbfield']++;
2412 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2414 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2417 $totalarray[
'nbfield']++;
2422 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2424 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2427 $totalarray[
'nbfield']++;
2432 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2434 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none',
'');
2437 $totalarray[
'nbfield']++;
2442 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2443 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2445 $totalarray[
'nbfield']++;
2448 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2450 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2451 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2453 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2458 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2459 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2461 $totalarray[
'nbfield']++;
2464 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2466 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2467 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2469 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2474 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2475 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2477 $totalarray[
'nbfield']++;
2480 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2482 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2483 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2485 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2490 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2491 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2493 $totalarray[
'nbfield']++;
2498 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2499 print
'<td class="nowrap">';
2500 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2503 $totalarray[
'nbfield']++;
2508 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2509 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2511 $totalarray[
'nbfield']++;
2515 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2516 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2518 $totalarray[
'nbfield']++;
2522 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2523 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2525 $totalarray[
'nbfield']++;
2529 $userstatic->id = $obj->fk_user_author;
2530 $userstatic->login = $obj->login;
2531 $userstatic->lastname = $obj->lastname;
2532 $userstatic->firstname = $obj->firstname;
2533 $userstatic->email = $obj->user_email;
2534 $userstatic->status = $obj->user_statut;
2535 $userstatic->entity = $obj->entity;
2536 $userstatic->photo = $obj->photo;
2537 $userstatic->office_phone = $obj->office_phone;
2538 $userstatic->office_fax = $obj->office_fax;
2539 $userstatic->user_mobile = $obj->user_mobile;
2540 $userstatic->job = $obj->job;
2541 $userstatic->gender = $obj->gender;
2544 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2545 print
'<td class="tdoverflowmax150">';
2546 if ($userstatic->id) {
2547 print $userstatic->getNomUrl(-1);
2553 $totalarray[
'nbfield']++;
2558 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2560 if ($obj->socid > 0) {
2561 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2562 if ($listsalesrepresentatives < 0) {
2565 $nbofsalesrepresentative = count($listsalesrepresentatives);
2566 if ($nbofsalesrepresentative > 6) {
2568 print $nbofsalesrepresentative;
2569 } elseif ($nbofsalesrepresentative > 0) {
2571 foreach ($listsalesrepresentatives as $val) {
2572 $userstatic->id = $val[
'id'];
2573 $userstatic->lastname = $val[
'lastname'];
2574 $userstatic->firstname = $val[
'firstname'];
2575 $userstatic->email = $val[
'email'];
2576 $userstatic->status = $val[
'statut'];
2577 $userstatic->entity = $val[
'entity'];
2578 $userstatic->photo = $val[
'photo'];
2579 $userstatic->login = $val[
'login'];
2580 $userstatic->office_phone = $val[
'office_phone'];
2581 $userstatic->office_fax = $val[
'office_fax'];
2582 $userstatic->user_mobile = $val[
'user_mobile'];
2583 $userstatic->job = $val[
'job'];
2584 $userstatic->gender = $val[
'gender'];
2586 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2588 if ($j < $nbofsalesrepresentative) {
2600 $totalarray[
'nbfield']++;
2605 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2606 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2608 $totalarray[
'nbfield']++;
2613 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2614 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2616 $totalarray[
'nbfield']++;
2619 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2622 if (!isset($totalarray[
'val'][
'total_margin'])) {
2623 $totalarray[
'val'][
'total_margin'] = 0;
2626 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2630 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2631 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2633 $totalarray[
'nbfield']++;
2638 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2639 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2641 $totalarray[
'nbfield']++;
2644 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2646 if ($i >= $imaxinloop - 1) {
2647 if (!empty($total_ht)) {
2648 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2650 $totalarray[
'val'][
'total_mark_rate'] =
'';
2656 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2657 print
'<td align="center" class="nowrap">';
2658 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2661 $totalarray[
'nbfield']++;
2666 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2667 print
'<td align="center" class="nowrap">';
2668 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2671 $totalarray[
'nbfield']++;
2676 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2677 print
'<td align="center" class="nowrap">';
2678 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2681 $totalarray[
'nbfield']++;
2686 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2687 print
'<td class="sensiblehtmlcontent center">';
2691 $totalarray[
'nbfield']++;
2696 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2697 print
'<td class="sensiblehtmlcontent center">';
2701 $totalarray[
'nbfield']++;
2706 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2707 print
'<td class="center">';
2708 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2709 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2710 $generic_commande->getLinesArray();
2711 $generic_commande->loadExpeditions();
2713 $numlines = count($generic_commande->lines);
2714 for ($lig = 0; $lig < $numlines; $lig++) {
2715 if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
2716 $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
2718 $reliquat = $generic_commande->lines[$lig]->qty;
2720 if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) {
2722 $generic_product->id = $generic_commande->lines[$lig]->fk_product;
2725 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
2726 $generic_product->load_stock(
'nobatch,warehouseopen');
2727 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2728 $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2730 $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2731 $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2734 if ($reliquat > $generic_product->stock_reel) {
2738 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->product_ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2739 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2740 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2741 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2742 $text_info .=
'<br>';
2749 $stock_order_supplier = 0;
2751 if (isModEnabled(
'order')) {
2752 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'])) {
2753 $generic_product->load_stats_commande(0,
'1,2');
2754 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2756 $generic_product->stats_commande[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'];
2758 $stock_order = $generic_product->stats_commande[
'qty'];
2760 if (isModEnabled(
"supplier_order")) {
2761 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'])) {
2762 $generic_product->load_stats_commande_fournisseur(0,
'3');
2763 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2765 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'];
2767 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2770 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2771 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2772 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
2774 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2776 if ($reliquat > $generic_product->stock_reel) {
2777 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2779 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2781 if (isModEnabled(
"supplier_order")) {
2782 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2784 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2785 $text_info .=
'<br>';
2789 if ($notshippable == 0) {
2790 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
2791 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2793 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
2794 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2799 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2802 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2807 $totalarray[
'nbfield']++;
2812 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2814 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2815 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2816 print $hookmanager->resPrint;
2819 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2820 print
'<td class="center">';
2822 print
yn($obj->billed, 4);
2826 $totalarray[
'nbfield']++;
2831 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2832 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2834 $totalarray[
'nbfield']++;
2839 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2840 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2842 $totalarray[
'nbfield']++;
2848 print
'<td class="nowrap center">';
2849 if ($massactionbutton || $massaction) {
2851 if (in_array($obj->rowid, $arrayofselected)) {
2854 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2858 $totalarray[
'nbfield']++;
2864 $total += $obj->total_ht;
2865 $subtotal += $obj->total_ht;
2871include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2876 foreach ($arrayfields as $key => $val) {
2877 if (!empty($val[
'checked'])) {
2881 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2886$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2887$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2888print $hookmanager->resPrint;
2890print
'</table>'.
"\n";
2893print
'</form>'.
"\n";
2895if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2896 $hidegeneratedfilelistifempty = 1;
2897 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2898 $hidegeneratedfilelistifempty = 0;
2902 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2903 $urlsource .= str_replace(
'&',
'&', $param);
2905 $filedir = $diroutputmassaction;
2906 $genallowed = $permissiontoread;
2907 $delallowed = $permissiontoadd;
2909 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()
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...
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.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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...
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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...
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.