38 require
'../main.inc.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
54 $langs->loadLangs(array(
'orders',
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
57 $action =
GETPOST(
'action',
'aZ09');
58 $massaction =
GETPOST(
'massaction',
'alpha');
59 $show_files =
GETPOST(
'show_files',
'int');
60 $confirm =
GETPOST(
'confirm',
'alpha');
61 $toselect =
GETPOST(
'toselect',
'array');
62 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlist';
63 $mode =
GETPOST(
'mode',
'alpha');
66 $search_datecloture_start =
GETPOST(
'search_datecloture_start',
'int');
67 if (empty($search_datecloture_start)) {
68 $search_datecloture_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datecloture_startmonth',
'int'),
GETPOST(
'search_datecloture_startday',
'int'),
GETPOST(
'search_datecloture_startyear',
'int'));
70 $search_datecloture_end =
GETPOST(
'search_datecloture_end',
'int');
71 if (empty($search_datecloture_end)) {
72 $search_datecloture_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datecloture_endmonth',
'int'),
GETPOST(
'search_datecloture_endday',
'int'),
GETPOST(
'search_datecloture_endyear',
'int'));
74 $search_dateorder_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_dateorder_start_month',
'int'),
GETPOST(
'search_dateorder_start_day',
'int'),
GETPOST(
'search_dateorder_start_year',
'int'));
75 $search_dateorder_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_dateorder_end_month',
'int'),
GETPOST(
'search_dateorder_end_day',
'int'),
GETPOST(
'search_dateorder_end_year',
'int'));
76 $search_datedelivery_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datedelivery_start_month',
'int'),
GETPOST(
'search_datedelivery_start_day',
'int'),
GETPOST(
'search_datedelivery_start_year',
'int'));
77 $search_datedelivery_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datedelivery_end_month',
'int'),
GETPOST(
'search_datedelivery_end_day',
'int'),
GETPOST(
'search_datedelivery_end_year',
'int'));
79 $search_product_category =
GETPOST(
'search_product_category',
'int');
80 $search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
81 $search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
82 $search_company =
GETPOST(
'search_company',
'alpha');
83 $search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
84 $search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
85 $search_town =
GETPOST(
'search_town',
'alpha');
86 $search_zip =
GETPOST(
'search_zip',
'alpha');
87 $search_state =
GETPOST(
'search_state',
'alpha');
88 $search_country =
GETPOST(
'search_country',
'int');
89 $search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'int');
90 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
91 $socid =
GETPOST(
'socid',
'int');
92 $search_user =
GETPOST(
'search_user',
'int');
93 $search_sale =
GETPOST(
'search_sale',
'int');
95 $search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
96 $search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
97 $search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
98 $search_warehouse =
GETPOST(
'search_warehouse',
'int');
100 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
101 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
102 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
103 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
104 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
106 $search_login =
GETPOST(
'search_login',
'alpha');
107 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
108 $optioncss =
GETPOST(
'optioncss',
'alpha');
109 $search_billed =
GETPOST(
'search_billed',
'int');
110 $search_status =
GETPOST(
'search_status',
'int');
111 $search_btn =
GETPOST(
'button_search',
'alpha');
112 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
113 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
114 $search_project =
GETPOST(
'search_project',
'alpha');
115 $search_shippable =
GETPOST(
'search_shippable',
'aZ09');
117 $search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'int');
118 $search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'int');
119 $search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'int');
120 $search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'int');
122 $diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
125 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
126 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
127 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
129 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
133 $offset = $limit * $page;
134 $pageprev = $page - 1;
135 $pagenext = $page + 1;
137 $sortfield =
'c.ref';
143 $show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
147 $hookmanager->initHooks(array(
'orderlist'));
151 $extrafields->fetch_name_optionals_label($object->table_element);
152 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
155 $fieldstosearchall = array(
157 'c.ref_client'=>
'RefCustomerOrder',
158 'pd.description'=>
'Description',
159 's.nom'=>
"ThirdParty",
160 's.name_alias'=>
"AliasNameShort",
163 'c.note_public'=>
'NotePublic',
165 if (empty($user->socid)) {
166 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
169 $checkedtypetiers = 0;
170 $arrayfields = array(
171 'c.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
172 'c.ref_client'=>array(
'label'=>
"RefCustomerOrder",
'checked'=>-1,
'position'=>10),
173 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>-1,
'enabled'=>(!
isModEnabled(
'project') ? 0 : 1),
'position'=>20),
174 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(!
isModEnabled(
'project') ? 0 : 1),
'position'=>25),
175 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>30),
176 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>-1,
'position'=>31),
177 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>32,
'checked'=>0),
178 's.town'=>array(
'label'=>
"Town",
'checked'=>-1,
'position'=>35),
179 's.zip'=>array(
'label'=>
"Zip",
'checked'=>-1,
'position'=>40),
180 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>45),
181 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>50),
182 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>55),
183 'c.date_commande'=>array(
'label'=>
"OrderDateShort",
'checked'=>1,
'position'=>60),
184 'c.date_delivery'=>array(
'label'=>
"DateDeliveryPlanned",
'checked'=>1,
'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE),
'position'=>65),
185 'c.fk_shipping_method'=>array(
'label'=>
"SendingMethod",
'checked'=>-1,
'position'=>66 ,
'enabled'=>
isModEnabled(
"expedition")),
186 'c.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>-1,
'position'=>67),
187 'c.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>-1,
'position'=>68),
188 'c.fk_input_reason'=>array(
'label'=>
"Channel",
'checked'=>-1,
'position'=>69),
189 'c.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>75),
190 'c.total_vat'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>80),
191 'c.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>85),
192 'c.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>90),
193 'c.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>95),
194 'c.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>100),
195 'c.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>105),
196 'c.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>110),
197 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>115),
198 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>0,
'position'=>116),
199 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
200 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
201 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
202 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
203 'c.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>120),
204 'c.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>125),
205 'c.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>130),
206 'c.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position'=>135),
207 'c.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position'=>140),
208 'shippable'=>array(
'label'=>
"Shippable",
'checked'=>1,
'enabled'=>(
isModEnabled(
"expedition")),
'position'=>990),
209 'c.facture'=>array(
'label'=>
"Billed",
'checked'=>1,
'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)),
'position'=>995),
210 'c.import_key' =>array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>1,
'visible'=>-2,
'position'=>999),
211 'c.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000)
215 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
224 $socid = $user->socid;
235 if (
GETPOST(
'cancel',
'alpha')) {
236 $action =
'list'; $massaction =
'';
238 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
242 $parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
243 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
248 if (empty($reshook)) {
250 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
253 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
257 $search_product_category =
'';
259 $search_ref_customer =
'';
260 $search_company =
'';
261 $search_company_alias =
'';
262 $search_parent_name =
'';
267 $search_country =
'';
268 $search_type_thirdparty =
'';
269 $search_total_ht =
'';
270 $search_total_vat =
'';
271 $search_total_ttc =
'';
272 $search_warehouse =
'';
273 $search_multicurrency_code =
'';
274 $search_multicurrency_tx =
'';
275 $search_multicurrency_montant_ht =
'';
276 $search_multicurrency_montant_vat =
'';
277 $search_multicurrency_montant_ttc =
'';
279 $search_dateorder_start =
'';
280 $search_dateorder_end =
'';
281 $search_datedelivery_start =
'';
282 $search_datedelivery_end =
'';
283 $search_project_ref =
'';
284 $search_project =
'';
288 $search_array_options = array();
289 $search_categ_cus = 0;
290 $search_datecloture_start =
'';
291 $search_datecloture_end =
'';
292 $search_fk_cond_reglement =
'';
293 $search_fk_shipping_method =
'';
294 $search_fk_mode_reglement =
'';
295 $search_fk_input_reason =
'';
297 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
298 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
303 $objectclass =
'Commande';
304 $objectlabel =
'Orders';
305 $permissiontoread = $user->hasRight(
"commande",
"lire");
306 $permissiontoadd = $user->hasRight(
"commande",
"creer");
307 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
308 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
309 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
310 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
311 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
312 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
314 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
315 $permissiontoclose = $user->hasRight(
"commande",
"creer");
316 $permissiontocancel = $user->hasRight(
"commande",
"creer");
317 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
319 $uploaddir = $conf->commande->multidir_output[$conf->entity];
320 $triggersendname =
'ORDER_SENTBYMAIL';
321 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
323 if ($massaction ==
'confirm_createbills') {
324 $orders =
GETPOST(
'toselect',
'array');
325 $createbills_onebythird =
GETPOST(
'createbills_onebythird',
'int');
326 $validate_invoices =
GETPOST(
'validate_invoices',
'int');
331 $TFactThird = array();
332 $TFactThirdNbLines = array();
334 $nb_bills_created = 0;
340 $nbOrders = is_array($orders) ? count($orders) : 1;
342 foreach ($orders as $id_order) {
344 if ($cmd->fetch($id_order) <= 0) {
347 $cmd->fetch_thirdparty();
350 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
352 $objecttmp = $TFactThird[$cmd->socid];
355 $objecttmp->socid = $cmd->socid;
356 $objecttmp->thirdparty = $cmd->thirdparty;
358 $objecttmp->type = $objecttmp::TYPE_STANDARD;
359 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
360 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
362 $objecttmp->fk_project = $cmd->fk_project;
363 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
364 if (empty($createbills_onebythird)) {
365 $objecttmp->ref_client = $cmd->ref_client;
369 if (empty($datefacture)) {
373 $objecttmp->date = $datefacture;
374 $objecttmp->origin =
'commande';
375 $objecttmp->origin_id = $id_order;
377 $objecttmp->array_options = $cmd->array_options;
379 $res = $objecttmp->create($user);
383 $lastref = $objecttmp->ref;
384 $lastid = $objecttmp->id;
386 $TFactThird[$cmd->socid] = $objecttmp;
387 $TFactThirdNbLines[$cmd->socid] = 0;
389 $langs->load(
"errors");
390 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
395 if ($objecttmp->id > 0) {
396 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
399 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
404 $lines = $cmd->lines;
405 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
407 $lines = $cmd->lines;
411 $num = count($lines);
413 for ($i = 0; $i < $num; $i++) {
414 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
416 if (!empty($createbills_onebythird)) {
420 if ($lines[$i]->subprice < 0 && empty($conf->global->INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN)) {
423 $discount->fk_soc = $objecttmp->socid;
424 $discount->amount_ht = abs($lines[$i]->total_ht);
425 $discount->amount_tva = abs($lines[$i]->total_tva);
426 $discount->amount_ttc = abs($lines[$i]->total_ttc);
427 $discount->tva_tx = $lines[$i]->tva_tx;
428 $discount->fk_user = $user->id;
429 $discount->description = $desc;
430 $discountid = $discount->create($user);
431 if ($discountid > 0) {
432 $result = $objecttmp->insert_discount($discountid);
441 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
444 if ($lines[$i]->date_debut_prevue) {
445 $date_start = $lines[$i]->date_debut_prevue;
447 if ($lines[$i]->date_debut_reel) {
448 $date_start = $lines[$i]->date_debut_reel;
450 if ($lines[$i]->date_start) {
451 $date_start = $lines[$i]->date_start;
455 if ($lines[$i]->date_fin_prevue) {
456 $date_end = $lines[$i]->date_fin_prevue;
458 if ($lines[$i]->date_fin_reel) {
459 $date_end = $lines[$i]->date_fin_reel;
461 if ($lines[$i]->date_end) {
462 $date_end = $lines[$i]->date_end;
465 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
470 if (method_exists($lines[$i],
'fetch_optionals')) {
471 $lines[$i]->fetch_optionals();
472 $array_options = $lines[$i]->array_options;
475 $objecttmp->context[
'createfromclone'] =
'createfromclone';
477 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
479 if (!empty($createbills_onebythird)) {
480 $rang = $TFactThirdNbLines[$cmd->socid];
483 $result = $objecttmp->addline(
485 $lines[$i]->subprice,
488 $lines[$i]->localtax1_tx,
489 $lines[$i]->localtax2_tx,
490 $lines[$i]->fk_product,
491 $lines[$i]->remise_percent,
495 $lines[$i]->info_bits,
496 $lines[$i]->fk_remise_except,
501 $lines[$i]->special_code,
505 $lines[$i]->fk_fournprice,
515 if (!empty($createbills_onebythird))
516 $TFactThirdNbLines[$cmd->socid]++;
520 $errors[] = $objecttmp->error;
524 if ($result > 0 && $lines[$i]->product_type == 9) {
525 $fk_parent_line = $result;
534 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
535 $TFactThird[$cmd->socid] = $objecttmp;
537 $TFact[$objecttmp->id] = $objecttmp;
542 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
545 if (!$error && $validate_invoices) {
546 $massaction = $action =
'builddoc';
548 foreach ($TAllFact as &$objecttmp) {
549 $result = $objecttmp->validate($user);
556 $id = $objecttmp->id;
560 $upload_dir = $conf->facture->dir_output;
561 $permissiontoadd = $user->hasRight(
'facture',
'creer');
564 $savobject = $object;
565 $object = $objecttmp;
566 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
567 $object = $savobject;
570 $massaction = $action =
'confirm_createbills';
576 if ($nb_bills_created == 1) {
577 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
578 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode($lastid).
'">'.$lastref.
'</a>', $texttoshow);
581 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
587 $param .=
'&mode='.urlencode($mode);
589 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
590 $param .=
'&contextpage='.urlencode($contextpage);
592 if ($limit > 0 && $limit != $conf->liste_limit) {
593 $param .=
'&limit='.((int) $limit);
596 $param .=
'&sall='.urlencode($sall);
599 $param .=
'&socid='.urlencode($socid);
601 if ($search_status !=
'') {
602 $param .=
'&search_status='.urlencode($search_status);
604 if ($search_orderday) {
605 $param .=
'&search_orderday='.urlencode($search_orderday);
607 if ($search_ordermonth) {
608 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
610 if ($search_orderyear) {
611 $param .=
'&search_orderyear='.urlencode($search_orderyear);
613 if ($search_deliveryday) {
614 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
616 if ($search_deliverymonth) {
617 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
619 if ($search_deliveryyear) {
620 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
623 $param .=
'&search_ref='.urlencode($search_ref);
625 if ($search_company) {
626 $param .=
'&search_company='.urlencode($search_company);
628 if ($search_ref_customer) {
629 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
631 if ($search_user > 0) {
632 $param .=
'&search_user='.urlencode($search_user);
634 if ($search_sale > 0) {
635 $param .=
'&search_sale='.urlencode($search_sale);
637 if ($search_total_ht !=
'') {
638 $param .=
'&search_total_ht='.urlencode($search_total_ht);
640 if ($search_total_vat !=
'') {
641 $param .=
'&search_total_vat='.urlencode($search_total_vat);
643 if ($search_total_ttc !=
'') {
644 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
646 if ($search_project_ref >= 0) {
647 $param .=
"&search_project_ref=".urlencode($search_project_ref);
650 $param .=
'&show_files='.urlencode($show_files);
652 if ($optioncss !=
'') {
653 $param .=
'&optioncss='.urlencode($optioncss);
656 $param .=
'&billed='.urlencode($billed);
659 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
665 $_GET[
"origin"] = $_POST[
"origin"];
666 $_GET[
"originid"] = $_POST[
"originid"];
667 if (!empty($errors)) {
676 if ($action ==
'validate' && $permissiontoadd) {
677 if (
GETPOST(
'confirm') ==
'yes') {
678 $objecttmp =
new $objectclass($db);
681 foreach ($toselect as $checked) {
682 if ($objecttmp->fetch($checked)) {
683 if ($objecttmp->statut == 0) {
684 if (!empty($objecttmp->fk_warehouse)) {
685 $idwarehouse = $objecttmp->fk_warehouse;
689 if ($objecttmp->valid($user, $idwarehouse)) {
690 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
696 $langs->load(
"errors");
697 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
712 if ($action ==
'shipped' && $permissiontoadd) {
713 if (
GETPOST(
'confirm') ==
'yes') {
714 $objecttmp =
new $objectclass($db);
717 foreach ($toselect as $checked) {
718 if ($objecttmp->fetch($checked)) {
719 if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
720 if ($objecttmp->cloture($user)) {
721 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
723 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
727 $langs->load(
"errors");
728 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
745 if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
748 $objecttmp =
new $objectclass($db);
750 foreach ($toselect as $toselectid) {
751 $result = $objecttmp->fetch($toselectid);
753 $result = $objecttmp->classifyBilled($user, 0);
793 $companystatic =
new Societe($db);
794 $company_url_list = array();
796 $projectstatic =
new Project($db);
800 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
801 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
803 $title = $langs->trans(
"Orders");
804 $help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
809 if ($sall || $search_user > 0) {
810 $sql =
'SELECT DISTINCT';
812 $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,';
813 $sql .=
" s.parent as fk_parent,";
814 $sql .=
" s2.nom as name2,";
815 $sql .=
" typent.code as typent_code,";
816 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
817 $sql .=
" country.code as country_code,";
818 $sql .=
' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
819 $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,';
820 $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,';
821 $sql .=
' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
822 $sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
823 $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,';
824 $sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
825 $sql .=
' c.fk_input_reason, c.import_key';
826 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
827 $sql .=
", cc.fk_categorie, cc.fk_soc";
831 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
832 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
833 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
838 $parameters = array();
839 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
840 $sql .= $hookmanager->resPrint;
841 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
845 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
846 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
847 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
848 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
849 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
850 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
851 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
853 $sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
854 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
855 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
858 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
860 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
861 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
864 if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
865 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
867 if ($search_user > 0) {
868 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
869 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
873 $parameters = array();
874 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
875 $sql .= $hookmanager->resPrint;
877 $sql .=
' WHERE c.fk_soc = s.rowid';
878 $sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
880 $sql .=
' AND s.rowid = '.((int) $socid);
882 if (empty($user->rights->societe->client->voir) && !$socid) {
883 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
888 if ($search_ref_customer) {
894 if ($search_billed !=
'' && $search_billed >= 0) {
895 $sql .=
' AND c.facture = '.((int) $search_billed);
897 if ($search_status <>
'') {
898 if ($search_status <= 3 && $search_status >= -1) {
899 if ($search_status == 1 && !
isModEnabled(
'expedition')) {
900 $sql .=
' AND c.fk_statut IN (1,2)';
902 $sql .=
' AND c.fk_statut = '.((int) $search_status);
905 if ($search_status == -2) {
907 $sql .=
" AND (c.fk_statut IN (1,2))";
909 if ($search_status == -3) {
912 $sql .=
' AND (c.fk_statut IN (1,2,3))';
914 if ($search_status == -4) {
915 $sql .=
' AND (c.fk_statut IN (1,2))';
919 if ($search_datecloture_start) {
920 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
922 if ($search_datecloture_end) {
923 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
925 if ($search_dateorder_start) {
926 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
928 if ($search_dateorder_end) {
929 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
931 if ($search_datedelivery_start) {
932 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
934 if ($search_datedelivery_end) {
935 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
946 if ($search_country) {
947 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
949 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
950 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
952 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
955 if ($search_company) {
958 if ($search_company_alias) {
962 if ($search_parent_name) {
965 if ($search_sale > 0) {
966 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
968 if ($search_user > 0) {
969 $sql .=
" AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user);
971 if ($search_total_ht !=
'') {
974 if ($search_total_vat !=
'') {
977 if ($search_total_ttc !=
'') {
980 if ($search_warehouse !=
'' && $search_warehouse > 0) {
983 if ($search_multicurrency_code !=
'') {
984 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
986 if ($search_multicurrency_tx !=
'') {
989 if ($search_multicurrency_montant_ht !=
'') {
990 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
992 if ($search_multicurrency_montant_vat !=
'') {
993 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
995 if ($search_multicurrency_montant_ttc !=
'') {
996 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1001 if ($search_project_ref !=
'') {
1004 if ($search_project !=
'') {
1007 if ($search_categ_cus > 0) {
1008 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
1010 if ($search_categ_cus == -2) {
1011 $sql .=
" AND cc.fk_categorie IS NULL";
1013 if ($search_fk_cond_reglement > 0) {
1014 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1016 if ($search_fk_shipping_method > 0) {
1017 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1019 if ($search_fk_mode_reglement > 0) {
1020 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1022 if ($search_fk_input_reason > 0) {
1023 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1026 $searchCategoryProductOperator = -1;
1027 $searchCategoryProductList = array($search_product_category);
1028 if (!empty($searchCategoryProductList)) {
1029 $searchCategoryProductSqlList = array();
1030 $listofcategoryid =
'';
1031 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1032 if (intval($searchCategoryProduct) == -2) {
1033 $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)";
1034 } elseif (intval($searchCategoryProduct) > 0) {
1035 if ($searchCategoryProductOperator == 0) {
1036 $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).
")";
1038 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1042 if ($listofcategoryid) {
1043 $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).
"))";
1045 if ($searchCategoryProductOperator == 1) {
1046 if (!empty($searchCategoryProductSqlList)) {
1047 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1050 if (!empty($searchCategoryProductSqlList)) {
1051 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1056 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1058 $parameters = array();
1059 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1060 $sql .= $hookmanager->resPrint;
1063 $parameters = array();
1064 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1065 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1068 $nbtotalofrecords =
'';
1071 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
1072 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1073 $resql = $db->query($sqlforcount);
1075 $objforcount = $db->fetch_object($resql);
1076 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1081 if (($page * $limit) > $nbtotalofrecords) {
1088 $sql .= $db->order($sortfield, $sortorder);
1090 $sql .= $db->plimit($limit + 1, $offset);
1094 $resql = $db->query(
$sql);
1102 $soc->fetch($socid);
1103 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1104 if (empty($search_company)) {
1105 $search_company = $soc->name;
1108 $title = $langs->trans(
'CustomersOrders');
1110 if (strval($search_status) ==
'0') {
1111 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1113 if ($search_status == 1) {
1114 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1116 if ($search_status == 2) {
1117 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1119 if ($search_status == 3) {
1120 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1122 if ($search_status == -1) {
1123 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1125 if ($search_status == -2) {
1126 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1128 if ($search_status == -3) {
1129 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!
isModEnabled(
'expedition') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1131 if ($search_status == -4) {
1132 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1135 $num = $db->num_rows($resql);
1137 $arrayofselected = is_array($toselect) ? $toselect : array();
1139 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
1140 $obj = $db->fetch_object($resql);
1142 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
1151 $arrayofselected = is_array($toselect) ? $toselect : array();
1154 if (!empty($mode)) {
1155 $param .=
'&mode='.urlencode($mode);
1157 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1158 $param .=
'&contextpage='.urlencode($contextpage);
1160 if ($limit > 0 && $limit != $conf->liste_limit) {
1161 $param .=
'&limit='.((int) $limit);
1164 $param .=
'&sall='.urlencode($sall);
1167 $param .=
'&socid='.urlencode($socid);
1169 if ($search_status !=
'') {
1170 $param .=
'&search_status='.urlencode($search_status);
1172 if ($search_datecloture_start) {
1173 $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');
1175 if ($search_datecloture_end) {
1176 $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');
1178 if ($search_dateorder_start) {
1179 $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');
1181 if ($search_dateorder_end) {
1182 $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');
1184 if ($search_datedelivery_start) {
1185 $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');
1187 if ($search_datedelivery_end) {
1188 $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');
1191 $param .=
'&search_ref='.urlencode($search_ref);
1193 if ($search_company) {
1194 $param .=
'&search_company='.urlencode($search_company);
1196 if ($search_company_alias) {
1197 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1199 if ($search_parent_name !=
'') {
1200 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1202 if ($search_ref_customer) {
1203 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1205 if ($search_user > 0) {
1206 $param .=
'&search_user='.urlencode($search_user);
1208 if ($search_sale > 0) {
1209 $param .=
'&search_sale='.urlencode($search_sale);
1211 if ($search_total_ht !=
'') {
1212 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1214 if ($search_total_vat !=
'') {
1215 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1217 if ($search_total_ttc !=
'') {
1218 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1220 if ($search_warehouse !=
'') {
1221 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1223 if ($search_login) {
1224 $param .=
'&search_login='.urlencode($search_login);
1226 if ($search_multicurrency_code !=
'') {
1227 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1229 if ($search_multicurrency_tx !=
'') {
1230 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1232 if ($search_multicurrency_montant_ht !=
'') {
1233 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1235 if ($search_multicurrency_montant_vat !=
'') {
1236 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1238 if ($search_multicurrency_montant_ttc !=
'') {
1239 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1241 if ($search_project_ref >= 0) {
1242 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1244 if ($search_town !=
'') {
1245 $param .=
'&search_town='.urlencode($search_town);
1247 if ($search_zip !=
'') {
1248 $param .=
'&search_zip='.urlencode($search_zip);
1250 if ($search_state !=
'') {
1251 $param .=
'&search_state='.urlencode($search_state);
1253 if ($search_country !=
'') {
1254 $param .=
'&search_country='.urlencode($search_country);
1256 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1257 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1259 if ($search_product_category !=
'') {
1260 $param .=
'&search_product_category='.urlencode($search_product_category);
1262 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1263 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1266 $param .=
'&show_files='.urlencode($show_files);
1268 if ($optioncss !=
'') {
1269 $param .=
'&optioncss='.urlencode($optioncss);
1271 if ($search_billed !=
'') {
1272 $param .=
'&search_billed='.urlencode($search_billed);
1274 if ($search_fk_cond_reglement > 0) {
1275 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
1277 if ($search_fk_shipping_method > 0) {
1278 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
1280 if ($search_fk_mode_reglement > 0) {
1281 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
1283 if ($search_fk_input_reason > 0) {
1284 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
1288 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1291 $parameters = array();
1292 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1293 $param .= $hookmanager->resPrint;
1296 $arrayofmassactions = array(
1297 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1298 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1300 if ($permissiontovalidate) {
1301 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1303 if ($permissiontoclose) {
1304 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1306 if ($permissiontoclose) {
1307 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1309 if ($permissiontocancel) {
1310 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel");
1312 if (!empty($permissiontodelete)) {
1313 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1315 if (
isModEnabled(
'facture') && $user->hasRight(
"facture",
"creer")) {
1316 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1318 if ($permissiontosendbymail) {
1319 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1321 if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1322 $arrayofmassactions = array();
1324 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1326 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1327 if (!empty($socid)) {
1328 $url .=
'&socid='.$socid;
1330 $newcardbutton =
'';
1331 $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'));
1332 $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'));
1333 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', $contextpage ==
'orderlist' && $permissiontoadd);
1336 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1337 if ($optioncss !=
'') {
1338 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1340 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1341 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1342 print
'<input type="hidden" name="action" value="list">';
1343 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1344 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1345 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1346 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1347 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1348 print
'<input type="hidden" name="page_y" value="">';
1349 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1352 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1354 $topicmail =
"SendOrderRef";
1355 $modelmail =
"order_send";
1357 $trackid =
'ord'.$object->id;
1358 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1360 if ($massaction ==
'prevalidate') {
1361 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1363 if ($massaction ==
'preshipped') {
1364 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1367 if ($massaction ==
'createbills') {
1368 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1370 print
'<table class="noborder centpercent">';
1373 print $langs->trans(
'DateInvoice');
1376 print
$form->selectDate(
'',
'',
'',
'',
'',
'', 1, 1);
1381 print $langs->trans(
'CreateOneBillByThird');
1384 print
$form->selectyesno(
'createbills_onebythird',
'', 1);
1389 print $langs->trans(
'ValidateInvoices');
1392 if (
isModEnabled(
'stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
1393 print
$form->selectyesno(
'validate_invoices', 0, 1, 1);
1394 $langs->load(
"errors");
1395 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1397 print
$form->selectyesno(
'validate_invoices', 0, 1);
1399 if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) {
1400 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1402 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1408 print
'<div class="center">';
1409 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1410 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1417 foreach ($fieldstosearchall as $key => $val) {
1418 $fieldstosearchall[$key] = $langs->trans($val);
1419 $setupstring .= $key.
"=".$val.
";";
1421 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1422 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1425 $moreforfilter =
'';
1428 if ($user->hasRight(
"user",
"user",
"lire")) {
1429 $langs->load(
"commercial");
1430 $moreforfilter .=
'<div class="divsearchfield">';
1431 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1432 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1433 $moreforfilter .=
'</div>';
1436 if ($user->hasRight(
"user",
"user",
"lire")) {
1437 $moreforfilter .=
'<div class="divsearchfield">';
1438 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1439 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1440 $moreforfilter .=
'</div>';
1444 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1445 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1446 $moreforfilter .=
'<div class="divsearchfield">';
1447 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1448 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1449 $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);
1450 $moreforfilter .=
'</div>';
1453 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1454 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1455 $moreforfilter .=
'<div class="divsearchfield">';
1456 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1457 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1458 $moreforfilter .=
'</div>';
1461 if (
isModEnabled(
'stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
1462 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1464 $moreforfilter .=
'<div class="divsearchfield">';
1465 $tmptitle = $langs->trans(
'Warehouse');
1466 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1467 $moreforfilter .=
'</div>';
1469 $parameters = array();
1470 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1471 if (empty($reshook)) {
1472 $moreforfilter .= $hookmanager->resPrint;
1474 $moreforfilter = $hookmanager->resPrint;
1477 if (!empty($moreforfilter)) {
1478 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1479 print $moreforfilter;
1480 $parameters = array();
1481 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1482 print $hookmanager->resPrint;
1486 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1487 $selectedfields = ($mode !=
'kanban' ?
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
1488 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1490 if (
GETPOST(
'autoselectall',
'int')) {
1491 $selectedfields .=
'<script>';
1492 $selectedfields .=
' $(document).ready(function() {';
1493 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1494 $selectedfields .=
' $("#checkforselects").click();';
1495 $selectedfields .=
' $("#massaction").val("createbills").change();';
1496 $selectedfields .=
' });';
1497 $selectedfields .=
'</script>';
1500 print
'<div class="div-table-responsive">';
1501 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1505 print
'<tr class="liste_titre_filter">';
1508 print
'<td class="liste_titre center maxwidthsearch">';
1509 $searchpicto =
$form->showFilterButtons(
'left');
1515 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1516 print
'<td class="liste_titre">';
1517 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1521 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1522 print
'<td class="liste_titre" align="left">';
1523 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1527 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1528 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1531 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1532 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1535 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1536 print
'<td class="liste_titre" align="left">';
1537 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1541 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1542 print
'<td class="liste_titre" align="left">';
1543 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1547 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1548 print
'<td class="liste_titre">';
1549 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1553 if (!empty($arrayfields[
's.town'][
'checked'])) {
1554 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1557 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1558 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1561 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1562 print
'<td class="liste_titre">';
1563 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1567 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1568 print
'<td class="liste_titre" align="center">';
1569 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1573 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1574 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1575 print
$form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
1579 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1580 print
'<td class="liste_titre center">';
1581 print
'<div class="nowrap">';
1582 print
$form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1584 print
'<div class="nowrap">';
1585 print
$form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1589 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1590 print
'<td class="liste_titre center">';
1591 print
'<div class="nowrap">';
1592 print
$form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1594 print
'<div class="nowrap">';
1595 print
$form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1600 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1601 print
'<td class="liste_titre">';
1602 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1606 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1607 print
'<td class="liste_titre">';
1608 print
$form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1612 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1613 print
'<td class="liste_titre">';
1614 print
$form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1618 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1619 print
'<td class="liste_titre">';
1620 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1624 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1625 print
'<td class="liste_titre right">';
1626 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1630 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1631 print
'<td class="liste_titre right">';
1632 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1636 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1637 print
'<td class="liste_titre right">';
1638 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1642 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1643 print
'<td class="liste_titre">';
1644 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1648 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1649 print
'<td class="liste_titre">';
1650 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1654 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1655 print
'<td class="liste_titre right">';
1656 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1660 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1661 print
'<td class="liste_titre right">';
1662 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1666 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1667 print
'<td class="liste_titre right">';
1668 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1672 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1673 print
'<td class="liste_titre">';
1674 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1678 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1679 print
'<td class="liste_titre"></td>';
1681 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1682 print
'<td class="liste_titre right">';
1685 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1686 print
'<td class="liste_titre right">';
1689 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1690 print
'<td class="liste_titre right">';
1693 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1694 print
'<td class="liste_titre right">';
1699 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1702 $parameters = array(
'arrayfields'=>$arrayfields);
1703 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1704 print $hookmanager->resPrint;
1707 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1708 print
'<td class="liste_titre">';
1712 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1713 print
'<td class="liste_titre">';
1717 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1718 print
'<td class="liste_titre center">';
1719 print
'<div class="nowrap">';
1720 print
$form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1722 print
'<div class="nowrap">';
1723 print
$form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1728 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1729 print
'<td class="liste_titre">';
1733 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1734 print
'<td class="liste_titre">';
1738 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1739 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1741 if (!empty($conf->global->ORDER_SHIPABLE_STATUS_DISABLED_BY_DEFAULT)) {
1742 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1743 print $langs->trans(
'ShowShippableStatus');
1745 $show_shippable_command = 1;
1750 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1751 print
'<td class="liste_titre maxwidthonsmartphone center">';
1752 print
$form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1756 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1757 print
'<td class="liste_titre maxwidthonsmartphone center">';
1761 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1762 print
'<td class="liste_titre right parentonrightofpage">';
1763 $liststatus = array(
1768 -3=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1769 -2=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1772 print
$form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1777 print
'<td class="liste_titre center maxwidthsearch">';
1778 $searchpicto =
$form->showFilterButtons();
1784 $totalarray = array(
1797 print
'<tr class="liste_titre">';
1801 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1802 $totalarray[
'nbfield']++;
1804 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1805 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1806 $totalarray[
'nbfield']++;
1808 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1809 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1810 $totalarray[
'nbfield']++;
1812 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1813 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1814 $totalarray[
'nbfield']++;
1816 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1817 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1818 $totalarray[
'nbfield']++;
1820 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1821 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1822 $totalarray[
'nbfield']++;
1824 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1825 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1826 $totalarray[
'nbfield']++;
1828 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1829 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1830 $totalarray[
'nbfield']++;
1832 if (!empty($arrayfields[
's.town'][
'checked'])) {
1833 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1834 $totalarray[
'nbfield']++;
1836 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1837 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1838 $totalarray[
'nbfield']++;
1840 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1841 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1842 $totalarray[
'nbfield']++;
1844 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1845 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1846 $totalarray[
'nbfield']++;
1848 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1849 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1850 $totalarray[
'nbfield']++;
1852 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1853 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1854 $totalarray[
'nbfield']++;
1856 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1857 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1858 $totalarray[
'nbfield']++;
1860 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1861 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1862 $totalarray[
'nbfield']++;
1864 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1865 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1866 $totalarray[
'nbfield']++;
1868 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1869 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1870 $totalarray[
'nbfield']++;
1872 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1873 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1874 $totalarray[
'nbfield']++;
1876 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1877 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1878 $totalarray[
'nbfield']++;
1880 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1881 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1882 $totalarray[
'nbfield']++;
1884 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1885 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1886 $totalarray[
'nbfield']++;
1888 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1889 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1890 $totalarray[
'nbfield']++;
1892 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1893 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1894 $totalarray[
'nbfield']++;
1896 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1897 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1898 $totalarray[
'nbfield']++;
1900 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1901 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1902 $totalarray[
'nbfield']++;
1904 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1905 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1906 $totalarray[
'nbfield']++;
1908 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1909 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1910 $totalarray[
'nbfield']++;
1912 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1913 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1914 $totalarray[
'nbfield']++;
1916 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1917 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1918 $totalarray[
'nbfield']++;
1920 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1921 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1922 $totalarray[
'nbfield']++;
1924 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1925 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1926 $totalarray[
'nbfield']++;
1928 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1929 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1930 $totalarray[
'nbfield']++;
1934 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1937 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1938 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1939 print $hookmanager->resPrint;
1940 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1941 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1942 $totalarray[
'nbfield']++;
1944 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1945 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1946 $totalarray[
'nbfield']++;
1948 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1949 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1950 $totalarray[
'nbfield']++;
1952 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1953 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1954 $totalarray[
'nbfield']++;
1956 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1957 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1958 $totalarray[
'nbfield']++;
1960 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1961 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1962 $totalarray[
'nbfield']++;
1964 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1965 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1966 $totalarray[
'nbfield']++;
1968 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1969 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1970 $totalarray[
'nbfield']++;
1972 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1973 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
1974 $totalarray[
'nbfield']++;
1978 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1979 $totalarray[
'nbfield']++;
1985 $productstat_cache = array();
1986 $productstat_cachevirtual = array();
1987 $getNomUrl_cache = array();
1989 $generic_commande =
new Commande($db);
1990 $generic_product =
new Product($db);
1991 $userstatic =
new User($db);
1993 $with_margin_info =
false;
1995 !empty($arrayfields[
'total_pa'][
'checked'])
1996 || !empty($arrayfields[
'total_margin'][
'checked'])
1997 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1998 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2001 $with_margin_info =
true;
2010 $savnbfield = $totalarray[
'nbfield'];
2011 $totalarray = array();
2012 $totalarray[
'nbfield'] = 0;
2013 $imaxinloop = ($limit ? min($num, $limit) : $num);
2014 while ($i < $imaxinloop) {
2015 $obj = $db->fetch_object($resql);
2026 $companystatic->id = $obj->socid;
2027 $companystatic->name = $obj->name;
2028 $companystatic->name_alias = $obj->alias;
2029 $companystatic->client = $obj->client;
2030 $companystatic->fournisseur = $obj->fournisseur;
2031 $companystatic->code_client = $obj->code_client;
2032 $companystatic->email = $obj->email;
2033 $companystatic->phone = $obj->phone;
2034 $companystatic->address = $obj->address;
2035 $companystatic->zip = $obj->zip;
2036 $companystatic->town = $obj->town;
2037 $companystatic->country_code = $obj->country_code;
2038 if (!isset($getNomUrl_cache[$obj->socid])) {
2039 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2042 $generic_commande->id = $obj->rowid;
2043 $generic_commande->ref = $obj->ref;
2044 $generic_commande->statut = $obj->fk_statut;
2045 $generic_commande->billed = $obj->billed;
2046 $generic_commande->date = $db->jdate($obj->date_commande);
2047 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2048 $generic_commande->ref_client = $obj->ref_client;
2049 $generic_commande->total_ht = $obj->total_ht;
2050 $generic_commande->total_tva = $obj->total_tva;
2051 $generic_commande->total_ttc = $obj->total_ttc;
2052 $generic_commande->note_public = $obj->note_public;
2053 $generic_commande->note_private = $obj->note_private;
2055 $generic_commande->thirdparty = $companystatic;
2058 $projectstatic->id = $obj->project_id;
2059 $projectstatic->ref = $obj->project_ref;
2060 $projectstatic->title = $obj->project_label;
2062 $marginInfo = array();
2063 if ($with_margin_info ===
true) {
2064 $generic_commande->fetch_lines();
2065 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2066 $total_ht += $obj->total_ht;
2067 $total_margin += $marginInfo[
'total_margin'];
2070 if ($mode ==
'kanban') {
2072 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2073 print
'<div class="box-flex-container kanban">';
2078 if ($massactionbutton || $massaction) {
2080 if (in_array($object->id, $arrayofselected)) {
2084 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2085 if ($i == ($imaxinloop - 1)) {
2092 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
2096 print
'<td class="nowrap center">';
2097 if ($massactionbutton || $massaction) {
2099 if (in_array($obj->rowid, $arrayofselected)) {
2102 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2106 $totalarray[
'nbfield']++;
2111 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2112 print
'<td class="nowraponall">';
2113 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
2116 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
2117 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2118 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2122 $totalarray[
'nbfield']++;
2127 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2128 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2132 $totalarray[
'nbfield']++;
2137 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2138 print
'<td class="nowrap">';
2139 if ($obj->project_id > 0) {
2140 print $projectstatic->getNomUrl(1);
2144 $totalarray[
'nbfield']++;
2149 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2150 print
'<td class="nowrap">';
2151 if ($obj->project_id > 0) {
2152 print $projectstatic->title;
2156 $totalarray[
'nbfield']++;
2161 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2162 print
'<td class="tdoverflowmax150">';
2164 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2166 print $getNomUrl_cache[$obj->socid];
2170 if (
isModEnabled(
'facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
2171 if ($user->hasRight(
'facture',
'creer')) {
2172 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2173 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2174 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2180 $totalarray[
'nbfield']++;
2185 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2186 print
'<td class="nocellnopadd">';
2190 $totalarray[
'nbfield']++;
2195 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2196 print
'<td class="tdoverflowmax200">';
2197 if ($obj->fk_parent > 0) {
2198 if (!isset($company_url_list[$obj->fk_parent])) {
2199 $companyparent =
new Societe($db);
2200 $res = $companyparent->fetch($obj->fk_parent);
2202 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2205 if (isset($company_url_list[$obj->fk_parent])) {
2206 print $company_url_list[$obj->fk_parent];
2211 $totalarray[
'nbfield']++;
2216 if (!empty($arrayfields[
's.town'][
'checked'])) {
2217 print
'<td class="nocellnopadd">';
2221 $totalarray[
'nbfield']++;
2226 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2227 print
'<td class="nocellnopadd">';
2231 $totalarray[
'nbfield']++;
2236 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2237 print
"<td>".$obj->state_name.
"</td>\n";
2239 $totalarray[
'nbfield']++;
2244 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2245 print
'<td class="center">';
2246 $tmparray =
getCountry($obj->fk_pays,
'all');
2247 print $tmparray[
'label'];
2250 $totalarray[
'nbfield']++;
2255 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2256 print
'<td class="center">';
2257 if (empty($typenArray)) {
2258 $typenArray = $formcompany->typent_array(1);
2260 print $typenArray[$obj->typent_code];
2263 $totalarray[
'nbfield']++;
2268 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2269 print
'<td class="center">';
2272 if ($generic_commande->hasDelay()) {
2273 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2277 $totalarray[
'nbfield']++;
2282 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2283 print
'<td class="center">';
2284 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2287 $totalarray[
'nbfield']++;
2292 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2294 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2297 $totalarray[
'nbfield']++;
2302 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2304 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2307 $totalarray[
'nbfield']++;
2312 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2314 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2317 $totalarray[
'nbfield']++;
2322 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2324 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none',
'');
2327 $totalarray[
'nbfield']++;
2332 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2333 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2335 $totalarray[
'nbfield']++;
2338 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2340 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2341 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2343 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2348 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2349 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2351 $totalarray[
'nbfield']++;
2354 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2356 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2357 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2359 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2364 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2365 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2367 $totalarray[
'nbfield']++;
2370 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2372 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2373 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2375 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2380 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2381 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2383 $totalarray[
'nbfield']++;
2388 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2389 print
'<td class="nowrap">';
2390 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2393 $totalarray[
'nbfield']++;
2398 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2399 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2401 $totalarray[
'nbfield']++;
2405 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2406 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2408 $totalarray[
'nbfield']++;
2412 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2413 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2415 $totalarray[
'nbfield']++;
2419 $userstatic->id = $obj->fk_user_author;
2420 $userstatic->login = $obj->login;
2421 $userstatic->lastname = $obj->lastname;
2422 $userstatic->firstname = $obj->firstname;
2423 $userstatic->email = $obj->user_email;
2424 $userstatic->statut = $obj->user_statut;
2425 $userstatic->entity = $obj->entity;
2426 $userstatic->photo = $obj->photo;
2427 $userstatic->office_phone = $obj->office_phone;
2428 $userstatic->office_fax = $obj->office_fax;
2429 $userstatic->user_mobile = $obj->user_mobile;
2430 $userstatic->job = $obj->job;
2431 $userstatic->gender = $obj->gender;
2434 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2435 print
'<td class="tdoverflowmax150">';
2436 if ($userstatic->id) {
2437 print $userstatic->getNomUrl(-1);
2443 $totalarray[
'nbfield']++;
2448 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2450 if ($obj->socid > 0) {
2451 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2452 if ($listsalesrepresentatives < 0) {
2455 $nbofsalesrepresentative = count($listsalesrepresentatives);
2456 if ($nbofsalesrepresentative > 6) {
2458 print $nbofsalesrepresentative;
2459 } elseif ($nbofsalesrepresentative > 0) {
2461 foreach ($listsalesrepresentatives as $val) {
2462 $userstatic->id = $val[
'id'];
2463 $userstatic->lastname = $val[
'lastname'];
2464 $userstatic->firstname = $val[
'firstname'];
2465 $userstatic->email = $val[
'email'];
2466 $userstatic->statut = $val[
'statut'];
2467 $userstatic->entity = $val[
'entity'];
2468 $userstatic->photo = $val[
'photo'];
2469 $userstatic->login = $val[
'login'];
2470 $userstatic->office_phone = $val[
'office_phone'];
2471 $userstatic->office_fax = $val[
'office_fax'];
2472 $userstatic->user_mobile = $val[
'user_mobile'];
2473 $userstatic->job = $val[
'job'];
2474 $userstatic->gender = $val[
'gender'];
2476 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2478 if ($j < $nbofsalesrepresentative) {
2490 $totalarray[
'nbfield']++;
2495 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2496 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2498 $totalarray[
'nbfield']++;
2503 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2504 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2506 $totalarray[
'nbfield']++;
2509 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2511 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2515 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2516 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2518 $totalarray[
'nbfield']++;
2523 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2524 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2526 $totalarray[
'nbfield']++;
2529 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2531 if ($i >= $imaxinloop - 1) {
2532 if (!empty($total_ht)) {
2533 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2535 $totalarray[
'val'][
'total_mark_rate'] =
'';
2541 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2543 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2544 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2545 print $hookmanager->resPrint;
2548 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2549 print
'<td align="center" class="nowrap">';
2550 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2553 $totalarray[
'nbfield']++;
2558 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2559 print
'<td align="center" class="nowrap">';
2560 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2563 $totalarray[
'nbfield']++;
2568 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2569 print
'<td align="center" class="nowrap">';
2570 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2573 $totalarray[
'nbfield']++;
2578 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2579 print
'<td class="center">';
2583 $totalarray[
'nbfield']++;
2588 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2589 print
'<td class="center">';
2593 $totalarray[
'nbfield']++;
2598 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2599 print
'<td class="center">';
2600 if (!empty($show_shippable_command) &&
isModEnabled(
'stock')) {
2601 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2602 $generic_commande->getLinesArray();
2603 $generic_commande->loadExpeditions();
2605 $numlines = count($generic_commande->lines);
2606 for ($lig = 0; $lig < $numlines; $lig++) {
2607 if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
2608 $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
2610 $reliquat = $generic_commande->lines[$lig]->qty;
2612 if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) {
2614 $generic_product->id = $generic_commande->lines[$lig]->fk_product;
2617 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
2618 $generic_product->load_stock(
'nobatch,warehouseopen');
2619 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2620 $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2622 $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2623 $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2626 if ($reliquat > $generic_product->stock_reel) {
2629 if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
2630 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->product_ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2631 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2632 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2633 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2634 $text_info .=
'<br>';
2641 $stock_order_supplier = 0;
2642 if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
2644 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'])) {
2645 $generic_product->load_stats_commande(0,
'1,2');
2646 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2648 $generic_product->stats_commande[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'];
2650 $stock_order = $generic_product->stats_commande[
'qty'];
2653 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'])) {
2654 $generic_product->load_stats_commande_fournisseur(0,
'3');
2655 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2657 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'];
2659 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2662 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2663 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2664 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
2666 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2668 if ($reliquat > $generic_product->stock_reel) {
2669 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2671 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2674 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2676 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2677 $text_info .=
'<br>';
2681 if ($notshippable == 0) {
2682 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
2683 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2685 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
2686 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2691 print
$form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2694 print
$form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2699 $totalarray[
'nbfield']++;
2704 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2705 print
'<td class="center">'.yn($obj->billed).
'</td>';
2707 $totalarray[
'nbfield']++;
2712 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2713 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2715 $totalarray[
'nbfield']++;
2720 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2721 print
'<td class="nowrap right">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2723 $totalarray[
'nbfield']++;
2729 print
'<td class="nowrap center">';
2730 if ($massactionbutton || $massaction) {
2732 if (in_array($obj->rowid, $arrayofselected)) {
2735 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2739 $totalarray[
'nbfield']++;
2745 $total += $obj->total_ht;
2746 $subtotal += $obj->total_ht;
2752 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2757 foreach ($arrayfields as $key => $val) {
2758 if (!empty($val[
'checked'])) {
2762 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2767 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
2768 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2769 print $hookmanager->resPrint;
2771 print
'</table>'.
"\n";
2772 print
'</div>'.
"\n";
2774 print
'</form>'.
"\n";
2776 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2777 $hidegeneratedfilelistifempty = 1;
2778 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2779 $hidegeneratedfilelistifempty = 0;
2783 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2784 $urlsource .= str_replace(
'&',
'&', $param);
2786 $filedir = $diroutputmassaction;
2787 $genallowed = $permissiontoread;
2788 $delallowed = $permissiontoadd;
2790 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage absolute discounts.
Class to manage invoices.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.