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'];
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(
'PassedInClosedStatus', $objecttmp->ref),
null,
'mesgs');
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))';
916 if ($search_datecloture_start) {
917 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
919 if ($search_datecloture_end) {
920 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
922 if ($search_dateorder_start) {
923 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
925 if ($search_dateorder_end) {
926 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
928 if ($search_datedelivery_start) {
929 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
931 if ($search_datedelivery_end) {
932 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
943 if ($search_country) {
944 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
946 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
947 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
949 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
952 if ($search_company) {
955 if ($search_company_alias) {
959 if ($search_parent_name) {
962 if ($search_sale > 0) {
963 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
965 if ($search_user > 0) {
966 $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);
968 if ($search_total_ht !=
'') {
971 if ($search_total_vat !=
'') {
974 if ($search_total_ttc !=
'') {
977 if ($search_warehouse !=
'' && $search_warehouse > 0) {
980 if ($search_multicurrency_code !=
'') {
981 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
983 if ($search_multicurrency_tx !=
'') {
986 if ($search_multicurrency_montant_ht !=
'') {
987 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
989 if ($search_multicurrency_montant_vat !=
'') {
990 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
992 if ($search_multicurrency_montant_ttc !=
'') {
993 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
998 if ($search_project_ref !=
'') {
1001 if ($search_project !=
'') {
1004 if ($search_categ_cus > 0) {
1005 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
1007 if ($search_categ_cus == -2) {
1008 $sql .=
" AND cc.fk_categorie IS NULL";
1010 if ($search_fk_cond_reglement > 0) {
1011 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1013 if ($search_fk_shipping_method > 0) {
1014 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1016 if ($search_fk_mode_reglement > 0) {
1017 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1019 if ($search_fk_input_reason > 0) {
1020 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1023 $searchCategoryProductOperator = -1;
1024 $searchCategoryProductList = array($search_product_category);
1025 if (!empty($searchCategoryProductList)) {
1026 $searchCategoryProductSqlList = array();
1027 $listofcategoryid =
'';
1028 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1029 if (intval($searchCategoryProduct) == -2) {
1030 $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)";
1031 } elseif (intval($searchCategoryProduct) > 0) {
1032 if ($searchCategoryProductOperator == 0) {
1033 $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).
")";
1035 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1039 if ($listofcategoryid) {
1040 $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).
"))";
1042 if ($searchCategoryProductOperator == 1) {
1043 if (!empty($searchCategoryProductSqlList)) {
1044 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1047 if (!empty($searchCategoryProductSqlList)) {
1048 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1053 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1055 $parameters = array();
1056 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1057 $sql .= $hookmanager->resPrint;
1060 $parameters = array();
1061 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1062 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1065 $nbtotalofrecords =
'';
1068 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
1069 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1070 $resql = $db->query($sqlforcount);
1072 $objforcount = $db->fetch_object($resql);
1073 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1078 if (($page * $limit) > $nbtotalofrecords) {
1085 $sql .= $db->order($sortfield, $sortorder);
1087 $sql .= $db->plimit($limit + 1, $offset);
1091 $resql = $db->query(
$sql);
1099 $soc->fetch($socid);
1100 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1101 if (empty($search_company)) {
1102 $search_company = $soc->name;
1105 $title = $langs->trans(
'CustomersOrders');
1107 if (strval($search_status) ==
'0') {
1108 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1110 if ($search_status == 1) {
1111 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1113 if ($search_status == 2) {
1114 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1116 if ($search_status == 3) {
1117 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1119 if ($search_status == -1) {
1120 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1122 if ($search_status == -2) {
1123 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1125 if ($search_status == -3) {
1126 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!
isModEnabled(
'expedition') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1128 if ($search_status == -4) {
1129 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1132 $num = $db->num_rows($resql);
1134 $arrayofselected = is_array($toselect) ? $toselect : array();
1136 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
1137 $obj = $db->fetch_object($resql);
1139 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
1148 $arrayofselected = is_array($toselect) ? $toselect : array();
1151 if (!empty($mode)) {
1152 $param .=
'&mode='.urlencode($mode);
1154 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1155 $param .=
'&contextpage='.urlencode($contextpage);
1157 if ($limit > 0 && $limit != $conf->liste_limit) {
1158 $param .=
'&limit='.((int) $limit);
1161 $param .=
'&sall='.urlencode($sall);
1164 $param .=
'&socid='.urlencode($socid);
1166 if ($search_status !=
'') {
1167 $param .=
'&search_status='.urlencode($search_status);
1169 if ($search_datecloture_start) {
1170 $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');
1172 if ($search_datecloture_end) {
1173 $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');
1175 if ($search_dateorder_start) {
1176 $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');
1178 if ($search_dateorder_end) {
1179 $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');
1181 if ($search_datedelivery_start) {
1182 $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');
1184 if ($search_datedelivery_end) {
1185 $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');
1188 $param .=
'&search_ref='.urlencode($search_ref);
1190 if ($search_company) {
1191 $param .=
'&search_company='.urlencode($search_company);
1193 if ($search_company_alias) {
1194 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1196 if ($search_parent_name !=
'') {
1197 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1199 if ($search_ref_customer) {
1200 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1202 if ($search_user > 0) {
1203 $param .=
'&search_user='.urlencode($search_user);
1205 if ($search_sale > 0) {
1206 $param .=
'&search_sale='.urlencode($search_sale);
1208 if ($search_total_ht !=
'') {
1209 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1211 if ($search_total_vat !=
'') {
1212 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1214 if ($search_total_ttc !=
'') {
1215 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1217 if ($search_warehouse !=
'') {
1218 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1220 if ($search_login) {
1221 $param .=
'&search_login='.urlencode($search_login);
1223 if ($search_multicurrency_code !=
'') {
1224 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1226 if ($search_multicurrency_tx !=
'') {
1227 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1229 if ($search_multicurrency_montant_ht !=
'') {
1230 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1232 if ($search_multicurrency_montant_vat !=
'') {
1233 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1235 if ($search_multicurrency_montant_ttc !=
'') {
1236 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1238 if ($search_project_ref >= 0) {
1239 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1241 if ($search_town !=
'') {
1242 $param .=
'&search_town='.urlencode($search_town);
1244 if ($search_zip !=
'') {
1245 $param .=
'&search_zip='.urlencode($search_zip);
1247 if ($search_state !=
'') {
1248 $param .=
'&search_state='.urlencode($search_state);
1250 if ($search_country !=
'') {
1251 $param .=
'&search_country='.urlencode($search_country);
1253 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1254 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1256 if ($search_product_category !=
'') {
1257 $param .=
'&search_product_category='.urlencode($search_product_category);
1259 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1260 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1263 $param .=
'&show_files='.urlencode($show_files);
1265 if ($optioncss !=
'') {
1266 $param .=
'&optioncss='.urlencode($optioncss);
1268 if ($search_billed !=
'') {
1269 $param .=
'&search_billed='.urlencode($search_billed);
1271 if ($search_fk_cond_reglement > 0) {
1272 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
1274 if ($search_fk_shipping_method > 0) {
1275 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
1277 if ($search_fk_mode_reglement > 0) {
1278 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
1280 if ($search_fk_input_reason > 0) {
1281 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
1285 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1288 $parameters = array();
1289 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1290 $param .= $hookmanager->resPrint;
1293 $arrayofmassactions = array(
1294 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1295 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1297 if ($permissiontovalidate) {
1298 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1300 if ($permissiontoclose) {
1301 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1303 if ($permissiontoclose) {
1304 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1306 if ($permissiontocancel) {
1307 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel");
1309 if (!empty($permissiontodelete)) {
1310 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1312 if (
isModEnabled(
'facture') && $user->hasRight(
"facture",
"creer")) {
1313 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1315 if ($permissiontosendbymail) {
1316 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1318 if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1319 $arrayofmassactions = array();
1321 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1323 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1324 if (!empty($socid)) {
1325 $url .=
'&socid='.$socid;
1327 $newcardbutton =
'';
1328 $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'));
1329 $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'));
1330 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', $contextpage ==
'orderlist' && $permissiontoadd);
1333 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1334 if ($optioncss !=
'') {
1335 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1337 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1338 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1339 print
'<input type="hidden" name="action" value="list">';
1340 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1341 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1342 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1343 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1344 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1345 print
'<input type="hidden" name="page_y" value="">';
1346 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1349 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1351 $topicmail =
"SendOrderRef";
1352 $modelmail =
"order_send";
1354 $trackid =
'ord'.$object->id;
1355 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1357 if ($massaction ==
'prevalidate') {
1358 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1360 if ($massaction ==
'preshipped') {
1361 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1364 if ($massaction ==
'createbills') {
1365 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1367 print
'<table class="noborder centpercent">';
1370 print $langs->trans(
'DateInvoice');
1373 print
$form->selectDate(
'',
'',
'',
'',
'',
'', 1, 1);
1378 print $langs->trans(
'CreateOneBillByThird');
1381 print
$form->selectyesno(
'createbills_onebythird',
'', 1);
1386 print $langs->trans(
'ValidateInvoices');
1389 if (
isModEnabled(
'stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
1390 print
$form->selectyesno(
'validate_invoices', 0, 1, 1);
1391 $langs->load(
"errors");
1392 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1394 print
$form->selectyesno(
'validate_invoices', 0, 1);
1396 if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) {
1397 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1399 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1405 print
'<div class="center">';
1406 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1407 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1414 foreach ($fieldstosearchall as $key => $val) {
1415 $fieldstosearchall[$key] = $langs->trans($val);
1416 $setupstring .= $key.
"=".$val.
";";
1418 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1419 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1422 $moreforfilter =
'';
1425 if ($user->hasRight(
"user",
"user",
"lire")) {
1426 $langs->load(
"commercial");
1427 $moreforfilter .=
'<div class="divsearchfield">';
1428 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1429 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1430 $moreforfilter .=
'</div>';
1433 if ($user->hasRight(
"user",
"user",
"lire")) {
1434 $moreforfilter .=
'<div class="divsearchfield">';
1435 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1436 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1437 $moreforfilter .=
'</div>';
1441 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1442 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1443 $moreforfilter .=
'<div class="divsearchfield">';
1444 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1445 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1446 $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);
1447 $moreforfilter .=
'</div>';
1450 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1451 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1452 $moreforfilter .=
'<div class="divsearchfield">';
1453 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1454 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1455 $moreforfilter .=
'</div>';
1458 if (
isModEnabled(
'stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
1459 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1461 $moreforfilter .=
'<div class="divsearchfield">';
1462 $tmptitle = $langs->trans(
'Warehouse');
1463 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1464 $moreforfilter .=
'</div>';
1466 $parameters = array();
1467 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1468 if (empty($reshook)) {
1469 $moreforfilter .= $hookmanager->resPrint;
1471 $moreforfilter = $hookmanager->resPrint;
1474 if (!empty($moreforfilter)) {
1475 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1476 print $moreforfilter;
1477 $parameters = array();
1478 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1479 print $hookmanager->resPrint;
1483 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1484 $selectedfields = ($mode !=
'kanban' ?
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
1485 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1487 if (
GETPOST(
'autoselectall',
'int')) {
1488 $selectedfields .=
'<script>';
1489 $selectedfields .=
' $(document).ready(function() {';
1490 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1491 $selectedfields .=
' $("#checkforselects").click();';
1492 $selectedfields .=
' $("#massaction").val("createbills").change();';
1493 $selectedfields .=
' });';
1494 $selectedfields .=
'</script>';
1497 print
'<div class="div-table-responsive">';
1498 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1502 print
'<tr class="liste_titre_filter">';
1505 print
'<td class="liste_titre center maxwidthsearch">';
1506 $searchpicto =
$form->showFilterButtons(
'left');
1512 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1513 print
'<td class="liste_titre">';
1514 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1518 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1519 print
'<td class="liste_titre" align="left">';
1520 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1524 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1525 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1528 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1529 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1532 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1533 print
'<td class="liste_titre" align="left">';
1534 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1538 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1539 print
'<td class="liste_titre" align="left">';
1540 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1544 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1545 print
'<td class="liste_titre">';
1546 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1550 if (!empty($arrayfields[
's.town'][
'checked'])) {
1551 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1554 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1555 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1558 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1559 print
'<td class="liste_titre">';
1560 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1564 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1565 print
'<td class="liste_titre" align="center">';
1566 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1570 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1571 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1572 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);
1576 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1577 print
'<td class="liste_titre center">';
1578 print
'<div class="nowrap">';
1579 print
$form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1581 print
'<div class="nowrap">';
1582 print
$form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1586 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1587 print
'<td class="liste_titre center">';
1588 print
'<div class="nowrap">';
1589 print
$form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1591 print
'<div class="nowrap">';
1592 print
$form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1597 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1598 print
'<td class="liste_titre">';
1599 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1603 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1604 print
'<td class="liste_titre">';
1605 print
$form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1609 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1610 print
'<td class="liste_titre">';
1611 print
$form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1615 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1616 print
'<td class="liste_titre">';
1617 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1621 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1622 print
'<td class="liste_titre right">';
1623 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1627 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1628 print
'<td class="liste_titre right">';
1629 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1633 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1634 print
'<td class="liste_titre right">';
1635 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1639 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1640 print
'<td class="liste_titre">';
1641 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1645 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1646 print
'<td class="liste_titre">';
1647 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1651 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1652 print
'<td class="liste_titre right">';
1653 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1657 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1658 print
'<td class="liste_titre right">';
1659 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1663 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1664 print
'<td class="liste_titre right">';
1665 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1669 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1670 print
'<td class="liste_titre">';
1671 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1675 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1676 print
'<td class="liste_titre"></td>';
1678 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1679 print
'<td class="liste_titre right">';
1682 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1683 print
'<td class="liste_titre right">';
1686 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1687 print
'<td class="liste_titre right">';
1690 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1691 print
'<td class="liste_titre right">';
1696 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1699 $parameters = array(
'arrayfields'=>$arrayfields);
1700 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1701 print $hookmanager->resPrint;
1704 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1705 print
'<td class="liste_titre">';
1709 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1710 print
'<td class="liste_titre">';
1714 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1715 print
'<td class="liste_titre center">';
1716 print
'<div class="nowrap">';
1717 print
$form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1719 print
'<div class="nowrap">';
1720 print
$form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1725 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1726 print
'<td class="liste_titre">';
1730 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1731 print
'<td class="liste_titre">';
1735 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1736 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1738 if (!empty($conf->global->ORDER_SHIPABLE_STATUS_DISABLED_BY_DEFAULT)) {
1739 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1740 print $langs->trans(
'ShowShippableStatus');
1742 $show_shippable_command = 1;
1747 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1748 print
'<td class="liste_titre maxwidthonsmartphone center">';
1749 print
$form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1753 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1754 print
'<td class="liste_titre maxwidthonsmartphone center">';
1758 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1759 print
'<td class="liste_titre right parentonrightofpage">';
1760 $liststatus = array(
1764 -2=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1765 -3=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1769 print
$form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1774 print
'<td class="liste_titre center maxwidthsearch">';
1775 $searchpicto =
$form->showFilterButtons();
1781 $totalarray = array(
1794 print
'<tr class="liste_titre">';
1798 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1799 $totalarray[
'nbfield']++;
1801 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1802 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1803 $totalarray[
'nbfield']++;
1805 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1806 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1807 $totalarray[
'nbfield']++;
1809 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1810 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1811 $totalarray[
'nbfield']++;
1813 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1814 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1815 $totalarray[
'nbfield']++;
1817 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1818 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1819 $totalarray[
'nbfield']++;
1821 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1822 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1823 $totalarray[
'nbfield']++;
1825 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1826 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1827 $totalarray[
'nbfield']++;
1829 if (!empty($arrayfields[
's.town'][
'checked'])) {
1830 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1831 $totalarray[
'nbfield']++;
1833 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1834 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1835 $totalarray[
'nbfield']++;
1837 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1838 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1839 $totalarray[
'nbfield']++;
1841 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1842 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1843 $totalarray[
'nbfield']++;
1845 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1846 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1847 $totalarray[
'nbfield']++;
1849 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1850 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1851 $totalarray[
'nbfield']++;
1853 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1854 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1855 $totalarray[
'nbfield']++;
1857 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1858 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1859 $totalarray[
'nbfield']++;
1861 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1862 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1863 $totalarray[
'nbfield']++;
1865 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1866 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1867 $totalarray[
'nbfield']++;
1869 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1870 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1871 $totalarray[
'nbfield']++;
1873 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1874 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1875 $totalarray[
'nbfield']++;
1877 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1878 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1879 $totalarray[
'nbfield']++;
1881 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1882 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1883 $totalarray[
'nbfield']++;
1885 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1886 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1887 $totalarray[
'nbfield']++;
1889 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1890 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1891 $totalarray[
'nbfield']++;
1893 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1894 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1895 $totalarray[
'nbfield']++;
1897 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1898 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1899 $totalarray[
'nbfield']++;
1901 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1902 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1903 $totalarray[
'nbfield']++;
1905 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1906 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1907 $totalarray[
'nbfield']++;
1909 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1910 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1911 $totalarray[
'nbfield']++;
1913 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1914 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1915 $totalarray[
'nbfield']++;
1917 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1918 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1919 $totalarray[
'nbfield']++;
1921 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1922 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1923 $totalarray[
'nbfield']++;
1925 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1926 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1927 $totalarray[
'nbfield']++;
1931 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1934 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1935 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1936 print $hookmanager->resPrint;
1937 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1938 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1939 $totalarray[
'nbfield']++;
1941 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1942 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1943 $totalarray[
'nbfield']++;
1945 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1946 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1947 $totalarray[
'nbfield']++;
1949 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1950 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1951 $totalarray[
'nbfield']++;
1953 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1954 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1955 $totalarray[
'nbfield']++;
1957 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1958 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1959 $totalarray[
'nbfield']++;
1961 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1962 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1963 $totalarray[
'nbfield']++;
1965 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1966 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1967 $totalarray[
'nbfield']++;
1969 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1970 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
1971 $totalarray[
'nbfield']++;
1975 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1976 $totalarray[
'nbfield']++;
1982 $productstat_cache = array();
1983 $productstat_cachevirtual = array();
1984 $getNomUrl_cache = array();
1986 $generic_commande =
new Commande($db);
1987 $generic_product =
new Product($db);
1988 $userstatic =
new User($db);
1990 $with_margin_info =
false;
1992 !empty($arrayfields[
'total_pa'][
'checked'])
1993 || !empty($arrayfields[
'total_margin'][
'checked'])
1994 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1995 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1998 $with_margin_info =
true;
2007 $savnbfield = $totalarray[
'nbfield'];
2008 $totalarray = array();
2009 $totalarray[
'nbfield'] = 0;
2010 $imaxinloop = ($limit ? min($num, $limit) : $num);
2011 while ($i < $imaxinloop) {
2012 $obj = $db->fetch_object($resql);
2023 $companystatic->id = $obj->socid;
2024 $companystatic->name = $obj->name;
2025 $companystatic->name_alias = $obj->alias;
2026 $companystatic->client = $obj->client;
2027 $companystatic->fournisseur = $obj->fournisseur;
2028 $companystatic->code_client = $obj->code_client;
2029 $companystatic->email = $obj->email;
2030 $companystatic->phone = $obj->phone;
2031 $companystatic->address = $obj->address;
2032 $companystatic->zip = $obj->zip;
2033 $companystatic->town = $obj->town;
2034 $companystatic->country_code = $obj->country_code;
2035 if (!isset($getNomUrl_cache[$obj->socid])) {
2036 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2039 $generic_commande->id = $obj->rowid;
2040 $generic_commande->ref = $obj->ref;
2041 $generic_commande->statut = $obj->fk_statut;
2042 $generic_commande->billed = $obj->billed;
2043 $generic_commande->date = $db->jdate($obj->date_commande);
2044 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2045 $generic_commande->ref_client = $obj->ref_client;
2046 $generic_commande->total_ht = $obj->total_ht;
2047 $generic_commande->total_tva = $obj->total_tva;
2048 $generic_commande->total_ttc = $obj->total_ttc;
2049 $generic_commande->note_public = $obj->note_public;
2050 $generic_commande->note_private = $obj->note_private;
2052 $generic_commande->thirdparty = $companystatic;
2055 $projectstatic->id = $obj->project_id;
2056 $projectstatic->ref = $obj->project_ref;
2057 $projectstatic->title = $obj->project_label;
2059 $marginInfo = array();
2060 if ($with_margin_info ===
true) {
2061 $generic_commande->fetch_lines();
2062 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2063 $total_ht += $obj->total_ht;
2064 $total_margin += $marginInfo[
'total_margin'];
2067 if ($mode ==
'kanban') {
2069 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2070 print
'<div class="box-flex-container kanban">';
2075 if ($massactionbutton || $massaction) {
2077 if (in_array($object->id, $arrayofselected)) {
2081 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2082 if ($i == ($imaxinloop - 1)) {
2089 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
2093 print
'<td class="nowrap center">';
2094 if ($massactionbutton || $massaction) {
2096 if (in_array($obj->rowid, $arrayofselected)) {
2099 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2103 $totalarray[
'nbfield']++;
2108 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2109 print
'<td class="nowraponall">';
2110 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
2113 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
2114 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2115 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2119 $totalarray[
'nbfield']++;
2124 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2125 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2129 $totalarray[
'nbfield']++;
2134 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2135 print
'<td class="nowrap">';
2136 if ($obj->project_id > 0) {
2137 print $projectstatic->getNomUrl(1);
2141 $totalarray[
'nbfield']++;
2146 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2147 print
'<td class="nowrap">';
2148 if ($obj->project_id > 0) {
2149 print $projectstatic->title;
2153 $totalarray[
'nbfield']++;
2158 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2159 print
'<td class="tdoverflowmax150">';
2161 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2163 print $getNomUrl_cache[$obj->socid];
2167 if (
isModEnabled(
'facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
2168 if ($user->hasRight(
'facture',
'creer')) {
2169 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2170 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2171 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2177 $totalarray[
'nbfield']++;
2182 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2183 print
'<td class="nocellnopadd">';
2187 $totalarray[
'nbfield']++;
2192 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2193 print
'<td class="tdoverflowmax200">';
2194 if ($obj->fk_parent > 0) {
2195 if (!isset($company_url_list[$obj->fk_parent])) {
2196 $companyparent =
new Societe($db);
2197 $res = $companyparent->fetch($obj->fk_parent);
2199 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2202 if (isset($company_url_list[$obj->fk_parent])) {
2203 print $company_url_list[$obj->fk_parent];
2208 $totalarray[
'nbfield']++;
2213 if (!empty($arrayfields[
's.town'][
'checked'])) {
2214 print
'<td class="nocellnopadd">';
2218 $totalarray[
'nbfield']++;
2223 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2224 print
'<td class="nocellnopadd">';
2228 $totalarray[
'nbfield']++;
2233 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2234 print
"<td>".$obj->state_name.
"</td>\n";
2236 $totalarray[
'nbfield']++;
2241 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2242 print
'<td class="center">';
2243 $tmparray =
getCountry($obj->fk_pays,
'all');
2244 print $tmparray[
'label'];
2247 $totalarray[
'nbfield']++;
2252 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2253 print
'<td class="center">';
2254 if (empty($typenArray)) {
2255 $typenArray = $formcompany->typent_array(1);
2257 print $typenArray[$obj->typent_code];
2260 $totalarray[
'nbfield']++;
2265 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2266 print
'<td class="center">';
2269 if ($generic_commande->hasDelay()) {
2270 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2274 $totalarray[
'nbfield']++;
2279 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2280 print
'<td class="center">';
2281 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2284 $totalarray[
'nbfield']++;
2289 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2291 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2294 $totalarray[
'nbfield']++;
2299 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2301 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2304 $totalarray[
'nbfield']++;
2309 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2311 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2314 $totalarray[
'nbfield']++;
2319 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2321 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none',
'');
2324 $totalarray[
'nbfield']++;
2329 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2330 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2332 $totalarray[
'nbfield']++;
2335 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2337 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2338 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2340 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2345 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2346 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2348 $totalarray[
'nbfield']++;
2351 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2353 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2354 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2356 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2361 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2362 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2364 $totalarray[
'nbfield']++;
2367 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2369 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2370 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2372 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2377 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2378 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2380 $totalarray[
'nbfield']++;
2385 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2386 print
'<td class="nowrap">';
2387 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2390 $totalarray[
'nbfield']++;
2395 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2396 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2398 $totalarray[
'nbfield']++;
2402 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2403 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2405 $totalarray[
'nbfield']++;
2409 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2410 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2412 $totalarray[
'nbfield']++;
2416 $userstatic->id = $obj->fk_user_author;
2417 $userstatic->login = $obj->login;
2418 $userstatic->lastname = $obj->lastname;
2419 $userstatic->firstname = $obj->firstname;
2420 $userstatic->email = $obj->user_email;
2421 $userstatic->statut = $obj->user_statut;
2422 $userstatic->entity = $obj->entity;
2423 $userstatic->photo = $obj->photo;
2424 $userstatic->office_phone = $obj->office_phone;
2425 $userstatic->office_fax = $obj->office_fax;
2426 $userstatic->user_mobile = $obj->user_mobile;
2427 $userstatic->job = $obj->job;
2428 $userstatic->gender = $obj->gender;
2431 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2432 print
'<td class="tdoverflowmax150">';
2433 if ($userstatic->id) {
2434 print $userstatic->getNomUrl(-1);
2440 $totalarray[
'nbfield']++;
2445 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2447 if ($obj->socid > 0) {
2448 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2449 if ($listsalesrepresentatives < 0) {
2452 $nbofsalesrepresentative = count($listsalesrepresentatives);
2453 if ($nbofsalesrepresentative > 6) {
2455 print $nbofsalesrepresentative;
2456 } elseif ($nbofsalesrepresentative > 0) {
2458 foreach ($listsalesrepresentatives as $val) {
2459 $userstatic->id = $val[
'id'];
2460 $userstatic->lastname = $val[
'lastname'];
2461 $userstatic->firstname = $val[
'firstname'];
2462 $userstatic->email = $val[
'email'];
2463 $userstatic->statut = $val[
'statut'];
2464 $userstatic->entity = $val[
'entity'];
2465 $userstatic->photo = $val[
'photo'];
2466 $userstatic->login = $val[
'login'];
2467 $userstatic->office_phone = $val[
'office_phone'];
2468 $userstatic->office_fax = $val[
'office_fax'];
2469 $userstatic->user_mobile = $val[
'user_mobile'];
2470 $userstatic->job = $val[
'job'];
2471 $userstatic->gender = $val[
'gender'];
2473 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2475 if ($j < $nbofsalesrepresentative) {
2487 $totalarray[
'nbfield']++;
2492 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2493 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2495 $totalarray[
'nbfield']++;
2500 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2501 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2503 $totalarray[
'nbfield']++;
2506 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2508 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2512 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2513 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2515 $totalarray[
'nbfield']++;
2520 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2521 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2523 $totalarray[
'nbfield']++;
2526 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2528 if ($i >= $imaxinloop - 1) {
2529 if (!empty($total_ht)) {
2530 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2532 $totalarray[
'val'][
'total_mark_rate'] =
'';
2538 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2540 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2541 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2542 print $hookmanager->resPrint;
2545 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2546 print
'<td align="center" class="nowrap">';
2547 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2550 $totalarray[
'nbfield']++;
2555 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2556 print
'<td align="center" class="nowrap">';
2557 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2560 $totalarray[
'nbfield']++;
2565 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2566 print
'<td align="center" class="nowrap">';
2567 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2570 $totalarray[
'nbfield']++;
2575 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2576 print
'<td class="center">';
2580 $totalarray[
'nbfield']++;
2585 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2586 print
'<td class="center">';
2590 $totalarray[
'nbfield']++;
2595 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2596 print
'<td class="center">';
2597 if (!empty($show_shippable_command) &&
isModEnabled(
'stock')) {
2598 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2599 $generic_commande->getLinesArray();
2600 $generic_commande->loadExpeditions();
2602 $numlines = count($generic_commande->lines);
2603 for ($lig = 0; $lig < $numlines; $lig++) {
2604 if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
2605 $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
2607 $reliquat = $generic_commande->lines[$lig]->qty;
2609 if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) {
2611 $generic_product->id = $generic_commande->lines[$lig]->fk_product;
2614 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
2615 $generic_product->load_stock(
'nobatch,warehouseopen');
2616 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2617 $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2619 $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2620 $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2623 if ($reliquat > $generic_product->stock_reel) {
2626 if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
2627 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->product_ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2628 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2629 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2630 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2631 $text_info .=
'<br>';
2638 $stock_order_supplier = 0;
2639 if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
2641 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'])) {
2642 $generic_product->load_stats_commande(0,
'1,2');
2643 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2645 $generic_product->stats_commande[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'];
2647 $stock_order = $generic_product->stats_commande[
'qty'];
2650 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'])) {
2651 $generic_product->load_stats_commande_fournisseur(0,
'3');
2652 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2654 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'];
2656 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2659 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2660 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2661 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
2663 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2665 if ($reliquat > $generic_product->stock_reel) {
2666 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2668 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2671 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2673 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2674 $text_info .=
'<br>';
2678 if ($notshippable == 0) {
2679 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
2680 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2682 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
2683 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2688 print
$form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2691 print
$form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2696 $totalarray[
'nbfield']++;
2701 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2702 print
'<td class="center">'.yn($obj->billed).
'</td>';
2704 $totalarray[
'nbfield']++;
2709 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2710 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2712 $totalarray[
'nbfield']++;
2717 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2718 print
'<td class="nowrap right">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2720 $totalarray[
'nbfield']++;
2726 print
'<td class="nowrap center">';
2727 if ($massactionbutton || $massaction) {
2729 if (in_array($obj->rowid, $arrayofselected)) {
2732 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2736 $totalarray[
'nbfield']++;
2742 $total += $obj->total_ht;
2743 $subtotal += $obj->total_ht;
2749 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2754 foreach ($arrayfields as $key => $val) {
2755 if (!empty($val[
'checked'])) {
2759 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2764 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
2765 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2766 print $hookmanager->resPrint;
2768 print
'</table>'.
"\n";
2769 print
'</div>'.
"\n";
2771 print
'</form>'.
"\n";
2773 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2774 $hidegeneratedfilelistifempty = 1;
2775 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2776 $hidegeneratedfilelistifempty = 0;
2780 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2781 $urlsource .= str_replace(
'&',
'&', $param);
2783 $filedir = $diroutputmassaction;
2784 $genallowed = $permissiontoread;
2785 $delallowed = $permissiontoadd;
2787 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.