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();
74 $userschilds = array();
78$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
79if (empty($search_datecloture_start)) {
82$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
83if (empty($search_datecloture_end)) {
93$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
94$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
95$search_id =
GETPOST(
'search_id',
'int');
96$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
97$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
98$search_company =
GETPOST(
'search_company',
'alpha');
99$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
100$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
101$search_town =
GETPOST(
'search_town',
'alpha');
102$search_zip =
GETPOST(
'search_zip',
'alpha');
103$search_state =
GETPOST(
'search_state',
'alpha');
104$search_country =
GETPOST(
'search_country',
'aZ09');
105$search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'intcomma');
106$search_user =
GETPOST(
'search_user',
'intcomma');
107$search_sale =
GETPOST(
'search_sale',
'intcomma');
108$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
109$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
110$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
111$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
113$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
114$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
115$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
116$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
117$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
119$search_login =
GETPOST(
'search_login',
'alpha');
120$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
121$search_billed =
GETPOST(
'search_billed',
'intcomma');
122$search_status =
GETPOST(
'search_status',
'intcomma');
123$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
124$search_project =
GETPOST(
'search_project',
'alpha');
125$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
127$search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'intcomma');
128$search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'intcomma');
129$search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'intcomma');
130$search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'intcomma');
132$search_option =
GETPOST(
'search_option',
'alpha');
133if ($search_option ==
'late') {
134 $search_status =
'-2';
136$search_orderday =
'';
137$search_ordermonth =
'';
138$search_orderyear =
'';
139$search_deliveryday =
'';
140$search_deliverymonth =
'';
141$search_deliveryyear =
'';
143$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
147$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
148$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
150if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
154$offset = $limit * $page;
155$pageprev = $page - 1;
156$pagenext = $page + 1;
158 $sortfield =
'c.ref';
164$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
168$hookmanager->initHooks(array(
'orderlist'));
172$extrafields->fetch_name_optionals_label(
$object->table_element);
173$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
176$fieldstosearchall = array(
178 'c.ref_client' =>
'RefCustomerOrder',
179 'pd.description' =>
'Description',
180 's.nom' =>
"ThirdParty",
181 's.name_alias' =>
"AliasNameShort",
184 'c.note_public' =>
'NotePublic',
186if (empty($user->socid)) {
187 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
190$checkedtypetiers = 0;
192 'c.rowid' => array(
'label' =>
"ID",
'checked' => 1,
'enabled' =>
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 1),
193 'c.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5,
'searchall' => 1),
194 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' => -1,
'position' => 10,
'searchall' => 1),
195 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => -1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 20),
196 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (!isModEnabled(
'project') ? 0 : 1),
'position' => 25),
197 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 30,
'searchall' => 1),
198 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 31,
'searchall' => 1),
199 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' => 0),
200 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 35,
'searchall' => 1),
201 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 40,
'searchall' => 1),
202 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 45),
203 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 50),
204 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 55),
205 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' => 1,
'position' => 60,
'csslist' =>
'nowraponall'),
206 'c.date_delivery' => array(
'label' =>
"DateDeliveryPlanned",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65,
'csslist' =>
'nowraponall'),
207 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => -1,
'position' => 66 ,
'enabled' => isModEnabled(
"shipping")),
208 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => -1,
'position' => 67),
209 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => -1,
'position' => 68),
210 'c.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => -1,
'position' => 69),
211 'c.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 75),
212 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 80),
213 'c.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 85),
214 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 90),
215 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 95),
216 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 100),
217 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 105),
218 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1),
'position' => 110),
219 'u.login' => array(
'label' =>
"Author",
'checked' => 1,
'position' => 115),
220 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 116),
221 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
222 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
223 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
224 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
225 'c.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 120),
226 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 125),
227 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 130),
228 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 135,
'searchall' => 1),
229 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 140),
230 'shippable' => array(
'label' =>
"Shippable",
'checked' => 1,
'enabled' => (isModEnabled(
"shipping")),
'position' => 990),
231 'c.facture' => array(
'label' =>
"Billed",
'checked' => 1,
'enabled' => (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
232 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
233 'c.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000)
236$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
237$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
239 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
240} elseif ($reshook == 0) {
241 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
245include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
250'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
256 $socid = $user->socid;
259$permissiontoreadallthirdparty = $user->hasRight(
'societe',
'client',
'voir');
260$permissiontoread =
false;
261$permissiontovalidate =
false;
262$permissiontoclose =
false;
263$permissiontocancel =
false;
264$permissiontosendbymail =
false;
277if (
GETPOST(
'cancel',
'alpha')) {
281if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
285$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
286$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
291if (empty($reshook)) {
293 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
296 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
299 $search_product_category =
'';
302 $search_ref_customer =
'';
303 $search_company =
'';
304 $search_company_alias =
'';
305 $search_parent_name =
'';
310 $search_country =
'';
311 $search_type_thirdparty =
'';
312 $search_total_ht =
'';
313 $search_total_vat =
'';
314 $search_total_ttc =
'';
315 $search_warehouse =
'';
316 $search_multicurrency_code =
'';
317 $search_multicurrency_tx =
'';
318 $search_multicurrency_montant_ht =
'';
319 $search_multicurrency_montant_vat =
'';
320 $search_multicurrency_montant_ttc =
'';
322 $search_dateorder_start =
'';
323 $search_dateorder_end =
'';
324 $search_datedelivery_start =
'';
325 $search_datedelivery_end =
'';
326 $search_project_ref =
'';
327 $search_project =
'';
331 $search_array_options = array();
332 $search_categ_cus = 0;
333 $search_datecloture_start =
'';
334 $search_datecloture_end =
'';
335 $search_fk_cond_reglement =
'';
336 $search_fk_shipping_method =
'';
337 $search_fk_mode_reglement =
'';
338 $search_fk_input_reason =
'';
341 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
342 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
347 $objectclass =
'Commande';
348 $objectlabel =
'Orders';
349 $permissiontoread = $user->hasRight(
"commande",
"lire");
350 $permissiontoadd = $user->hasRight(
"commande",
"creer");
351 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
353 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
354 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
355 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
356 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
358 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
359 $permissiontoclose = $user->hasRight(
"commande",
"creer");
360 $permissiontocancel = $user->hasRight(
"commande",
"creer");
361 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
363 $uploaddir = $conf->commande->multidir_output[$conf->entity];
364 $triggersendname =
'ORDER_SENTBYMAIL';
367 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
369 if ($massaction ==
'confirm_createbills') {
370 $orders =
GETPOST(
'toselect',
'array');
371 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
372 $validate_invoices =
GETPOSTINT(
'validate_invoices');
377 $TFactThird = array();
378 $TFactThirdNbLines = array();
380 $nb_bills_created = 0;
386 $nbOrders = is_array($orders) ? count($orders) : 1;
389 foreach ($orders as $id_order) {
391 if ($cmd->fetch($id_order) <= 0) {
394 $cmd->fetch_thirdparty();
397 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
400 $objecttmp = $TFactThird[$cmd->socid];
403 $objecttmp->socid = $cmd->socid;
404 $objecttmp->thirdparty = $cmd->thirdparty;
406 $objecttmp->type = $objecttmp::TYPE_STANDARD;
407 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
408 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
410 $objecttmp->fk_project = $cmd->fk_project;
411 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
412 if (empty($createbills_onebythird)) {
413 $objecttmp->ref_client = $cmd->ref_client;
416 if (empty($objecttmp->note_public)) {
417 $objecttmp->note_public = $langs->transnoentities(
"Orders");
421 if (empty($datefacture)) {
425 $objecttmp->date = $datefacture;
426 $objecttmp->origin =
'commande';
427 $objecttmp->origin_id = $id_order;
429 $objecttmp->array_options = $cmd->array_options;
431 $res = $objecttmp->create($user);
435 $lastref = $objecttmp->ref;
436 $lastid = $objecttmp->id;
438 $TFactThird[$cmd->socid] = $objecttmp;
439 $TFactThirdNbLines[$cmd->socid] = 0;
441 $langs->load(
"errors");
442 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
447 if ($objecttmp->id > 0) {
448 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
451 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
456 $lines = $cmd->lines;
457 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
459 $lines = $cmd->lines;
463 $num = count($lines);
464 $array_options = array();
466 for ($i = 0; $i < $num; $i++) {
467 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
469 if (!empty($createbills_onebythird)) {
473 if ($lines[$i]->subprice < 0 && !
getDolGlobalString(
'INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
476 $discount->fk_soc = $objecttmp->socid;
477 $discount->socid = $objecttmp->socid;
478 $discount->amount_ht = abs($lines[$i]->total_ht);
479 $discount->amount_tva = abs($lines[$i]->total_tva);
480 $discount->amount_ttc = abs($lines[$i]->total_ttc);
481 $discount->tva_tx = $lines[$i]->tva_tx;
482 $discount->fk_user = $user->id;
483 $discount->description = $desc;
484 $discountid = $discount->create($user);
485 if ($discountid > 0) {
486 $result = $objecttmp->insert_discount($discountid);
495 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
498 if ($lines[$i]->date_debut_prevue) {
499 $date_start = $lines[$i]->date_debut_prevue;
501 if ($lines[$i]->date_debut_reel) {
502 $date_start = $lines[$i]->date_debut_reel;
504 if ($lines[$i]->date_start) {
505 $date_start = $lines[$i]->date_start;
509 if ($lines[$i]->date_fin_prevue) {
510 $date_end = $lines[$i]->date_fin_prevue;
512 if ($lines[$i]->date_fin_reel) {
513 $date_end = $lines[$i]->date_fin_reel;
515 if ($lines[$i]->date_end) {
516 $date_end = $lines[$i]->date_end;
519 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
524 if (method_exists($lines[$i],
'fetch_optionals')) {
525 $lines[$i]->fetch_optionals();
526 $array_options = $lines[$i]->array_options;
529 $objecttmp->context[
'createfromclone'] =
'createfromclone';
531 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
533 if (!empty($createbills_onebythird)) {
534 $TFactThirdNbLines[$cmd->socid]++;
535 $rang = $TFactThirdNbLines[$cmd->socid];
538 $result = $objecttmp->addline(
540 $lines[$i]->subprice,
543 $lines[$i]->localtax1_tx,
544 $lines[$i]->localtax2_tx,
545 $lines[$i]->fk_product,
546 $lines[$i]->remise_percent,
550 $lines[$i]->info_bits,
551 $lines[$i]->fk_remise_except,
556 $lines[$i]->special_code,
560 $lines[$i]->fk_fournprice,
573 $errors[] = $objecttmp->error;
577 if ($result > 0 && $lines[$i]->product_type == 9) {
578 $fk_parent_line = $result;
586 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_client) ?
'' :
' ('.$cmd->ref_client.
')'));
587 $objecttmp->update($user);
592 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
593 $TFactThird[$cmd->socid] = $objecttmp;
595 $TFact[$objecttmp->id] = $objecttmp;
600 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
603 if (!$error && $validate_invoices) {
604 $massaction = $action =
'builddoc';
606 foreach ($TAllFact as &$objecttmp) {
607 $result = $objecttmp->validate($user);
614 $id = $objecttmp->id;
618 $upload_dir = $conf->facture->dir_output;
619 $permissiontoadd = $user->hasRight(
'facture',
'creer');
624 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
628 $massaction = $action =
'confirm_createbills';
634 if ($nb_bills_created == 1) {
635 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_ONE') == 1) {
637 header(
'Location: '.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) $lastid));
640 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
641 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
644 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_MANY') == 1) {
646 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills');
649 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
655 $param .=
'&mode='.urlencode($mode);
657 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
658 $param .=
'&contextpage='.urlencode($contextpage);
660 if ($limit > 0 && $limit != $conf->liste_limit) {
661 $param .=
'&limit='.((int) $limit);
663 if ($optioncss !=
'') {
664 $param .=
'&optioncss='.urlencode($optioncss);
667 $param .=
'&search_all='.urlencode($search_all);
670 $param .=
'&show_files='.urlencode((
string) ($show_files));
673 $param .=
'&socid='.urlencode((
string) ($socid));
675 if ($search_status !=
'') {
676 $param .=
'&search_status='.urlencode($search_status);
678 if ($search_option) {
679 $param .=
"&search_option=".urlencode($search_option);
681 if ($search_orderday) {
682 $param .=
'&search_orderday='.urlencode($search_orderday);
684 if ($search_ordermonth) {
685 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
687 if ($search_orderyear) {
688 $param .=
'&search_orderyear='.urlencode($search_orderyear);
690 if ($search_deliveryday) {
691 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
693 if ($search_deliverymonth) {
694 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
696 if ($search_deliveryyear) {
697 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
700 $param .=
'&search_id='.urlencode((
string) $search_id);
703 $param .=
'&search_ref='.urlencode($search_ref);
705 if ($search_company) {
706 $param .=
'&search_company='.urlencode($search_company);
708 if ($search_ref_customer) {
709 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
711 if ($search_user > 0) {
712 $param .=
'&search_user='.urlencode((
string) ($search_user));
714 if ($search_sale > 0) {
715 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
717 if ($search_total_ht !=
'') {
718 $param .=
'&search_total_ht='.urlencode($search_total_ht);
720 if ($search_total_vat !=
'') {
721 $param .=
'&search_total_vat='.urlencode($search_total_vat);
723 if ($search_total_ttc !=
'') {
724 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
726 if ($search_project_ref >= 0) {
727 $param .=
"&search_project_ref=".urlencode($search_project_ref);
729 if ($search_billed !=
'') {
730 $param .=
'&search_billed='.urlencode($search_billed);
733 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
739 $_GET[
"origin"] = $_POST[
"origin"];
740 $_GET[
"originid"] = $_POST[
"originid"];
741 if (!empty($errors)) {
750if ($action ==
'validate' && $permissiontoadd && $objectclass !==
null) {
751 if (
GETPOST(
'confirm') ==
'yes') {
752 $objecttmp =
new $objectclass($db);
755 foreach ($toselect as $checked) {
756 if ($objecttmp->fetch($checked)) {
757 if ($objecttmp->statut == 0) {
758 if (!empty($objecttmp->fk_warehouse)) {
759 $idwarehouse = $objecttmp->fk_warehouse;
763 if ($objecttmp->valid($user, $idwarehouse)) {
764 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
770 $langs->load(
"errors");
771 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
786if ($action ==
'shipped' && $permissiontoadd && $objectclass !==
null) {
787 if (
GETPOST(
'confirm') ==
'yes') {
788 $objecttmp =
new $objectclass($db);
791 foreach ($toselect as $checked) {
792 if ($objecttmp->fetch($checked)) {
793 if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
794 if ($objecttmp->cloture($user)) {
795 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
797 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
801 $langs->load(
"errors");
802 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
819if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
822 $objecttmp =
new $objectclass($db);
824 foreach ($toselect as $toselectid) {
825 $result = $objecttmp->fetch($toselectid);
827 $result = $objecttmp->classifyBilled($user, 0);
855$form =
new Form($db);
859if (isModEnabled(
'margin')) {
862$companystatic =
new Societe($db);
863$company_url_list = array();
865$projectstatic =
new Project($db);
869$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
870$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
872$title = $langs->trans(
"Orders");
873$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
879 $sql =
'SELECT DISTINCT';
881$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,';
882$sql .=
" s.parent as fk_parent,";
883$sql .=
" s2.nom as name2,";
884$sql .=
" typent.code as typent_code,";
885$sql .=
" state.code_departement as state_code, state.nom as state_name,";
886$sql .=
" country.code as country_code,";
887$sql .=
' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
888$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,';
889$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,';
890$sql .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
891$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
892$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,';
893$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
894$sql .=
' c.fk_input_reason, c.import_key';
897if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
898 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
899 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
904$parameters = array();
905$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
906$sql .= $hookmanager->resPrint;
907$sql = preg_replace(
'/,\s*$/',
'', $sql);
911$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
912$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
913$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
914$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
915$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
916$sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
917if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
918 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
921 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
923$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
924$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
926$parameters = array();
927$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
928$sql .= $hookmanager->resPrint;
930$sql .=
' WHERE c.fk_soc = s.rowid';
931$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
933 $sql .=
' AND s.rowid = '.((int) $socid);
937if (!$permissiontoreadallthirdparty) {
938 $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).
")";
940 $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)).
"))";
951if ($search_ref_customer) {
955 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
957if ($search_billed !=
'' && $search_billed >= 0) {
958 $sql .=
' AND c.facture = '.((int) $search_billed);
960if ($search_status !=
'') {
961 if ($search_status <= 3 && $search_status >= -1) {
962 if ($search_status == 1 && !isModEnabled(
'shipping')) {
963 $sql .=
' AND c.fk_statut IN (1,2)';
965 $sql .=
' AND c.fk_statut = '.((int) $search_status);
968 if ($search_status == -2) {
970 $sql .=
" AND (c.fk_statut IN (1,2))";
972 if ($search_status == -3) {
975 $sql .=
' AND (c.fk_statut IN (1,2,3))';
978if ($search_option ==
'late') {
979 $sql .=
" AND c.date_commande < '".$db->idate(
dol_now() - $conf->commande->client->warning_delay).
"'";
981if ($search_datecloture_start) {
982 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
984if ($search_datecloture_end) {
985 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
987if ($search_dateorder_start) {
988 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
990if ($search_dateorder_end) {
991 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
993if ($search_datedelivery_start) {
994 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
996if ($search_datedelivery_end) {
997 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
1008if ($search_country) {
1009 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
1011if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1012 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
1014if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
1015 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
1017 if ($search_company) {
1020 if ($search_company_alias) {
1024if ($search_parent_name) {
1027if ($search_total_ht !=
'') {
1030if ($search_total_vat !=
'') {
1033if ($search_total_ttc !=
'') {
1036if ($search_warehouse !=
'' && $search_warehouse > 0) {
1039if ($search_multicurrency_code !=
'') {
1040 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
1042if ($search_multicurrency_tx !=
'') {
1043 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
1045if ($search_multicurrency_montant_ht !=
'') {
1046 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
1048if ($search_multicurrency_montant_vat !=
'') {
1049 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
1051if ($search_multicurrency_montant_ttc !=
'') {
1052 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1055 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
1057if ($search_project_ref !=
'') {
1060if ($search_project !=
'') {
1063if ($search_fk_cond_reglement > 0) {
1064 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1066if ($search_fk_shipping_method > 0) {
1067 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1069if ($search_fk_mode_reglement > 0) {
1070 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1072if ($search_fk_input_reason > 0) {
1073 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1076if ($search_user > 0) {
1077 $sql .=
" AND EXISTS (";
1078 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1079 $sql .=
" FROM llx_element_contact as ec";
1080 $sql .=
" INNER JOIN llx_c_type_contact as tc";
1081 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal'";
1082 $sql .=
" WHERE ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1085if ($search_sale && $search_sale !=
'-1') {
1086 if ($search_sale == -2) {
1087 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
1088 } elseif ($search_sale > 0) {
1089 $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).
")";
1093$searchCategoryCustomerOperator = -1;
1094$searchCategoryCustomerList = array($search_categ_cus);
1095if (!empty($searchCategoryCustomerList)) {
1096 $searchCategoryCustomerSqlList = array();
1097 $listofcategoryid =
'';
1098 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1099 if (intval($searchCategoryCustomer) == -2) {
1100 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
1101 } elseif (intval($searchCategoryCustomer) > 0) {
1102 if ($searchCategoryCustomerOperator == 0) {
1103 $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).
")";
1105 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1109 if ($listofcategoryid) {
1110 $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).
"))";
1112 if ($searchCategoryCustomerOperator == 1) {
1113 if (!empty($searchCategoryCustomerSqlList)) {
1114 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1117 if (!empty($searchCategoryCustomerSqlList)) {
1118 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1123$searchCategoryProductOperator = -1;
1124$searchCategoryProductList = array($search_product_category);
1125if (!empty($searchCategoryProductList)) {
1126 $searchCategoryProductSqlList = array();
1127 $listofcategoryid =
'';
1128 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1129 if (intval($searchCategoryProduct) == -2) {
1130 $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)";
1131 } elseif (intval($searchCategoryProduct) > 0) {
1132 if ($searchCategoryProductOperator == 0) {
1133 $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).
")";
1135 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1139 if ($listofcategoryid) {
1140 $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).
"))";
1142 if ($searchCategoryProductOperator == 1) {
1143 if (!empty($searchCategoryProductSqlList)) {
1144 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1147 if (!empty($searchCategoryProductSqlList)) {
1148 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1153include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1155$parameters = array();
1156$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1157$sql .= $hookmanager->resPrint;
1160$parameters = array();
1161$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1162$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1166$nbtotalofrecords =
'';
1169 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1170 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1171 $resql = $db->query($sqlforcount);
1173 $objforcount = $db->fetch_object($resql);
1174 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1179 if (($page * $limit) > $nbtotalofrecords) {
1186$sql .= $db->order($sortfield, $sortorder);
1188 $sql .= $db->plimit($limit + 1, $offset);
1192$resql = $db->query($sql);
1200 $soc->fetch($socid);
1201 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1202 if (empty($search_company)) {
1203 $search_company = $soc->name;
1206 $title = $langs->trans(
'CustomersOrders');
1208if (strval($search_status) ==
'0') {
1209 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1211if ($search_status == 1) {
1212 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1214if ($search_status == 2) {
1215 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1217if ($search_status == 3) {
1218 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1220if ($search_status == -1) {
1221 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1223if ($search_status == -2) {
1224 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1226if ($search_status == -3) {
1227 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1229if ($search_status == -4) {
1230 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1233$num = $db->num_rows($resql);
1235$arrayofselected = is_array($toselect) ? $toselect : array();
1237if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1238 $obj = $db->fetch_object($resql);
1240 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.
$id);
1247llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-order page-list');
1249$arrayofselected = is_array($toselect) ? $toselect : array();
1253 $param .=
'&mode='.urlencode($mode);
1255if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1256 $param .=
'&contextpage='.urlencode($contextpage);
1258if ($limit > 0 && $limit != $conf->liste_limit) {
1259 $param .=
'&limit='.((int) $limit);
1262 $param .=
'&search_all='.urlencode($search_all);
1265 $param .=
'&socid='.((int) $socid);
1267if ($search_status !=
'') {
1268 $param .=
'&search_status='.urlencode($search_status);
1270if ($search_option) {
1271 $param .=
"&search_option=".urlencode($search_option);
1273if ($search_datecloture_start) {
1274 $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');
1276if ($search_datecloture_end) {
1277 $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');
1279if ($search_dateorder_start) {
1280 $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');
1282if ($search_dateorder_end) {
1283 $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');
1285if ($search_datedelivery_start) {
1286 $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');
1288if ($search_datedelivery_end) {
1289 $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');
1292 $param .=
'&search_id='.urlencode((
string) $search_id);
1295 $param .=
'&search_ref='.urlencode($search_ref);
1297if ($search_company) {
1298 $param .=
'&search_company='.urlencode($search_company);
1300if ($search_company_alias) {
1301 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1303if ($search_parent_name !=
'') {
1304 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1306if ($search_ref_customer) {
1307 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1309if ($search_user > 0) {
1310 $param .=
'&search_user='.urlencode((
string) ($search_user));
1312if ($search_sale > 0) {
1313 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1315if ($search_total_ht !=
'') {
1316 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1318if ($search_total_vat !=
'') {
1319 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1321if ($search_total_ttc !=
'') {
1322 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1324if ($search_warehouse !=
'') {
1325 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
1328 $param .=
'&search_login='.urlencode($search_login);
1330if ($search_multicurrency_code !=
'') {
1331 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1333if ($search_multicurrency_tx !=
'') {
1334 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1336if ($search_multicurrency_montant_ht !=
'') {
1337 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1339if ($search_multicurrency_montant_vat !=
'') {
1340 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1342if ($search_multicurrency_montant_ttc !=
'') {
1343 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1345if ($search_project_ref >= 0) {
1346 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1348if ($search_town !=
'') {
1349 $param .=
'&search_town='.urlencode($search_town);
1351if ($search_zip !=
'') {
1352 $param .=
'&search_zip='.urlencode($search_zip);
1354if ($search_state !=
'') {
1355 $param .=
'&search_state='.urlencode($search_state);
1357if ($search_country !=
'') {
1358 $param .=
'&search_country='.urlencode((
string) ($search_country));
1360if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1361 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1363if ($search_product_category !=
'') {
1364 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1366if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1367 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1370 $param .=
'&show_files='.urlencode((
string) ($show_files));
1372if ($optioncss !=
'') {
1373 $param .=
'&optioncss='.urlencode($optioncss);
1375if ($search_billed !=
'') {
1376 $param .=
'&search_billed='.urlencode($search_billed);
1378if ($search_fk_cond_reglement > 0) {
1379 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1381if ($search_fk_shipping_method > 0) {
1382 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1384if ($search_fk_mode_reglement > 0) {
1385 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1387if ($search_fk_input_reason > 0) {
1388 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1392include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1395$parameters = array();
1396$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1397$param .= $hookmanager->resPrint;
1400$arrayofmassactions = array(
1401 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1402 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1404if ($permissiontovalidate) {
1405 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1407if ($permissiontoclose) {
1408 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1410if (isModEnabled(
'invoice') && $user->hasRight(
"facture",
"creer")) {
1411 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1413if ($permissiontoclose) {
1414 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1416if ($permissiontocancel) {
1417 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"CancelOrder");
1419if (!empty($permissiontodelete)) {
1420 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1422if ($permissiontosendbymail) {
1423 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1425if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1426 $arrayofmassactions = array();
1428$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1430$url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1431if (!empty($socid)) {
1432 $url .=
'&socid='.$socid;
1435$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'));
1436$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'));
1438$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', (
int) (($contextpage ==
'orderlist' || $contextpage ==
'billableorders') && $permissiontoadd));
1441print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1442if ($optioncss !=
'') {
1443 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1445print
'<input type="hidden" name="token" value="'.newToken().
'">';
1446print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1447print
'<input type="hidden" name="action" value="list">';
1448print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1449print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1450print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1451print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1452print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1453print
'<input type="hidden" name="page_y" value="">';
1454print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1457print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1459$topicmail =
"SendOrderRef";
1460$modelmail =
"order_send";
1462$trackid =
'ord'.$object->id;
1463include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1465if ($massaction ==
'prevalidate') {
1466 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1468if ($massaction ==
'preshipped') {
1469 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1472if ($massaction ==
'createbills') {
1473 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1475 print
'<table class="noborder centpercent">';
1478 print $langs->trans(
'DateInvoice');
1481 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1486 print $langs->trans(
'CreateOneBillByThird');
1489 print $form->selectyesno(
'createbills_onebythird',
getDolGlobalString(
'MAIN_ORDERLIST_CREATEBILLS_ONEBYTHIRD',
'no'), 1);
1494 print $langs->trans(
'ValidateInvoices');
1498 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
1499 $langs->load(
"errors");
1500 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1502 print $form->selectyesno(
'validate_invoices', 0, 1);
1504 if (!empty($conf->workflow->enabled) &&
getDolGlobalString(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1505 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1507 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1513 print
'<div class="center">';
1514 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1515 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1522 foreach ($fieldstosearchall as $key => $val) {
1523 $fieldstosearchall[$key] = $langs->trans($val);
1524 $setupstring .= $key.
"=".$val.
";";
1526 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1527 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1533if ($user->hasRight(
"user",
"user",
"lire")) {
1534 $langs->load(
"commercial");
1535 $moreforfilter .=
'<div class="divsearchfield">';
1536 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1537 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1538 $moreforfilter .=
'</div>';
1541if ($user->hasRight(
"user",
"user",
"lire")) {
1542 $moreforfilter .=
'<div class="divsearchfield">';
1543 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1544 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1545 $moreforfilter .=
'</div>';
1549if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1550 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1551 $moreforfilter .=
'<div class="divsearchfield">';
1552 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1553 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, array(), 1);
1554 $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);
1555 $moreforfilter .=
'</div>';
1558if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1559 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1560 $moreforfilter .=
'<div class="divsearchfield">';
1561 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1562 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1563 $moreforfilter .=
'</div>';
1566if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
1567 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1569 $moreforfilter .=
'<div class="divsearchfield">';
1570 $tmptitle = $langs->trans(
'Warehouse');
1571 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1572 $moreforfilter .=
'</div>';
1575$parameters = array();
1576$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1577if (empty($reshook)) {
1578 $moreforfilter .= $hookmanager->resPrint;
1580 $moreforfilter = $hookmanager->resPrint;
1583if (!empty($moreforfilter)) {
1584 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1585 print $moreforfilter;
1589$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1590$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1591$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1592$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1595 $selectedfields .=
'<script>';
1596 $selectedfields .=
' $(document).ready(function() {';
1597 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1598 $selectedfields .=
' $("#checkforselects").click();';
1599 $selectedfields .=
' $("#massaction").val("createbills").change();';
1600 $selectedfields .=
' });';
1601 $selectedfields .=
'</script>';
1604print
'<div class="div-table-responsive">';
1605print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1609print
'<tr class="liste_titre_filter">';
1612 print
'<td class="liste_titre center maxwidthsearch">';
1613 $searchpicto = $form->showFilterButtons(
'left');
1619if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1620 print
'<td class="liste_titre">';
1621 print
'<input class="flat" size="6" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1626if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1627 print
'<td class="liste_titre">';
1628 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1632if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1633 print
'<td class="liste_titre" align="left">';
1634 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1638if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1639 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1642if (!empty($arrayfields[
'p.title'][
'checked'])) {
1643 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1646if (!empty($arrayfields[
's.nom'][
'checked'])) {
1647 print
'<td class="liste_titre" align="left">';
1648 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1652if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1653 print
'<td class="liste_titre" align="left">';
1654 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1658if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1659 print
'<td class="liste_titre">';
1660 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1664if (!empty($arrayfields[
's.town'][
'checked'])) {
1665 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1668if (!empty($arrayfields[
's.zip'][
'checked'])) {
1669 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1672if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1673 print
'<td class="liste_titre">';
1674 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1678if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1679 print
'<td class="liste_titre" align="center">';
1680 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1684if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1685 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1686 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);
1690if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1691 print
'<td class="liste_titre center">';
1692 print
'<div class="nowrapfordate">';
1693 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1695 print
'<div class="nowrapfordate">';
1696 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1700if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1701 print
'<td class="liste_titre center">';
1702 print
'<div class="nowrapfordate">';
1703 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1705 print
'<div class="nowrapfordate">';
1706 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1711if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1712 print
'<td class="liste_titre">';
1713 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1717if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1718 print
'<td class="liste_titre">';
1719 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1723if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1724 print
'<td class="liste_titre">';
1725 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1729if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1730 print
'<td class="liste_titre">';
1731 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1735if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1736 print
'<td class="liste_titre right">';
1737 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1741if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1742 print
'<td class="liste_titre right">';
1743 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1747if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1748 print
'<td class="liste_titre right">';
1749 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1753if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1754 print
'<td class="liste_titre">';
1755 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1759if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1760 print
'<td class="liste_titre">';
1761 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1765if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1766 print
'<td class="liste_titre right">';
1767 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1771if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1772 print
'<td class="liste_titre right">';
1773 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1777if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1778 print
'<td class="liste_titre right">';
1779 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1783if (!empty($arrayfields[
'u.login'][
'checked'])) {
1784 print
'<td class="liste_titre">';
1785 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1789if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1790 print
'<td class="liste_titre"></td>';
1792if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1793 print
'<td class="liste_titre right">';
1796if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1797 print
'<td class="liste_titre right">';
1800if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1801 print
'<td class="liste_titre right">';
1804if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1805 print
'<td class="liste_titre right">';
1810if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1811 print
'<td class="liste_titre">';
1815if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1816 print
'<td class="liste_titre">';
1820if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1821 print
'<td class="liste_titre center">';
1822 print
'<div class="nowrapfordate">';
1823 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1825 print
'<div class="nowrapfordate">';
1826 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1831if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1832 print
'<td class="liste_titre">';
1836if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1837 print
'<td class="liste_titre">';
1841if (!empty($arrayfields[
'shippable'][
'checked'])) {
1842 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1845 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1846 print $langs->trans(
'ShowShippableStatus');
1848 $show_shippable_command = 1;
1854include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1857$parameters = array(
'arrayfields' => $arrayfields);
1858$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1859print $hookmanager->resPrint;
1862if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1863 print
'<td class="liste_titre maxwidthonsmartphone center">';
1864 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1869if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1870 print
'<td class="liste_titre maxwidthonsmartphone center">';
1875if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1876 print
'<td class="liste_titre center parentonrightofpage">';
1877 $liststatus = array(
1881 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1882 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1887 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1892 print
'<td class="liste_titre center maxwidthsearch">';
1893 $searchpicto = $form->showFilterButtons();
1912print
'<tr class="liste_titre">';
1916 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1917 $totalarray[
'nbfield']++;
1919if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1920 print_liste_field_titre($arrayfields[
'c.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'c.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1921 $totalarray[
'nbfield']++;
1923if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1924 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1925 $totalarray[
'nbfield']++;
1927if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1928 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1929 $totalarray[
'nbfield']++;
1931if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1932 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1933 $totalarray[
'nbfield']++;
1935if (!empty($arrayfields[
'p.title'][
'checked'])) {
1936 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1937 $totalarray[
'nbfield']++;
1939if (!empty($arrayfields[
's.nom'][
'checked'])) {
1940 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1941 $totalarray[
'nbfield']++;
1943if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1945 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1946 $totalarray[
'nbfield']++;
1948if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1949 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1950 $totalarray[
'nbfield']++;
1952if (!empty($arrayfields[
's.town'][
'checked'])) {
1953 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1954 $totalarray[
'nbfield']++;
1956if (!empty($arrayfields[
's.zip'][
'checked'])) {
1957 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1958 $totalarray[
'nbfield']++;
1960if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1961 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1962 $totalarray[
'nbfield']++;
1964if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1965 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1966 $totalarray[
'nbfield']++;
1968if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1969 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1970 $totalarray[
'nbfield']++;
1972if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1973 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1974 $totalarray[
'nbfield']++;
1976if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1977 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1978 $totalarray[
'nbfield']++;
1980if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1981 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1982 $totalarray[
'nbfield']++;
1984if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1985 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1986 $totalarray[
'nbfield']++;
1988if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1989 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1990 $totalarray[
'nbfield']++;
1992if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1993 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1994 $totalarray[
'nbfield']++;
1996if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1997 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1998 $totalarray[
'nbfield']++;
2000if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2001 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2002 $totalarray[
'nbfield']++;
2004if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2005 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2006 $totalarray[
'nbfield']++;
2008if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2009 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2010 $totalarray[
'nbfield']++;
2012if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2013 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2014 $totalarray[
'nbfield']++;
2016if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2017 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
2018 $totalarray[
'nbfield']++;
2020if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2021 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
2022 $totalarray[
'nbfield']++;
2024if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2025 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
2026 $totalarray[
'nbfield']++;
2028if (!empty($arrayfields[
'u.login'][
'checked'])) {
2029 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
2030 $totalarray[
'nbfield']++;
2032if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2033 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2034 $totalarray[
'nbfield']++;
2036if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2037 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2038 $totalarray[
'nbfield']++;
2040if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2041 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2042 $totalarray[
'nbfield']++;
2044if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2045 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2046 $totalarray[
'nbfield']++;
2048if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2049 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2050 $totalarray[
'nbfield']++;
2053if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2054 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2055 $totalarray[
'nbfield']++;
2057if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2058 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2059 $totalarray[
'nbfield']++;
2061if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2062 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2063 $totalarray[
'nbfield']++;
2065if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2066 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
2067 $totalarray[
'nbfield']++;
2069if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2070 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
2071 $totalarray[
'nbfield']++;
2073if (!empty($arrayfields[
'shippable'][
'checked'])) {
2074 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
2075 $totalarray[
'nbfield']++;
2078include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2081$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
2082$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2083print $hookmanager->resPrint;
2085if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2086 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
2087 $totalarray[
'nbfield']++;
2089if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2090 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2091 $totalarray[
'nbfield']++;
2093if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2094 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
2095 $totalarray[
'nbfield']++;
2099 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2100 $totalarray[
'nbfield']++;
2106$productstat_cache = array();
2107$productstat_cachevirtual = array();
2108$getNomUrl_cache = array();
2110$generic_commande =
new Commande($db);
2111$generic_product =
new Product($db);
2112$userstatic =
new User($db);
2114$with_margin_info =
false;
2115if (isModEnabled(
'margin') && (
2116 !empty($arrayfields[
'total_pa'][
'checked'])
2117 || !empty($arrayfields[
'total_margin'][
'checked'])
2118 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2119 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2122 $with_margin_info =
true;
2131$savnbfield = $totalarray[
'nbfield'];
2132$totalarray = array();
2133$totalarray[
'nbfield'] = 0;
2134$imaxinloop = ($limit ? min($num, $limit) : $num);
2135while ($i < $imaxinloop) {
2136 $obj = $db->fetch_object($resql);
2147 $companystatic->id = $obj->socid;
2148 $companystatic->name = $obj->name;
2149 $companystatic->name_alias = $obj->alias;
2150 $companystatic->client = $obj->client;
2151 $companystatic->fournisseur = $obj->fournisseur;
2152 $companystatic->code_client = $obj->code_client;
2153 $companystatic->email = $obj->email;
2154 $companystatic->phone = $obj->phone;
2155 $companystatic->address = $obj->address;
2156 $companystatic->zip = $obj->zip;
2157 $companystatic->town = $obj->town;
2158 $companystatic->country_code = $obj->country_code;
2159 if (!isset($getNomUrl_cache[$obj->socid])) {
2160 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2163 $generic_commande->id = $obj->rowid;
2164 $generic_commande->ref = $obj->ref;
2165 $generic_commande->statut = $obj->fk_statut;
2166 $generic_commande->billed = $obj->billed;
2167 $generic_commande->date = $db->jdate($obj->date_commande);
2168 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2169 $generic_commande->ref_client = $obj->ref_client;
2170 $generic_commande->total_ht = $obj->total_ht;
2171 $generic_commande->total_tva = $obj->total_tva;
2172 $generic_commande->total_ttc = $obj->total_ttc;
2173 $generic_commande->note_public = $obj->note_public;
2174 $generic_commande->note_private = $obj->note_private;
2176 $generic_commande->thirdparty = $companystatic;
2179 $projectstatic->id = $obj->project_id;
2180 $projectstatic->ref = $obj->project_ref;
2181 $projectstatic->title = $obj->project_label;
2183 $marginInfo = array();
2184 if ($with_margin_info) {
2185 $generic_commande->fetch_lines();
2186 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2187 $total_ht += $obj->total_ht;
2188 $total_margin += $marginInfo[
'total_margin'];
2191 if ($mode ==
'kanban') {
2193 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2194 print
'<div class="box-flex-container kanban">';
2199 if ($massactionbutton || $massaction) {
2201 if (in_array(
$object->id, $arrayofselected)) {
2205 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2206 if ($i == ($imaxinloop - 1)) {
2213 print
'<tr data-rowid="'.$object->id.
'" class="oddeven '.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->billed == 1) ?
'opacitymedium' :
'').
'">';
2217 print
'<td class="nowrap center">';
2218 if ($massactionbutton || $massaction) {
2220 if (in_array($obj->rowid, $arrayofselected)) {
2223 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2227 $totalarray[
'nbfield']++;
2232 if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
2233 print
'<td class="center" data-key="id">'.$obj->rowid.
'</td>';
2235 $totalarray[
'nbfield']++;
2240 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2241 print
'<td class="nowraponall">';
2242 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
2245 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
2246 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2247 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2251 $totalarray[
'nbfield']++;
2256 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2257 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2261 $totalarray[
'nbfield']++;
2266 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2267 print
'<td class="nowrap">';
2268 if ($obj->project_id > 0) {
2269 print $projectstatic->getNomUrl(1);
2273 $totalarray[
'nbfield']++;
2278 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2279 print
'<td class="nowrap">';
2280 if ($obj->project_id > 0) {
2281 print $projectstatic->title;
2285 $totalarray[
'nbfield']++;
2290 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2291 print
'<td class="tdoverflowmax150">';
2293 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2295 print $getNomUrl_cache[$obj->socid];
2300 if ($user->hasRight(
'facture',
'creer')) {
2301 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2302 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2303 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2309 $totalarray[
'nbfield']++;
2314 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2315 print
'<td class="nocellnopadd tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->alias).
'">';
2319 $totalarray[
'nbfield']++;
2324 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2325 print
'<td class="tdoverflowmax200">';
2326 if ($obj->fk_parent > 0) {
2327 if (!isset($company_url_list[$obj->fk_parent])) {
2328 $companyparent =
new Societe($db);
2329 $res = $companyparent->fetch($obj->fk_parent);
2331 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2334 if (isset($company_url_list[$obj->fk_parent])) {
2335 print $company_url_list[$obj->fk_parent];
2340 $totalarray[
'nbfield']++;
2345 if (!empty($arrayfields[
's.town'][
'checked'])) {
2346 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->town).
'">';
2350 $totalarray[
'nbfield']++;
2355 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2356 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->zip).
'">';
2360 $totalarray[
'nbfield']++;
2365 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2366 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->state_name).
'">'.
dolPrintLabel($obj->state_name).
"</td>\n";
2368 $totalarray[
'nbfield']++;
2373 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2374 print
'<td class="center">';
2375 $tmparray =
getCountry($obj->fk_pays,
'all');
2376 print $tmparray[
'label'];
2379 $totalarray[
'nbfield']++;
2384 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2385 print
'<td class="center">';
2386 if (empty($typenArray)) {
2387 $typenArray = $formcompany->typent_array(1);
2389 print $typenArray[$obj->typent_code] ??
'';
2392 $totalarray[
'nbfield']++;
2397 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2398 print
'<td class="center nowraponall">';
2401 if ($generic_commande->hasDelay()) {
2402 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2406 $totalarray[
'nbfield']++;
2411 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2412 print
'<td class="center nowraponall">';
2413 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2416 $totalarray[
'nbfield']++;
2421 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2423 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2426 $totalarray[
'nbfield']++;
2431 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2433 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2436 $totalarray[
'nbfield']++;
2441 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2443 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2446 $totalarray[
'nbfield']++;
2451 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2453 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
2456 $totalarray[
'nbfield']++;
2461 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2462 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2464 $totalarray[
'nbfield']++;
2467 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2469 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2470 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2472 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2477 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2478 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2480 $totalarray[
'nbfield']++;
2483 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2485 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2486 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2488 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2493 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2494 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2496 $totalarray[
'nbfield']++;
2499 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2501 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2502 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2504 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2509 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2510 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2512 $totalarray[
'nbfield']++;
2517 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2518 print
'<td class="nowrap">';
2519 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2522 $totalarray[
'nbfield']++;
2527 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2528 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2530 $totalarray[
'nbfield']++;
2534 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2535 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2537 $totalarray[
'nbfield']++;
2541 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2542 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2544 $totalarray[
'nbfield']++;
2548 $userstatic->id = $obj->fk_user_author;
2549 $userstatic->login = $obj->login;
2550 $userstatic->lastname = $obj->lastname;
2551 $userstatic->firstname = $obj->firstname;
2552 $userstatic->email = $obj->user_email;
2553 $userstatic->status = $obj->user_statut;
2554 $userstatic->entity = $obj->entity;
2555 $userstatic->photo = $obj->photo;
2556 $userstatic->office_phone = $obj->office_phone;
2557 $userstatic->office_fax = $obj->office_fax;
2558 $userstatic->user_mobile = $obj->user_mobile;
2559 $userstatic->job = $obj->job;
2560 $userstatic->gender = $obj->gender;
2563 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2564 print
'<td class="tdoverflowmax150">';
2565 if ($userstatic->id) {
2566 print $userstatic->getNomUrl(-1);
2572 $totalarray[
'nbfield']++;
2577 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2579 if ($obj->socid > 0) {
2580 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2581 if ($listsalesrepresentatives < 0) {
2584 $nbofsalesrepresentative = count($listsalesrepresentatives);
2585 if ($nbofsalesrepresentative > 6) {
2587 print $nbofsalesrepresentative;
2588 } elseif ($nbofsalesrepresentative > 0) {
2590 foreach ($listsalesrepresentatives as $val) {
2591 $userstatic->id = $val[
'id'];
2592 $userstatic->lastname = $val[
'lastname'];
2593 $userstatic->firstname = $val[
'firstname'];
2594 $userstatic->email = $val[
'email'];
2595 $userstatic->status = $val[
'statut'];
2596 $userstatic->entity = $val[
'entity'];
2597 $userstatic->photo = $val[
'photo'];
2598 $userstatic->login = $val[
'login'];
2599 $userstatic->office_phone = $val[
'office_phone'];
2600 $userstatic->office_fax = $val[
'office_fax'];
2601 $userstatic->user_mobile = $val[
'user_mobile'];
2602 $userstatic->job = $val[
'job'];
2603 $userstatic->gender = $val[
'gender'];
2605 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2607 if ($j < $nbofsalesrepresentative) {
2619 $totalarray[
'nbfield']++;
2624 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2625 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2627 $totalarray[
'nbfield']++;
2632 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2633 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2635 $totalarray[
'nbfield']++;
2638 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2641 if (!isset($totalarray[
'val'][
'total_margin'])) {
2642 $totalarray[
'val'][
'total_margin'] = 0;
2645 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2649 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2650 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2652 $totalarray[
'nbfield']++;
2657 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2658 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2660 $totalarray[
'nbfield']++;
2663 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2665 if ($i >= $imaxinloop - 1) {
2666 if (!empty($total_ht)) {
2667 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2669 $totalarray[
'val'][
'total_mark_rate'] =
'';
2675 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2676 print
'<td align="center" class="nowrap">';
2677 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2680 $totalarray[
'nbfield']++;
2685 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2686 print
'<td align="center" class="nowrap">';
2687 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2690 $totalarray[
'nbfield']++;
2695 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2696 print
'<td align="center" class="nowrap">';
2697 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2700 $totalarray[
'nbfield']++;
2705 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2706 print
'<td class="sensiblehtmlcontent center">';
2710 $totalarray[
'nbfield']++;
2715 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2716 print
'<td class="sensiblehtmlcontent center">';
2720 $totalarray[
'nbfield']++;
2725 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2726 print
'<td class="center">';
2727 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2729 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2730 $generic_commande->getLinesArray();
2731 $generic_commande->loadExpeditions();
2733 $numlines = count($generic_commande->lines);
2734 for ($lig = 0; $lig < $numlines; $lig++) {
2735 $orderLine = $generic_commande->lines[$lig];
2736 '@phan-var-force OrderLine $orderLine';
2737 if (isset($generic_commande->expeditions[$orderLine->id])) {
2738 $reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id];
2740 $reliquat = $orderLine->qty;
2742 if ($orderLine->product_type == 0 && $orderLine->fk_product > 0) {
2744 $generic_product->id = $orderLine->fk_product;
2747 if (empty($productstat_cache[$orderLine->fk_product])) {
2748 $generic_product->load_stock(
'nobatch,warehouseopen');
2749 $productstat_cache[$orderLine->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2750 $productstat_cachevirtual[$orderLine->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2752 $generic_product->stock_reel = $productstat_cache[$orderLine->fk_product][
'stock_reel'];
2754 $generic_product->stock_theorique = $productstat_cachevirtual[$orderLine->fk_product][
'stock_reel'];
2757 if ($reliquat > $generic_product->stock_reel) {
2761 $text_info .= $reliquat.
' x '.$orderLine->product_ref.
' '.
dol_trunc($orderLine->product_label, 20);
2762 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2763 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2764 $text_info .= ($reliquat != $orderLine->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($orderLine->qty - $reliquat).
')</span>' :
'');
2765 $text_info .=
'<br>';
2772 $stock_order_supplier = 0;
2774 if (isModEnabled(
'order')) {
2775 if (empty($productstat_cache[$orderLine->fk_product][
'stats_order_customer'])) {
2776 $generic_product->load_stats_commande(0,
'1,2');
2777 $productstat_cache[$orderLine->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2780 $generic_product->stats_commande[
'qty'] = $productstat_cache[$orderLine->fk_product][
'stats_order_customer'];
2782 $stock_order = $generic_product->stats_commande[
'qty'];
2784 if (isModEnabled(
"supplier_order")) {
2785 if (empty($productstat_cache[$orderLine->fk_product][
'stats_order_supplier'])) {
2786 $generic_product->load_stats_commande_fournisseur(0,
'3');
2787 $productstat_cache[$orderLine->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2790 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$orderLine->fk_product][
'stats_order_supplier'];
2792 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2795 $text_info .= $reliquat.
' x '.$orderLine->ref.
' '.
dol_trunc($orderLine->product_label, 20);
2796 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2797 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $orderLine->qty)) {
2799 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2801 if ($reliquat > $generic_product->stock_reel) {
2802 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2804 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2806 if (isModEnabled(
"supplier_order")) {
2807 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2809 $text_info .= ($reliquat != $orderLine->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($orderLine->qty - $reliquat).
')</span>' :
'');
2810 $text_info .=
'<br>';
2814 if ($notshippable == 0) {
2815 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'green paddingleft');
2816 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2818 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'error paddingleft');
2819 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2824 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2827 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2832 $totalarray[
'nbfield']++;
2837 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2839 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2840 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2841 print $hookmanager->resPrint;
2844 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2845 print
'<td class="center">';
2847 print
yn($obj->billed, $langs->trans(
"Billed"));
2851 $totalarray[
'nbfield']++;
2856 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2857 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2859 $totalarray[
'nbfield']++;
2864 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2865 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2867 $totalarray[
'nbfield']++;
2873 print
'<td class="nowrap center">';
2874 if ($massactionbutton || $massaction) {
2876 if (in_array($obj->rowid, $arrayofselected)) {
2879 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2883 $totalarray[
'nbfield']++;
2889 $total += $obj->total_ht;
2890 $subtotal += $obj->total_ht;
2896include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2901 foreach ($arrayfields as $key => $val) {
2902 if (!empty($val[
'checked'])) {
2906 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2911$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2912$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2913print $hookmanager->resPrint;
2915print
'</table>'.
"\n";
2918print
'</form>'.
"\n";
2920if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2921 $hidegeneratedfilelistifempty = 1;
2922 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2923 $hidegeneratedfilelistifempty = 0;
2927 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2928 $urlsource .= str_replace(
'&',
'&', $param);
2930 $filedir = $diroutputmassaction;
2931 $genallowed = $permissiontoread;
2932 $delallowed = $permissiontoadd;
2934 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage absolute discounts.
Class to manage invoices.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dolPrintLabel($s)
Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.