39require
'../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
46if (isModEnabled(
'margin')) {
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
55$langs->loadLangs(array(
'orders',
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
58$action =
GETPOST(
'action',
'aZ09');
59$massaction =
GETPOST(
'massaction',
'alpha');
60$show_files =
GETPOST(
'show_files',
'int');
61$confirm =
GETPOST(
'confirm',
'alpha');
62$toselect =
GETPOST(
'toselect',
'array');
63$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlist';
64$mode =
GETPOST(
'mode',
'alpha');
67$search_datecloture_start =
GETPOST(
'search_datecloture_start',
'int');
68if (empty($search_datecloture_start)) {
69 $search_datecloture_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datecloture_startmonth',
'int'),
GETPOST(
'search_datecloture_startday',
'int'),
GETPOST(
'search_datecloture_startyear',
'int'));
71$search_datecloture_end =
GETPOST(
'search_datecloture_end',
'int');
72if (empty($search_datecloture_end)) {
73 $search_datecloture_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datecloture_endmonth',
'int'),
GETPOST(
'search_datecloture_endday',
'int'),
GETPOST(
'search_datecloture_endyear',
'int'));
75$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'));
76$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'));
77$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'));
78$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'));
80$search_product_category =
GETPOST(
'search_product_category',
'int');
81$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
82$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
83$search_company =
GETPOST(
'search_company',
'alpha');
84$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
85$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
86$search_town =
GETPOST(
'search_town',
'alpha');
87$search_zip =
GETPOST(
'search_zip',
'alpha');
88$search_state =
GETPOST(
'search_state',
'alpha');
89$search_country =
GETPOST(
'search_country',
'int');
90$search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'int');
91$sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
92$socid =
GETPOST(
'socid',
'int');
93$search_user =
GETPOST(
'search_user',
'int');
94$search_sale =
GETPOST(
'search_sale',
'int');
96$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
97$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
98$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
99$search_warehouse =
GETPOST(
'search_warehouse',
'int');
101$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
102$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
103$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
104$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
105$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
107$search_login =
GETPOST(
'search_login',
'alpha');
108$search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
109$optioncss =
GETPOST(
'optioncss',
'alpha');
110$search_billed =
GETPOST(
'search_billed',
'int');
111$search_status =
GETPOST(
'search_status',
'int');
112$search_btn =
GETPOST(
'button_search',
'alpha');
113$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
114$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
115$search_project =
GETPOST(
'search_project',
'alpha');
116$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
118$search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'int');
119$search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'int');
120$search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'int');
121$search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'int');
122$search_option =
GETPOST(
'search_option',
'alpha');
123if ($search_option ==
'late') {
124 $search_status =
'-2';
127$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
130$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
131$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
132$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
133$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
134if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
138$offset = $limit * $page;
139$pageprev = $page - 1;
140$pagenext = $page + 1;
142 $sortfield =
'c.ref';
148$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
152$hookmanager->initHooks(array(
'orderlist'));
156$extrafields->fetch_name_optionals_label($object->table_element);
157$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
160$fieldstosearchall = array(
162 'c.ref_client'=>
'RefCustomerOrder',
163 'pd.description'=>
'Description',
164 's.nom'=>
"ThirdParty",
165 's.name_alias'=>
"AliasNameShort",
168 'c.note_public'=>
'NotePublic',
170if (empty($user->socid)) {
171 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
174$checkedtypetiers = 0;
176 'c.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
177 'c.ref_client'=>array(
'label'=>
"RefCustomerOrder",
'checked'=>-1,
'position'=>10),
178 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>-1,
'enabled'=>(!isModEnabled(
'project') ? 0 : 1),
'position'=>20),
179 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(!isModEnabled(
'project') ? 0 : 1),
'position'=>25),
180 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>30),
181 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>-1,
'position'=>31),
182 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>32,
'checked'=>0),
183 's.town'=>array(
'label'=>
"Town",
'checked'=>-1,
'position'=>35),
184 's.zip'=>array(
'label'=>
"Zip",
'checked'=>-1,
'position'=>40),
185 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>45),
186 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>50),
187 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>55),
188 'c.date_commande'=>array(
'label'=>
"OrderDateShort",
'checked'=>1,
'position'=>60),
189 'c.date_delivery'=>array(
'label'=>
"DateDeliveryPlanned",
'checked'=>1,
'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE),
'position'=>65),
190 'c.fk_shipping_method'=>array(
'label'=>
"SendingMethod",
'checked'=>-1,
'position'=>66 ,
'enabled'=>isModEnabled(
"expedition")),
191 'c.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>-1,
'position'=>67),
192 'c.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>-1,
'position'=>68),
193 'c.fk_input_reason'=>array(
'label'=>
"Channel",
'checked'=>-1,
'position'=>69),
194 'c.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>75),
195 'c.total_vat'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>80),
196 'c.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>85),
197 'c.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>90),
198 'c.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>95),
199 'c.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>100),
200 'c.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>105),
201 'c.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>110),
202 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>115),
203 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>0,
'position'=>116),
204 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
205 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
206 '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)),
207 '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)),
208 'c.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>120),
209 'c.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>125),
210 'c.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>130),
211 'c.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position'=>135),
212 'c.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position'=>140),
213 'shippable'=>array(
'label'=>
"Shippable",
'checked'=>1,
'enabled'=>(isModEnabled(
"expedition")),
'position'=>990),
214 'c.facture'=>array(
'label'=>
"Billed",
'checked'=>1,
'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)),
'position'=>995),
215 'c.import_key' =>array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>1,
'visible'=>-2,
'position'=>999),
216 'c.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000)
220include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
229 $socid = $user->socid;
240if (
GETPOST(
'cancel',
'alpha')) {
241 $action =
'list'; $massaction =
'';
243if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
247$parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
248$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
253if (empty($reshook)) {
255 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
258 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
262 $search_product_category =
'';
264 $search_ref_customer =
'';
265 $search_company =
'';
266 $search_company_alias =
'';
267 $search_parent_name =
'';
272 $search_country =
'';
273 $search_type_thirdparty =
'';
274 $search_total_ht =
'';
275 $search_total_vat =
'';
276 $search_total_ttc =
'';
277 $search_warehouse =
'';
278 $search_multicurrency_code =
'';
279 $search_multicurrency_tx =
'';
280 $search_multicurrency_montant_ht =
'';
281 $search_multicurrency_montant_vat =
'';
282 $search_multicurrency_montant_ttc =
'';
284 $search_dateorder_start =
'';
285 $search_dateorder_end =
'';
286 $search_datedelivery_start =
'';
287 $search_datedelivery_end =
'';
288 $search_project_ref =
'';
289 $search_project =
'';
293 $search_array_options = array();
294 $search_categ_cus = 0;
295 $search_datecloture_start =
'';
296 $search_datecloture_end =
'';
297 $search_fk_cond_reglement =
'';
298 $search_fk_shipping_method =
'';
299 $search_fk_mode_reglement =
'';
300 $search_fk_input_reason =
'';
303 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
304 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
309 $objectclass =
'Commande';
310 $objectlabel =
'Orders';
311 $permissiontoread = $user->hasRight(
"commande",
"lire");
312 $permissiontoadd = $user->hasRight(
"commande",
"creer");
313 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
314 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
315 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
316 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
317 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
318 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
320 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
321 $permissiontoclose = $user->hasRight(
"commande",
"creer");
322 $permissiontocancel = $user->hasRight(
"commande",
"creer");
323 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
325 $uploaddir = $conf->commande->multidir_output[$conf->entity];
326 $triggersendname =
'ORDER_SENTBYMAIL';
327 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
329 if ($massaction ==
'confirm_createbills') {
330 $orders =
GETPOST(
'toselect',
'array');
331 $createbills_onebythird =
GETPOST(
'createbills_onebythird',
'int');
332 $validate_invoices =
GETPOST(
'validate_invoices',
'int');
337 $TFactThird = array();
338 $TFactThirdNbLines = array();
340 $nb_bills_created = 0;
346 $nbOrders = is_array($orders) ? count($orders) : 1;
348 foreach ($orders as $id_order) {
350 if ($cmd->fetch($id_order) <= 0) {
353 $cmd->fetch_thirdparty();
356 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
358 $objecttmp = $TFactThird[$cmd->socid];
361 $objecttmp->socid = $cmd->socid;
362 $objecttmp->thirdparty = $cmd->thirdparty;
364 $objecttmp->type = $objecttmp::TYPE_STANDARD;
365 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
366 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
368 $objecttmp->fk_project = $cmd->fk_project;
369 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
370 if (empty($createbills_onebythird)) {
371 $objecttmp->ref_client = $cmd->ref_client;
375 if (empty($datefacture)) {
379 $objecttmp->date = $datefacture;
380 $objecttmp->origin =
'commande';
381 $objecttmp->origin_id = $id_order;
383 $objecttmp->array_options = $cmd->array_options;
385 $res = $objecttmp->create($user);
389 $lastref = $objecttmp->ref;
390 $lastid = $objecttmp->id;
392 $TFactThird[$cmd->socid] = $objecttmp;
393 $TFactThirdNbLines[$cmd->socid] = 0;
395 $langs->load(
"errors");
396 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
401 if ($objecttmp->id > 0) {
402 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
405 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
410 $lines = $cmd->lines;
411 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
413 $lines = $cmd->lines;
417 $num = count($lines);
419 for ($i = 0; $i < $num; $i++) {
420 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
422 if (!empty($createbills_onebythird)) {
426 if ($lines[$i]->subprice < 0 && empty($conf->global->INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN)) {
429 $discount->fk_soc = $objecttmp->socid;
430 $discount->amount_ht = abs($lines[$i]->total_ht);
431 $discount->amount_tva = abs($lines[$i]->total_tva);
432 $discount->amount_ttc = abs($lines[$i]->total_ttc);
433 $discount->tva_tx = $lines[$i]->tva_tx;
434 $discount->fk_user = $user->id;
435 $discount->description = $desc;
436 $discountid = $discount->create($user);
437 if ($discountid > 0) {
438 $result = $objecttmp->insert_discount($discountid);
447 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
450 if ($lines[$i]->date_debut_prevue) {
451 $date_start = $lines[$i]->date_debut_prevue;
453 if ($lines[$i]->date_debut_reel) {
454 $date_start = $lines[$i]->date_debut_reel;
456 if ($lines[$i]->date_start) {
457 $date_start = $lines[$i]->date_start;
461 if ($lines[$i]->date_fin_prevue) {
462 $date_end = $lines[$i]->date_fin_prevue;
464 if ($lines[$i]->date_fin_reel) {
465 $date_end = $lines[$i]->date_fin_reel;
467 if ($lines[$i]->date_end) {
468 $date_end = $lines[$i]->date_end;
471 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
476 if (method_exists($lines[$i],
'fetch_optionals')) {
477 $lines[$i]->fetch_optionals();
478 $array_options = $lines[$i]->array_options;
481 $objecttmp->context[
'createfromclone'] =
'createfromclone';
483 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
485 if (!empty($createbills_onebythird)) {
486 $rang = $TFactThirdNbLines[$cmd->socid];
489 $result = $objecttmp->addline(
491 $lines[$i]->subprice,
494 $lines[$i]->localtax1_tx,
495 $lines[$i]->localtax2_tx,
496 $lines[$i]->fk_product,
497 $lines[$i]->remise_percent,
501 $lines[$i]->info_bits,
502 $lines[$i]->fk_remise_except,
507 $lines[$i]->special_code,
511 $lines[$i]->fk_fournprice,
521 if (!empty($createbills_onebythird))
522 $TFactThirdNbLines[$cmd->socid]++;
526 $errors[] = $objecttmp->error;
530 if ($result > 0 && $lines[$i]->product_type == 9) {
531 $fk_parent_line = $result;
540 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
541 $TFactThird[$cmd->socid] = $objecttmp;
543 $TFact[$objecttmp->id] = $objecttmp;
548 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
551 if (!$error && $validate_invoices) {
552 $massaction = $action =
'builddoc';
554 foreach ($TAllFact as &$objecttmp) {
555 $result = $objecttmp->validate($user);
562 $id = $objecttmp->id;
566 $upload_dir = $conf->facture->dir_output;
567 $permissiontoadd = $user->hasRight(
'facture',
'creer');
570 $savobject = $object;
571 $object = $objecttmp;
572 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
573 $object = $savobject;
576 $massaction = $action =
'confirm_createbills';
582 if ($nb_bills_created == 1) {
583 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
584 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode($lastid).
'">'.$lastref.
'</a>', $texttoshow);
587 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
593 $param .=
'&mode='.urlencode($mode);
595 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
596 $param .=
'&contextpage='.urlencode($contextpage);
598 if ($limit > 0 && $limit != $conf->liste_limit) {
599 $param .=
'&limit='.((int) $limit);
602 $param .=
'&sall='.urlencode($sall);
605 $param .=
'&socid='.urlencode($socid);
607 if ($search_status !=
'') {
608 $param .=
'&search_status='.urlencode($search_status);
610 if ($search_option) {
611 $param .=
"&search_option=".urlencode($search_option);
613 if ($search_orderday) {
614 $param .=
'&search_orderday='.urlencode($search_orderday);
616 if ($search_ordermonth) {
617 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
619 if ($search_orderyear) {
620 $param .=
'&search_orderyear='.urlencode($search_orderyear);
622 if ($search_deliveryday) {
623 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
625 if ($search_deliverymonth) {
626 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
628 if ($search_deliveryyear) {
629 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
632 $param .=
'&search_ref='.urlencode($search_ref);
634 if ($search_company) {
635 $param .=
'&search_company='.urlencode($search_company);
637 if ($search_ref_customer) {
638 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
640 if ($search_user > 0) {
641 $param .=
'&search_user='.urlencode($search_user);
643 if ($search_sale > 0) {
644 $param .=
'&search_sale='.urlencode($search_sale);
646 if ($search_total_ht !=
'') {
647 $param .=
'&search_total_ht='.urlencode($search_total_ht);
649 if ($search_total_vat !=
'') {
650 $param .=
'&search_total_vat='.urlencode($search_total_vat);
652 if ($search_total_ttc !=
'') {
653 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
655 if ($search_project_ref >= 0) {
656 $param .=
"&search_project_ref=".urlencode($search_project_ref);
659 $param .=
'&show_files='.urlencode($show_files);
661 if ($optioncss !=
'') {
662 $param .=
'&optioncss='.urlencode($optioncss);
665 $param .=
'&billed='.urlencode($billed);
668 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
674 $_GET[
"origin"] = $_POST[
"origin"];
675 $_GET[
"originid"] = $_POST[
"originid"];
676 if (!empty($errors)) {
685if ($action ==
'validate' && $permissiontoadd) {
686 if (
GETPOST(
'confirm') ==
'yes') {
687 $objecttmp =
new $objectclass($db);
690 foreach ($toselect as $checked) {
691 if ($objecttmp->fetch($checked)) {
692 if ($objecttmp->statut == 0) {
693 if (!empty($objecttmp->fk_warehouse)) {
694 $idwarehouse = $objecttmp->fk_warehouse;
698 if ($objecttmp->valid($user, $idwarehouse)) {
699 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
705 $langs->load(
"errors");
706 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
721if ($action ==
'shipped' && $permissiontoadd) {
722 if (
GETPOST(
'confirm') ==
'yes') {
723 $objecttmp =
new $objectclass($db);
726 foreach ($toselect as $checked) {
727 if ($objecttmp->fetch($checked)) {
728 if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
729 if ($objecttmp->cloture($user)) {
730 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
732 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
736 $langs->load(
"errors");
737 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
754if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
757 $objecttmp =
new $objectclass($db);
759 foreach ($toselect as $toselectid) {
760 $result = $objecttmp->fetch($toselectid);
762 $result = $objecttmp->classifyBilled($user, 0);
795$form =
new Form($db);
799if (isModEnabled(
'margin')) {
802$companystatic =
new Societe($db);
803$company_url_list = array();
805$projectstatic =
new Project($db);
809$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
810$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
812$title = $langs->trans(
"Orders");
813$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
818if ($sall || $search_user > 0) {
819 $sql =
'SELECT DISTINCT';
821$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,';
822$sql .=
" s.parent as fk_parent,";
823$sql .=
" s2.nom as name2,";
824$sql .=
" typent.code as typent_code,";
825$sql .=
" state.code_departement as state_code, state.nom as state_name,";
826$sql .=
" country.code as country_code,";
827$sql .=
' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
828$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,';
829$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,';
830$sql .=
' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
831$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
832$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,';
833$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
834$sql .=
' c.fk_input_reason, c.import_key';
835if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
836 $sql .=
", cc.fk_categorie, cc.fk_soc";
840if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
841 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
842 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
847$parameters = array();
848$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
849$sql .= $hookmanager->resPrint;
850$sql = preg_replace(
'/,\s*$/',
'', $sql);
854$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
855$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
856$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
857$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
858$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
859if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
860 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
862$sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
863if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
864 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
867 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
869$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
870$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
873if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
874 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
876if ($search_user > 0) {
877 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
878 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
882$parameters = array();
883$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
884$sql .= $hookmanager->resPrint;
886$sql .=
' WHERE c.fk_soc = s.rowid';
887$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
889 $sql .=
' AND s.rowid = '.((int) $socid);
891if (empty($user->rights->societe->client->voir) && !$socid) {
892 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
897if ($search_ref_customer) {
903if ($search_billed !=
'' && $search_billed >= 0) {
904 $sql .=
' AND c.facture = '.((int) $search_billed);
906if ($search_status <>
'') {
907 if ($search_status <= 3 && $search_status >= -1) {
908 if ($search_status == 1 && !isModEnabled(
'expedition')) {
909 $sql .=
' AND c.fk_statut IN (1,2)';
911 $sql .=
' AND c.fk_statut = '.((int) $search_status);
914 if ($search_status == -2) {
916 $sql .=
" AND (c.fk_statut IN (1,2))";
918 if ($search_status == -3) {
921 $sql .=
' AND (c.fk_statut IN (1,2,3))';
923 if ($search_status == -4) {
924 $sql .=
' AND (c.fk_statut IN (1,2))';
927if ($search_option ==
'late') {
928 $sql .=
" AND c.date_commande < '".$db->idate(
dol_now() - $conf->commande->client->warning_delay).
"'";
930if ($search_datecloture_start) {
931 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
933if ($search_datecloture_end) {
934 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
936if ($search_dateorder_start) {
937 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
939if ($search_dateorder_end) {
940 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
942if ($search_datedelivery_start) {
943 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
945if ($search_datedelivery_end) {
946 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
957if ($search_country) {
958 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
960if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
961 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
963if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
964 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
966 if ($search_company) {
969 if ($search_company_alias) {
973if ($search_parent_name) {
976if ($search_sale > 0) {
977 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
979if ($search_user > 0) {
980 $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);
982if ($search_total_ht !=
'') {
985if ($search_total_vat !=
'') {
988if ($search_total_ttc !=
'') {
991if ($search_warehouse !=
'' && $search_warehouse > 0) {
994if ($search_multicurrency_code !=
'') {
995 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
997if ($search_multicurrency_tx !=
'') {
998 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
1000if ($search_multicurrency_montant_ht !=
'') {
1001 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
1003if ($search_multicurrency_montant_vat !=
'') {
1004 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
1006if ($search_multicurrency_montant_ttc !=
'') {
1007 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1010 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
1012if ($search_project_ref !=
'') {
1015if ($search_project !=
'') {
1018if ($search_categ_cus > 0) {
1019 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
1021if ($search_categ_cus == -2) {
1022 $sql .=
" AND cc.fk_categorie IS NULL";
1024if ($search_fk_cond_reglement > 0) {
1025 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1027if ($search_fk_shipping_method > 0) {
1028 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1030if ($search_fk_mode_reglement > 0) {
1031 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1033if ($search_fk_input_reason > 0) {
1034 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1037$searchCategoryProductOperator = -1;
1038$searchCategoryProductList = array($search_product_category);
1039if (!empty($searchCategoryProductList)) {
1040 $searchCategoryProductSqlList = array();
1041 $listofcategoryid =
'';
1042 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1043 if (intval($searchCategoryProduct) == -2) {
1044 $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)";
1045 } elseif (intval($searchCategoryProduct) > 0) {
1046 if ($searchCategoryProductOperator == 0) {
1047 $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).
")";
1049 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1053 if ($listofcategoryid) {
1054 $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).
"))";
1056 if ($searchCategoryProductOperator == 1) {
1057 if (!empty($searchCategoryProductSqlList)) {
1058 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1061 if (!empty($searchCategoryProductSqlList)) {
1062 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1067include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1069$parameters = array();
1070$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1071$sql .= $hookmanager->resPrint;
1074$parameters = array();
1075$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1076$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1079$nbtotalofrecords =
'';
1082 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1083 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1084 $resql = $db->query($sqlforcount);
1086 $objforcount = $db->fetch_object($resql);
1087 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1092 if (($page * $limit) > $nbtotalofrecords) {
1099$sql .= $db->order($sortfield, $sortorder);
1101 $sql .= $db->plimit($limit + 1, $offset);
1105$resql = $db->query($sql);
1113 $soc->fetch($socid);
1114 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1115 if (empty($search_company)) {
1116 $search_company = $soc->name;
1119 $title = $langs->trans(
'CustomersOrders');
1121if (strval($search_status) ==
'0') {
1122 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1124if ($search_status == 1) {
1125 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1127if ($search_status == 2) {
1128 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1130if ($search_status == 3) {
1131 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1133if ($search_status == -1) {
1134 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1136if ($search_status == -2) {
1137 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1139if ($search_status == -3) {
1140 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'expedition') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1142if ($search_status == -4) {
1143 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1146$num = $db->num_rows($resql);
1148$arrayofselected = is_array($toselect) ? $toselect : array();
1150if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
1151 $obj = $db->fetch_object($resql);
1153 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
1162$arrayofselected = is_array($toselect) ? $toselect : array();
1166 $param .=
'&mode='.urlencode($mode);
1168if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1169 $param .=
'&contextpage='.urlencode($contextpage);
1171if ($limit > 0 && $limit != $conf->liste_limit) {
1172 $param .=
'&limit='.((int) $limit);
1175 $param .=
'&sall='.urlencode($sall);
1178 $param .=
'&socid='.urlencode($socid);
1180if ($search_status !=
'') {
1181 $param .=
'&search_status='.urlencode($search_status);
1183if ($search_option) {
1184 $param .=
"&search_option=".urlencode($search_option);
1186if ($search_datecloture_start) {
1187 $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');
1189if ($search_datecloture_end) {
1190 $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');
1192if ($search_dateorder_start) {
1193 $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');
1195if ($search_dateorder_end) {
1196 $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');
1198if ($search_datedelivery_start) {
1199 $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');
1201if ($search_datedelivery_end) {
1202 $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');
1205 $param .=
'&search_ref='.urlencode($search_ref);
1207if ($search_company) {
1208 $param .=
'&search_company='.urlencode($search_company);
1210if ($search_company_alias) {
1211 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1213if ($search_parent_name !=
'') {
1214 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1216if ($search_ref_customer) {
1217 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1219if ($search_user > 0) {
1220 $param .=
'&search_user='.urlencode($search_user);
1222if ($search_sale > 0) {
1223 $param .=
'&search_sale='.urlencode($search_sale);
1225if ($search_total_ht !=
'') {
1226 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1228if ($search_total_vat !=
'') {
1229 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1231if ($search_total_ttc !=
'') {
1232 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1234if ($search_warehouse !=
'') {
1235 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1238 $param .=
'&search_login='.urlencode($search_login);
1240if ($search_multicurrency_code !=
'') {
1241 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1243if ($search_multicurrency_tx !=
'') {
1244 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1246if ($search_multicurrency_montant_ht !=
'') {
1247 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1249if ($search_multicurrency_montant_vat !=
'') {
1250 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1252if ($search_multicurrency_montant_ttc !=
'') {
1253 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1255if ($search_project_ref >= 0) {
1256 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1258if ($search_town !=
'') {
1259 $param .=
'&search_town='.urlencode($search_town);
1261if ($search_zip !=
'') {
1262 $param .=
'&search_zip='.urlencode($search_zip);
1264if ($search_state !=
'') {
1265 $param .=
'&search_state='.urlencode($search_state);
1267if ($search_country !=
'') {
1268 $param .=
'&search_country='.urlencode($search_country);
1270if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1271 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1273if ($search_product_category !=
'') {
1274 $param .=
'&search_product_category='.urlencode($search_product_category);
1276if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1277 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1280 $param .=
'&show_files='.urlencode($show_files);
1282if ($optioncss !=
'') {
1283 $param .=
'&optioncss='.urlencode($optioncss);
1285if ($search_billed !=
'') {
1286 $param .=
'&search_billed='.urlencode($search_billed);
1288if ($search_fk_cond_reglement > 0) {
1289 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
1291if ($search_fk_shipping_method > 0) {
1292 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
1294if ($search_fk_mode_reglement > 0) {
1295 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
1297if ($search_fk_input_reason > 0) {
1298 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
1302include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1305$parameters = array();
1306$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1307$param .= $hookmanager->resPrint;
1310$arrayofmassactions = array(
1311 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1312 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1314if ($permissiontovalidate) {
1315 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1317if ($permissiontoclose) {
1318 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1320if ($permissiontoclose) {
1321 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1323if ($permissiontocancel) {
1324 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel");
1326if (!empty($permissiontodelete)) {
1327 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1329if (isModEnabled(
'facture') && $user->hasRight(
"facture",
"creer")) {
1330 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1332if ($permissiontosendbymail) {
1333 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1335if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1336 $arrayofmassactions = array();
1338$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1340$url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1341if (!empty($socid)) {
1342 $url .=
'&socid='.$socid;
1345$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'));
1346$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'));
1347$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', $contextpage ==
'orderlist' && $permissiontoadd);
1350print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1351if ($optioncss !=
'') {
1352 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1354print
'<input type="hidden" name="token" value="'.newToken().
'">';
1355print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1356print
'<input type="hidden" name="action" value="list">';
1357print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1358print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1359print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1360print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1361print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1362print
'<input type="hidden" name="page_y" value="">';
1363print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1366print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1368$topicmail =
"SendOrderRef";
1369$modelmail =
"order_send";
1371$trackid =
'ord'.$object->id;
1372include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1374if ($massaction ==
'prevalidate') {
1375 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1377if ($massaction ==
'preshipped') {
1378 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1381if ($massaction ==
'createbills') {
1382 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1384 print
'<table class="noborder centpercent">';
1387 print $langs->trans(
'DateInvoice');
1390 print $form->selectDate(
'',
'',
'',
'',
'',
'', 1, 1);
1395 print $langs->trans(
'CreateOneBillByThird');
1398 print $form->selectyesno(
'createbills_onebythird',
'', 1);
1403 print $langs->trans(
'ValidateInvoices');
1406 if (isModEnabled(
'stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
1407 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
1408 $langs->load(
"errors");
1409 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1411 print $form->selectyesno(
'validate_invoices', 0, 1);
1413 if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) {
1414 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1416 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1422 print
'<div class="center">';
1423 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1424 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1431 foreach ($fieldstosearchall as $key => $val) {
1432 $fieldstosearchall[$key] = $langs->trans($val);
1433 $setupstring .= $key.
"=".$val.
";";
1435 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1436 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1442if ($user->hasRight(
"user",
"user",
"lire")) {
1443 $langs->load(
"commercial");
1444 $moreforfilter .=
'<div class="divsearchfield">';
1445 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1446 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1447 $moreforfilter .=
'</div>';
1450if ($user->hasRight(
"user",
"user",
"lire")) {
1451 $moreforfilter .=
'<div class="divsearchfield">';
1452 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1453 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1454 $moreforfilter .=
'</div>';
1458if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1459 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1460 $moreforfilter .=
'<div class="divsearchfield">';
1461 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1462 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1463 $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);
1464 $moreforfilter .=
'</div>';
1467if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1468 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1469 $moreforfilter .=
'<div class="divsearchfield">';
1470 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1471 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1472 $moreforfilter .=
'</div>';
1475if (isModEnabled(
'stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
1476 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1478 $moreforfilter .=
'<div class="divsearchfield">';
1479 $tmptitle = $langs->trans(
'Warehouse');
1480 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1481 $moreforfilter .=
'</div>';
1484$parameters = array();
1485$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1486if (empty($reshook)) {
1487 $moreforfilter .= $hookmanager->resPrint;
1489 $moreforfilter = $hookmanager->resPrint;
1492if (!empty($moreforfilter)) {
1493 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1494 print $moreforfilter;
1495 $parameters = array();
1496 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1497 print $hookmanager->resPrint;
1501$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1502$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
1503$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1505if (
GETPOST(
'autoselectall',
'int')) {
1506 $selectedfields .=
'<script>';
1507 $selectedfields .=
' $(document).ready(function() {';
1508 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1509 $selectedfields .=
' $("#checkforselects").click();';
1510 $selectedfields .=
' $("#massaction").val("createbills").change();';
1511 $selectedfields .=
' });';
1512 $selectedfields .=
'</script>';
1515print
'<div class="div-table-responsive">';
1516print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1520print
'<tr class="liste_titre_filter">';
1523 print
'<td class="liste_titre center maxwidthsearch">';
1524 $searchpicto = $form->showFilterButtons(
'left');
1530if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1531 print
'<td class="liste_titre">';
1532 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1536if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1537 print
'<td class="liste_titre" align="left">';
1538 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1542if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1543 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1546if (!empty($arrayfields[
'p.title'][
'checked'])) {
1547 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1550if (!empty($arrayfields[
's.nom'][
'checked'])) {
1551 print
'<td class="liste_titre" align="left">';
1552 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1556if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1557 print
'<td class="liste_titre" align="left">';
1558 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1562if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1563 print
'<td class="liste_titre">';
1564 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1568if (!empty($arrayfields[
's.town'][
'checked'])) {
1569 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1572if (!empty($arrayfields[
's.zip'][
'checked'])) {
1573 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1576if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1577 print
'<td class="liste_titre">';
1578 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1582if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1583 print
'<td class="liste_titre" align="center">';
1584 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1588if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1589 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1590 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);
1594if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1595 print
'<td class="liste_titre center">';
1596 print
'<div class="nowrap">';
1597 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1599 print
'<div class="nowrap">';
1600 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1604if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1605 print
'<td class="liste_titre center">';
1606 print
'<div class="nowrap">';
1607 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1609 print
'<div class="nowrap">';
1610 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1615if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1616 print
'<td class="liste_titre">';
1617 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1621if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1622 print
'<td class="liste_titre">';
1623 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1627if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1628 print
'<td class="liste_titre">';
1629 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1633if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1634 print
'<td class="liste_titre">';
1635 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1639if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1640 print
'<td class="liste_titre right">';
1641 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1645if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1646 print
'<td class="liste_titre right">';
1647 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1651if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1652 print
'<td class="liste_titre right">';
1653 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1657if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1658 print
'<td class="liste_titre">';
1659 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1663if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1664 print
'<td class="liste_titre">';
1665 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1669if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1670 print
'<td class="liste_titre right">';
1671 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1675if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1676 print
'<td class="liste_titre right">';
1677 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1681if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1682 print
'<td class="liste_titre right">';
1683 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1687if (!empty($arrayfields[
'u.login'][
'checked'])) {
1688 print
'<td class="liste_titre">';
1689 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1693if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1694 print
'<td class="liste_titre"></td>';
1696if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1697 print
'<td class="liste_titre right">';
1700if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1701 print
'<td class="liste_titre right">';
1704if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1705 print
'<td class="liste_titre right">';
1708if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1709 print
'<td class="liste_titre right">';
1714include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1717$parameters = array(
'arrayfields'=>$arrayfields);
1718$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1719print $hookmanager->resPrint;
1722if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1723 print
'<td class="liste_titre">';
1727if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1728 print
'<td class="liste_titre">';
1732if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1733 print
'<td class="liste_titre center">';
1734 print
'<div class="nowrap">';
1735 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1737 print
'<div class="nowrap">';
1738 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1743if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1744 print
'<td class="liste_titre">';
1748if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1749 print
'<td class="liste_titre">';
1753if (!empty($arrayfields[
'shippable'][
'checked'])) {
1754 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1756 if (!empty($conf->global->ORDER_SHIPABLE_STATUS_DISABLED_BY_DEFAULT)) {
1757 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1758 print $langs->trans(
'ShowShippableStatus');
1760 $show_shippable_command = 1;
1765if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1766 print
'<td class="liste_titre maxwidthonsmartphone center">';
1767 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1771if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1772 print
'<td class="liste_titre maxwidthonsmartphone center">';
1776if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1777 print
'<td class="liste_titre right parentonrightofpage">';
1778 $liststatus = array(
1783 -3=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1784 -2=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1787 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1792 print
'<td class="liste_titre center maxwidthsearch">';
1793 $searchpicto = $form->showFilterButtons();
1812print
'<tr class="liste_titre">';
1816 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1817 $totalarray[
'nbfield']++;
1819if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1820 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1821 $totalarray[
'nbfield']++;
1823if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1824 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1825 $totalarray[
'nbfield']++;
1827if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1828 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1829 $totalarray[
'nbfield']++;
1831if (!empty($arrayfields[
'p.title'][
'checked'])) {
1832 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1833 $totalarray[
'nbfield']++;
1835if (!empty($arrayfields[
's.nom'][
'checked'])) {
1836 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1837 $totalarray[
'nbfield']++;
1839if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1840 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1841 $totalarray[
'nbfield']++;
1843if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1844 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1845 $totalarray[
'nbfield']++;
1847if (!empty($arrayfields[
's.town'][
'checked'])) {
1848 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1849 $totalarray[
'nbfield']++;
1851if (!empty($arrayfields[
's.zip'][
'checked'])) {
1852 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1853 $totalarray[
'nbfield']++;
1855if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1856 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1857 $totalarray[
'nbfield']++;
1859if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1860 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1861 $totalarray[
'nbfield']++;
1863if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1864 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1865 $totalarray[
'nbfield']++;
1867if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1868 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1869 $totalarray[
'nbfield']++;
1871if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1872 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1873 $totalarray[
'nbfield']++;
1875if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1876 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1877 $totalarray[
'nbfield']++;
1879if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1880 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1881 $totalarray[
'nbfield']++;
1883if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1884 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1885 $totalarray[
'nbfield']++;
1887if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1888 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1889 $totalarray[
'nbfield']++;
1891if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1892 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1893 $totalarray[
'nbfield']++;
1895if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1896 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1897 $totalarray[
'nbfield']++;
1899if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1900 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1901 $totalarray[
'nbfield']++;
1903if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1904 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1905 $totalarray[
'nbfield']++;
1907if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1908 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1909 $totalarray[
'nbfield']++;
1911if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1912 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1913 $totalarray[
'nbfield']++;
1915if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1916 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1917 $totalarray[
'nbfield']++;
1919if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1920 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1921 $totalarray[
'nbfield']++;
1923if (!empty($arrayfields[
'u.login'][
'checked'])) {
1924 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1925 $totalarray[
'nbfield']++;
1927if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1928 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1929 $totalarray[
'nbfield']++;
1931if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1932 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1933 $totalarray[
'nbfield']++;
1935if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1936 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1937 $totalarray[
'nbfield']++;
1939if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1940 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1941 $totalarray[
'nbfield']++;
1943if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1944 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1945 $totalarray[
'nbfield']++;
1949include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1952$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1953$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1954print $hookmanager->resPrint;
1955if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1956 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1957 $totalarray[
'nbfield']++;
1959if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1960 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1961 $totalarray[
'nbfield']++;
1963if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1964 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1965 $totalarray[
'nbfield']++;
1967if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1968 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1969 $totalarray[
'nbfield']++;
1971if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1972 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1973 $totalarray[
'nbfield']++;
1975if (!empty($arrayfields[
'shippable'][
'checked'])) {
1976 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1977 $totalarray[
'nbfield']++;
1979if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1980 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1981 $totalarray[
'nbfield']++;
1983if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1984 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1985 $totalarray[
'nbfield']++;
1987if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1988 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
1989 $totalarray[
'nbfield']++;
1993 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1994 $totalarray[
'nbfield']++;
2000$productstat_cache = array();
2001$productstat_cachevirtual = array();
2002$getNomUrl_cache = array();
2004$generic_commande =
new Commande($db);
2005$generic_product =
new Product($db);
2006$userstatic =
new User($db);
2008$with_margin_info =
false;
2009if (isModEnabled(
'margin') && (
2010 !empty($arrayfields[
'total_pa'][
'checked'])
2011 || !empty($arrayfields[
'total_margin'][
'checked'])
2012 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2013 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2016 $with_margin_info =
true;
2025$savnbfield = $totalarray[
'nbfield'];
2026$totalarray = array();
2027$totalarray[
'nbfield'] = 0;
2028$imaxinloop = ($limit ? min($num, $limit) : $num);
2029while ($i < $imaxinloop) {
2030 $obj = $db->fetch_object($resql);
2041 $companystatic->id = $obj->socid;
2042 $companystatic->name = $obj->name;
2043 $companystatic->name_alias = $obj->alias;
2044 $companystatic->client = $obj->client;
2045 $companystatic->fournisseur = $obj->fournisseur;
2046 $companystatic->code_client = $obj->code_client;
2047 $companystatic->email = $obj->email;
2048 $companystatic->phone = $obj->phone;
2049 $companystatic->address = $obj->address;
2050 $companystatic->zip = $obj->zip;
2051 $companystatic->town = $obj->town;
2052 $companystatic->country_code = $obj->country_code;
2053 if (!isset($getNomUrl_cache[$obj->socid])) {
2054 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2057 $generic_commande->id = $obj->rowid;
2058 $generic_commande->ref = $obj->ref;
2059 $generic_commande->statut = $obj->fk_statut;
2060 $generic_commande->billed = $obj->billed;
2061 $generic_commande->date = $db->jdate($obj->date_commande);
2062 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2063 $generic_commande->ref_client = $obj->ref_client;
2064 $generic_commande->total_ht = $obj->total_ht;
2065 $generic_commande->total_tva = $obj->total_tva;
2066 $generic_commande->total_ttc = $obj->total_ttc;
2067 $generic_commande->note_public = $obj->note_public;
2068 $generic_commande->note_private = $obj->note_private;
2070 $generic_commande->thirdparty = $companystatic;
2073 $projectstatic->id = $obj->project_id;
2074 $projectstatic->ref = $obj->project_ref;
2075 $projectstatic->title = $obj->project_label;
2077 $marginInfo = array();
2078 if ($with_margin_info ===
true) {
2079 $generic_commande->fetch_lines();
2080 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2081 $total_ht += $obj->total_ht;
2082 $total_margin += $marginInfo[
'total_margin'];
2085 if ($mode ==
'kanban') {
2087 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2088 print
'<div class="box-flex-container kanban">';
2093 if ($massactionbutton || $massaction) {
2095 if (in_array($object->id, $arrayofselected)) {
2099 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2100 if ($i == ($imaxinloop - 1)) {
2107 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
2111 print
'<td class="nowrap center">';
2112 if ($massactionbutton || $massaction) {
2114 if (in_array($obj->rowid, $arrayofselected)) {
2117 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2121 $totalarray[
'nbfield']++;
2126 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2127 print
'<td class="nowraponall">';
2128 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
2131 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
2132 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2133 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2137 $totalarray[
'nbfield']++;
2142 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2143 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2147 $totalarray[
'nbfield']++;
2152 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2153 print
'<td class="nowrap">';
2154 if ($obj->project_id > 0) {
2155 print $projectstatic->getNomUrl(1);
2159 $totalarray[
'nbfield']++;
2164 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2165 print
'<td class="nowrap">';
2166 if ($obj->project_id > 0) {
2167 print $projectstatic->title;
2171 $totalarray[
'nbfield']++;
2176 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2177 print
'<td class="tdoverflowmax150">';
2179 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2181 print $getNomUrl_cache[$obj->socid];
2185 if (isModEnabled(
'facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
2186 if ($user->hasRight(
'facture',
'creer')) {
2187 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2188 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2189 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2195 $totalarray[
'nbfield']++;
2200 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2201 print
'<td class="nocellnopadd">';
2205 $totalarray[
'nbfield']++;
2210 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2211 print
'<td class="tdoverflowmax200">';
2212 if ($obj->fk_parent > 0) {
2213 if (!isset($company_url_list[$obj->fk_parent])) {
2214 $companyparent =
new Societe($db);
2215 $res = $companyparent->fetch($obj->fk_parent);
2217 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2220 if (isset($company_url_list[$obj->fk_parent])) {
2221 print $company_url_list[$obj->fk_parent];
2226 $totalarray[
'nbfield']++;
2231 if (!empty($arrayfields[
's.town'][
'checked'])) {
2232 print
'<td class="nocellnopadd">';
2236 $totalarray[
'nbfield']++;
2241 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2242 print
'<td class="nocellnopadd">';
2246 $totalarray[
'nbfield']++;
2251 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2252 print
"<td>".$obj->state_name.
"</td>\n";
2254 $totalarray[
'nbfield']++;
2259 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2260 print
'<td class="center">';
2261 $tmparray =
getCountry($obj->fk_pays,
'all');
2262 print $tmparray[
'label'];
2265 $totalarray[
'nbfield']++;
2270 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2271 print
'<td class="center">';
2272 if (empty($typenArray)) {
2273 $typenArray = $formcompany->typent_array(1);
2275 print $typenArray[$obj->typent_code];
2278 $totalarray[
'nbfield']++;
2283 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2284 print
'<td class="center">';
2287 if ($generic_commande->hasDelay()) {
2288 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2292 $totalarray[
'nbfield']++;
2297 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2298 print
'<td class="center">';
2299 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2302 $totalarray[
'nbfield']++;
2307 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2309 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2312 $totalarray[
'nbfield']++;
2317 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2319 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2322 $totalarray[
'nbfield']++;
2327 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2329 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2332 $totalarray[
'nbfield']++;
2337 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2339 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none',
'');
2342 $totalarray[
'nbfield']++;
2347 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2348 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2350 $totalarray[
'nbfield']++;
2353 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2355 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2356 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2358 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2363 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2364 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2366 $totalarray[
'nbfield']++;
2369 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2371 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2372 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2374 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2379 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2380 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2382 $totalarray[
'nbfield']++;
2385 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2387 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2388 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2390 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2395 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2396 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2398 $totalarray[
'nbfield']++;
2403 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2404 print
'<td class="nowrap">';
2405 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2408 $totalarray[
'nbfield']++;
2413 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2414 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2416 $totalarray[
'nbfield']++;
2420 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2421 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2423 $totalarray[
'nbfield']++;
2427 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2428 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2430 $totalarray[
'nbfield']++;
2434 $userstatic->id = $obj->fk_user_author;
2435 $userstatic->login = $obj->login;
2436 $userstatic->lastname = $obj->lastname;
2437 $userstatic->firstname = $obj->firstname;
2438 $userstatic->email = $obj->user_email;
2439 $userstatic->statut = $obj->user_statut;
2440 $userstatic->entity = $obj->entity;
2441 $userstatic->photo = $obj->photo;
2442 $userstatic->office_phone = $obj->office_phone;
2443 $userstatic->office_fax = $obj->office_fax;
2444 $userstatic->user_mobile = $obj->user_mobile;
2445 $userstatic->job = $obj->job;
2446 $userstatic->gender = $obj->gender;
2449 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2450 print
'<td class="tdoverflowmax150">';
2451 if ($userstatic->id) {
2452 print $userstatic->getNomUrl(-1);
2458 $totalarray[
'nbfield']++;
2463 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2465 if ($obj->socid > 0) {
2466 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2467 if ($listsalesrepresentatives < 0) {
2470 $nbofsalesrepresentative = count($listsalesrepresentatives);
2471 if ($nbofsalesrepresentative > 6) {
2473 print $nbofsalesrepresentative;
2474 } elseif ($nbofsalesrepresentative > 0) {
2476 foreach ($listsalesrepresentatives as $val) {
2477 $userstatic->id = $val[
'id'];
2478 $userstatic->lastname = $val[
'lastname'];
2479 $userstatic->firstname = $val[
'firstname'];
2480 $userstatic->email = $val[
'email'];
2481 $userstatic->statut = $val[
'statut'];
2482 $userstatic->entity = $val[
'entity'];
2483 $userstatic->photo = $val[
'photo'];
2484 $userstatic->login = $val[
'login'];
2485 $userstatic->office_phone = $val[
'office_phone'];
2486 $userstatic->office_fax = $val[
'office_fax'];
2487 $userstatic->user_mobile = $val[
'user_mobile'];
2488 $userstatic->job = $val[
'job'];
2489 $userstatic->gender = $val[
'gender'];
2491 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2493 if ($j < $nbofsalesrepresentative) {
2505 $totalarray[
'nbfield']++;
2510 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2511 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2513 $totalarray[
'nbfield']++;
2518 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2519 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2521 $totalarray[
'nbfield']++;
2524 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2526 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2530 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2531 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], null, null, null, null, 2).
'%').
'</td>';
2533 $totalarray[
'nbfield']++;
2538 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2539 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], null, null, null, null, 2).
'%').
'</td>';
2541 $totalarray[
'nbfield']++;
2544 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2546 if ($i >= $imaxinloop - 1) {
2547 if (!empty($total_ht)) {
2548 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2550 $totalarray[
'val'][
'total_mark_rate'] =
'';
2556 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2558 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2559 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2560 print $hookmanager->resPrint;
2563 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2564 print
'<td align="center" class="nowrap">';
2565 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2568 $totalarray[
'nbfield']++;
2573 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2574 print
'<td align="center" class="nowrap">';
2575 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2578 $totalarray[
'nbfield']++;
2583 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2584 print
'<td align="center" class="nowrap">';
2585 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2588 $totalarray[
'nbfield']++;
2593 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2594 print
'<td class="center">';
2598 $totalarray[
'nbfield']++;
2603 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2604 print
'<td class="center">';
2608 $totalarray[
'nbfield']++;
2613 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2614 print
'<td class="center">';
2615 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2616 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2617 $generic_commande->getLinesArray();
2618 $generic_commande->loadExpeditions();
2620 $numlines = count($generic_commande->lines);
2621 for ($lig = 0; $lig < $numlines; $lig++) {
2622 if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
2623 $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
2625 $reliquat = $generic_commande->lines[$lig]->qty;
2627 if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) {
2629 $generic_product->id = $generic_commande->lines[$lig]->fk_product;
2632 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
2633 $generic_product->load_stock(
'nobatch,warehouseopen');
2634 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2635 $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2637 $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2638 $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2641 if ($reliquat > $generic_product->stock_reel) {
2644 if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
2645 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->product_ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2646 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2647 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2648 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2649 $text_info .=
'<br>';
2656 $stock_order_supplier = 0;
2657 if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
2658 if (isModEnabled(
'commande')) {
2659 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'])) {
2660 $generic_product->load_stats_commande(0,
'1,2');
2661 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2663 $generic_product->stats_commande[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'];
2665 $stock_order = $generic_product->stats_commande[
'qty'];
2667 if (isModEnabled(
"supplier_order")) {
2668 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'])) {
2669 $generic_product->load_stats_commande_fournisseur(0,
'3');
2670 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2672 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'];
2674 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2677 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2678 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2679 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
2681 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2683 if ($reliquat > $generic_product->stock_reel) {
2684 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2686 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2688 if (isModEnabled(
"supplier_order")) {
2689 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2691 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2692 $text_info .=
'<br>';
2696 if ($notshippable == 0) {
2697 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
2698 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2700 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
2701 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2706 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2709 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2714 $totalarray[
'nbfield']++;
2719 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2720 print
'<td class="center">'.yn($obj->billed).
'</td>';
2722 $totalarray[
'nbfield']++;
2727 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2728 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2730 $totalarray[
'nbfield']++;
2735 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2736 print
'<td class="nowrap right">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2738 $totalarray[
'nbfield']++;
2744 print
'<td class="nowrap center">';
2745 if ($massactionbutton || $massaction) {
2747 if (in_array($obj->rowid, $arrayofselected)) {
2750 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2754 $totalarray[
'nbfield']++;
2760 $total += $obj->total_ht;
2761 $subtotal += $obj->total_ht;
2767include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2772 foreach ($arrayfields as $key => $val) {
2773 if (!empty($val[
'checked'])) {
2777 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2782$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2783$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2784print $hookmanager->resPrint;
2786print
'</table>'.
"\n";
2789print
'</form>'.
"\n";
2791if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2792 $hidegeneratedfilelistifempty = 1;
2793 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2794 $hidegeneratedfilelistifempty = 0;
2798 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2799 $urlsource .= str_replace(
'&',
'&', $param);
2801 $filedir = $diroutputmassaction;
2802 $genallowed = $permissiontoread;
2803 $delallowed = $permissiontoadd;
2805 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.