38 require
'../main.inc.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
54 $langs->loadLangs(array(
'products',
'stocks',
'suppliers',
'companies',
'margins'));
56 $langs->load(
"productbatch");
61 $action =
GETPOST(
'action',
'aZ09');
62 $massaction =
GETPOST(
'massaction',
'alpha');
63 $show_files =
GETPOST(
'show_files',
'int');
64 $confirm =
GETPOST(
'confirm',
'alpha');
65 $toselect =
GETPOST(
'toselect',
'array');
68 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
69 $search_id =
GETPOST(
"search_id",
'alpha');
70 $search_ref =
GETPOST(
"search_ref",
'alpha');
71 $search_ref_supplier =
GETPOST(
"search_ref_supplier",
'alpha');
72 $search_barcode =
GETPOST(
"search_barcode",
'alpha');
73 $search_label =
GETPOST(
"search_label",
'alpha');
74 $search_default_workstation =
GETPOST(
"search_default_workstation",
'alpha');
75 $search_type =
GETPOST(
"search_type",
'int');
76 $search_vatrate =
GETPOST(
"search_vatrate",
'alpha');
77 $searchCategoryProductOperator = 0;
79 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
80 } elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
81 $searchCategoryProductOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
83 $searchCategoryProductList =
GETPOST(
'search_category_product_list',
'array');
84 $catid =
GETPOST(
'catid',
'int');
85 if (!empty($catid) && empty($searchCategoryProductList)) {
86 $searchCategoryProductList = array($catid);
88 $search_tosell =
GETPOST(
"search_tosell",
'int');
89 $search_tobuy =
GETPOST(
"search_tobuy",
'int');
90 $search_country =
GETPOST(
"search_country",
'int');
91 $search_state =
GETPOST(
"state_id",
'int');
92 $fourn_id =
GETPOST(
"fourn_id",
'int');
93 $search_tobatch =
GETPOST(
"search_tobatch",
'int');
94 $search_accountancy_code_sell =
GETPOST(
"search_accountancy_code_sell",
'alpha');
95 $search_accountancy_code_sell_intra =
GETPOST(
"search_accountancy_code_sell_intra",
'alpha');
96 $search_accountancy_code_sell_export =
GETPOST(
"search_accountancy_code_sell_export",
'alpha');
97 $search_accountancy_code_buy =
GETPOST(
"search_accountancy_code_buy",
'alpha');
98 $search_accountancy_code_buy_intra =
GETPOST(
"search_accountancy_code_buy_intra",
'alpha');
99 $search_accountancy_code_buy_export =
GETPOST(
"search_accountancy_code_buy_export",
'alpha');
100 $search_finished =
GETPOST(
"search_finished",
'int');
101 $search_units =
GETPOST(
'search_units',
'int');
102 $optioncss =
GETPOST(
'optioncss',
'alpha');
103 $type =
GETPOST(
"type",
"int");
104 $mode =
GETPOST(
'mode',
'alpha');
108 if (
isModEnabled(
'variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
109 $show_childproducts =
GETPOST(
'search_show_childproducts');
111 $show_childproducts =
'';
114 $diroutputmassaction = $conf->product->dir_output.
'/temp/massgeneration/'.$user->id;
117 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
118 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
119 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
121 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
125 $offset = $limit * $page;
126 $pageprev = $page - 1;
127 $pagenext = $page + 1;
129 $sortfield =
"p.ref";
136 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'productservicelist';
137 if ((
string) $type ==
'1') {
138 $contextpage =
'servicelist';
if ($search_type ==
'') {
142 if ((
string) $type ==
'0') {
143 $contextpage =
'productlist';
if ($search_type ==
'') {
150 $hookmanager->initHooks(array(
'productservicelist'));
157 $extrafields->fetch_name_optionals_label($object->table_element);
158 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
160 if (empty($action)) {
167 if (!empty($canvas)) {
168 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
169 $objcanvas =
new Canvas($db, $action);
170 $objcanvas->getCanvas(
'product',
'list', $canvas);
174 $virtualdiffersfromphysical = 0;
175 if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
176 || !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
177 || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
178 || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
179 || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
181 $virtualdiffersfromphysical = 1;
185 $fieldstosearchall = array(
187 'p.label'=>
"ProductLabel",
188 'p.description'=>
"Description",
190 'pfp.ref_fourn'=>
'RefSupplier'
194 $fieldstosearchall[
'pl.label'] =
'ProductLabelTranslated';
195 $fieldstosearchall[
'pl.description'] =
'ProductDescriptionTranslated';
196 $fieldstosearchall[
'pl.note'] =
'ProductNoteTranslated';
199 $fieldstosearchall[
'p.barcode'] =
'Gencod';
200 $fieldstosearchall[
'pfp.barcode'] =
'GencodBuyPrice';
203 if (!empty($conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS)) {
207 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
208 $titlesellprice = $langs->trans(
"SellingPrice");
209 if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
210 $titlesellprice =
$form->textwithpicto($langs->trans(
"SellingPrice"), $langs->trans(
"DefaultPriceRealPriceMayDependOnCustomer"));
216 $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ?
"p" :
"ppe";
219 $arrayfields = array(
220 'p.rowid'=>array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>1,
'visible'=>-2,
'noteditable'=>1,
'notnull'=> 1,
'index'=>1,
'position'=>1,
'comment'=>
'Id',
'css'=>
'left'),
221 'p.ref'=>array(
'label'=>
'ProductRef',
'checked'=>1,
'position'=>10),
223 'thumbnail'=>array(
'label'=>
'Photo',
'checked'=>0,
'position'=>10),
224 'p.label'=>array(
'label'=>
"Label",
'checked'=>1,
'position'=>10),
225 'p.fk_product_type'=>array(
'label'=>
"Type",
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") &&
isModEnabled(
"service")),
'position'=>11),
226 'p.barcode'=>array(
'label'=>
"Gencod",
'checked'=>1,
'enabled'=>(
isModEnabled(
'barcode')),
'position'=>12),
227 'p.duration'=>array(
'label'=>
"Duration",
'checked'=>($contextpage !=
'productlist'),
'enabled'=>(
isModEnabled(
"service") && (
string) $type ==
'1'),
'position'=>13),
228 'p.finished'=>array(
'label'=>
"Nature",
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && $type !=
'1'),
'position'=>19),
229 'p.weight'=>array(
'label'=>
'Weight',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && $type !=
'1'),
'position'=>20),
230 'p.weight_units'=>array(
'label'=>
'WeightUnits',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && $type !=
'1'),
'position'=>21),
231 'p.length'=>array(
'label'=>
'Length',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type !=
'1'),
'position'=>22),
232 'p.length_units'=>array(
'label'=>
'LengthUnits',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type !=
'1'),
'position'=>23),
233 'p.width'=>array(
'label'=>
'Width',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type !=
'1'),
'position'=>24),
234 'p.width_units'=>array(
'label'=>
'WidthUnits',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type !=
'1'),
'position'=>25),
235 'p.height'=>array(
'label'=>
'Height',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type !=
'1'),
'position'=>26),
236 'p.height_units'=>array(
'label'=>
'HeightUnits',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type !=
'1'),
'position'=>27),
237 'p.surface'=>array(
'label'=>
'Surface',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_SURFACE) && $type !=
'1'),
'position'=>28),
238 'p.surface_units'=>array(
'label'=>
'SurfaceUnits',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_SURFACE) && $type !=
'1'),
'position'=>29),
239 'p.volume'=>array(
'label'=>
'Volume',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_VOLUME) && $type !=
'1'),
'position'=>30),
240 'p.volume_units'=>array(
'label'=>
'VolumeUnits',
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && empty($conf->global->PRODUCT_DISABLE_VOLUME) && $type !=
'1'),
'position'=>31),
241 'cu.label'=>array(
'label'=>
"DefaultUnitToShow",
'checked'=>0,
'enabled'=>(
isModEnabled(
"product") && !empty($conf->global->PRODUCT_USE_UNITS)),
'position'=>32),
242 'p.fk_default_workstation'=>array(
'label'=>
'DefaultWorkstation',
'checked'=>0,
'enabled'=>
isModEnabled(
'workstation') && $type == 1,
'position'=>33),
243 'p.sellprice'=>array(
'label'=>
"SellingPrice",
'checked'=>1,
'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES),
'position'=>40),
244 'p.tva_tx'=>array(
'label'=>
"VATRate",
'checked'=>0,
'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES),
'position'=>41),
245 'p.minbuyprice'=>array(
'label'=>
"BuyingPriceMinShort",
'checked'=>1,
'enabled'=>(!empty($user->rights->fournisseur->lire)),
'position'=>42),
246 'p.numbuyprice'=>array(
'label'=>
"BuyingPriceNumShort",
'checked'=>0,
'enabled'=>(!empty($user->rights->fournisseur->lire)),
'position'=>43),
247 'p.pmp'=>array(
'label'=>
"PMPValueShort",
'checked'=>0,
'enabled'=>(!empty($user->rights->fournisseur->lire)),
'position'=>44),
248 'p.cost_price'=>array(
'label'=>
"CostPrice",
'checked'=>0,
'enabled'=>(!empty($user->rights->fournisseur->lire)),
'position'=>45),
249 'p.seuil_stock_alerte'=>array(
'label'=>
"StockLimit",
'checked'=>0,
'enabled'=>(
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))),
'position'=>50),
250 'p.desiredstock'=>array(
'label'=>
"DesiredStock",
'checked'=>1,
'enabled'=>(
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))),
'position'=>51),
251 'p.stock'=>array(
'label'=>
"PhysicalStock",
'checked'=>1,
'enabled'=>(
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))),
'position'=>52),
252 'stock_virtual'=>array(
'label'=>
"VirtualStock",
'checked'=>1,
'enabled'=>(
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $virtualdiffersfromphysical),
'position'=>53),
253 'p.tobatch'=>array(
'label'=>
"ManageLotSerial",
'checked'=>0,
'enabled'=>(
isModEnabled(
'productbatch')),
'position'=>60),
254 'p.fk_country'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>100),
255 'p.fk_state'=>array(
'label'=>
"State",
'checked'=>0,
'position'=>101),
256 $alias_product_perentity .
'.accountancy_code_sell'=>array(
'label'=>
"ProductAccountancySellCode",
'checked'=>0,
'enabled'=>empty($conf->global->PRODUCT_DISABLE_ACCOUNTING),
'position'=>400),
257 $alias_product_perentity .
'.accountancy_code_sell_intra'=>array(
'label'=>
"ProductAccountancySellIntraCode",
'checked'=>0,
'enabled'=>$isInEEC && empty($conf->global->PRODUCT_DISABLE_ACCOUNTING),
'position'=>401),
258 $alias_product_perentity .
'.accountancy_code_sell_export'=>array(
'label'=>
"ProductAccountancySellExportCode",
'checked'=>0,
'enabled'=>empty($conf->global->PRODUCT_DISABLE_ACCOUNTING),
'position'=>402),
259 $alias_product_perentity .
'.accountancy_code_buy'=>array(
'label'=>
"ProductAccountancyBuyCode",
'checked'=>0,
'enabled'=>empty($conf->global->PRODUCT_DISABLE_ACCOUNTING),
'position'=>403),
260 $alias_product_perentity .
'.accountancy_code_buy_intra'=>array(
'label'=>
"ProductAccountancyBuyIntraCode",
'checked'=>0,
'enabled'=>$isInEEC && empty($conf->global->PRODUCT_DISABLE_ACCOUNTING),
'position'=>404),
261 $alias_product_perentity .
'.accountancy_code_buy_export'=>array(
'label'=>
"ProductAccountancyBuyExportCode",
'checked'=>0,
'enabled'=>empty($conf->global->PRODUCT_DISABLE_ACCOUNTING),
'position'=>405),
262 'p.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
263 'p.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
264 'p.tosell'=>array(
'label'=>$langs->transnoentitiesnoconv(
"Status").
' ('.$langs->transnoentitiesnoconv(
"Sell").
')',
'checked'=>1,
'position'=>1000),
265 'p.tobuy'=>array(
'label'=>$langs->transnoentitiesnoconv(
"Status").
' ('.$langs->transnoentitiesnoconv(
"Buy").
')',
'checked'=>1,
'position'=>1000)
282 if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
283 for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
284 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$i;
285 if (!empty($conf->global->$keyforlabel)) {
286 $labelp = $i.
' - '.$langs->transnoentitiesnoconv($conf->global->$keyforlabel);
288 $labelp = $langs->transnoentitiesnoconv(
"SellingPrice").
" ".$i;
290 $arrayfields[
'p.sellprice'.$i] = array(
'label'=>$labelp,
'checked'=>($i == 1 ? 1 : 0),
'enabled'=>$conf->global->PRODUIT_MULTIPRICES,
'position'=>floatval(
'40.'.sprintf(
'%03s', $i)));
291 $arraypricelevel[$i] = array($i);
297 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
303 if ($search_type ==
'0') {
304 $result =
restrictedArea($user,
'produit',
'',
'',
'',
'',
'', 0);
305 } elseif ($search_type ==
'1') {
306 $result =
restrictedArea($user,
'service',
'',
'',
'',
'',
'', 0);
308 $result =
restrictedArea($user,
'produit|service',
'',
'',
'',
'',
'', 0);
316 if (
GETPOST(
'cancel',
'alpha')) {
320 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
323 $parameters = array();
324 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
329 $rightskey =
'produit';
331 $rightskey =
'service';
334 if (empty($reshook)) {
336 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
339 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
343 $search_ref_supplier =
"";
345 $search_default_workstation =
"";
346 $search_barcode =
"";
347 $searchCategoryProductOperator = 0;
348 $searchCategoryProductList = array();
351 $search_tobatch =
'';
352 $search_country =
"";
354 $search_vatrate =
"";
355 $search_finished =
'';
358 $show_childproducts =
'';
359 $search_accountancy_code_sell =
'';
360 $search_accountancy_code_sell_intra =
'';
361 $search_accountancy_code_sell_export =
'';
362 $search_accountancy_code_buy =
'';
363 $search_accountancy_code_buy_intra =
'';
364 $search_accountancy_code_buy_export =
'';
365 $search_array_options = array();
370 $objectclass =
'Product';
371 if ((
string) $search_type ==
'1') {
372 $objectlabel =
'Services';
374 if ((
string) $search_type ==
'0') {
375 $objectlabel =
'Products';
378 $permissiontoread = $user->hasRight($rightskey,
'lire');
379 $permissiontodelete = $user->hasRight($rightskey,
'supprimer');
380 $permissiontoadd = $user->hasRight($rightskey,
'creer');
381 $uploaddir = $conf->product->dir_output;
382 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
384 if (!$error && $massaction ==
'switchonsalestatus' && $permissiontoadd) {
386 foreach ($toselect as $toselectid) {
387 $result = $product->fetch($toselectid);
388 if ($result > 0 && $product->id > 0) {
389 if ($product->setStatut($product->status ? 0 : 1,
null,
'product',
'PRODUCT_MODIFY',
'tosell') < 0) {
395 if (!$error && $massaction ==
'switchonpurchasestatus' && $permissiontoadd) {
397 foreach ($toselect as $toselectid) {
398 $result = $product->fetch($toselectid);
399 if ($result > 0 && $product->id > 0) {
400 if ($product->setStatut($product->status_buy ? 0 : 1,
null,
'product',
'PRODUCT_MODIFY',
'tobuy') < 0) {
413 $product_static =
new Product($db);
417 $title = $langs->trans(
"ProductsAndServices");
419 if ($search_type !=
'' && $search_type !=
'-1') {
420 if ($search_type == 1) {
421 $title = $langs->trans(
"Services");
423 $title = $langs->trans(
"Products");
429 $sql =
'SELECT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,';
430 $sql .=
' p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
431 $sql .=
' p.tobatch, ';
433 $sql .=
' p.fk_default_workstation, ws.status as status_workstation, ws.ref as ref_workstation, ';
435 if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
436 $sql .=
" p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
438 $sql .=
" ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
440 $sql .=
' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock, p.cost_price,';
441 $sql .=
' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, fk_country, fk_state,';
442 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
443 $sql .=
' p.fk_unit, cu.label as cu_label,';
445 $sql .=
' MIN(pfp.unitprice) as bestpurchaseprice';
446 if (
isModEnabled(
'variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
447 $sql .=
', pac.rowid as prod_comb_id';
450 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
451 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
452 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
456 $parameters = array();
457 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
458 $sql .= $hookmanager->resPrint;
459 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
463 $sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
465 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"workstation_workstation as ws ON (p.fk_default_workstation = ws.rowid)";
467 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
468 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
470 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
471 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_extrafields as ef on (p.rowid = ef.fk_object)";
473 $linktopfp =
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
477 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$db->escape($langs->getDefaultLang()).
"'";
480 if (
isModEnabled(
'variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
481 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_attribute_combination pac ON pac.fk_product_child = p.rowid";
483 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
484 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_units cu ON cu.rowid = p.fk_unit";
487 $sql .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
490 $newfieldstosearchall = $fieldstosearchall;
491 unset($newfieldstosearchall[
'pfp.ref_fourn']);
492 unset($newfieldstosearchall[
'pfp.barcode']);
497 $sql .=
' OR EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.
'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid';
498 $sql .=
' AND ('.natural_search(
'pfp.ref_fourn', $sall, 0, 1);
501 $sql .=
' OR '.natural_search(
'pfp.barcode', $sall, 0, 1);
506 if (
dol_strlen($search_type) && $search_type !=
'-1') {
507 if ($search_type == 1) {
508 $sql .=
" AND p.fk_product_type = 1";
510 $sql .=
" AND p.fk_product_type <> 1";
514 if (
isModEnabled(
'variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
515 $sql .=
" AND pac.rowid IS NULL";
527 if ($search_default_workstation) {
530 if ($search_barcode) {
533 if (isset($search_tosell) &&
dol_strlen($search_tosell) > 0 && $search_tosell != -1) {
534 $sql .=
" AND p.tosell = ".((int) $search_tosell);
536 if (isset($search_tobuy) &&
dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) {
537 $sql .=
" AND p.tobuy = ".((int) $search_tobuy);
539 if (isset($search_tobatch) &&
dol_strlen($search_tobatch) > 0 && $search_tobatch != -1) {
540 $sql .=
" AND p.tobatch = ".((int) $search_tobatch);
542 if ($search_vatrate) {
546 $sql .=
" AND p.canvas = '".$db->escape($canvas).
"'";
549 if (!empty($searchCategoryProductList)) {
550 $searchCategoryProductSqlList = array();
551 $listofcategoryid =
'';
552 foreach ($searchCategoryProductList as $searchCategoryProduct) {
553 if (intval($searchCategoryProduct) == -2) {
554 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product)";
555 } elseif (intval($searchCategoryProduct) > 0) {
556 if ($searchCategoryProductOperator == 0) {
557 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
559 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
563 if ($listofcategoryid) {
564 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
566 if ($searchCategoryProductOperator == 1) {
567 if (!empty($searchCategoryProductSqlList)) {
568 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
571 if (!empty($searchCategoryProductSqlList)) {
572 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
577 $sql .=
" AND pfp.fk_soc = ".((int) $fourn_id);
579 if ($search_country) {
580 $sql .=
" AND p.fk_country = ".((int) $search_country);
583 $sql .=
" AND p.fk_state = ".((int) $search_state);
585 if ($search_finished >= 0 && $search_finished !==
'') {
586 $sql .=
" AND p.finished = ".((int) $search_finished);
588 if ($search_accountancy_code_sell) {
591 if ($search_accountancy_code_sell_intra) {
594 if ($search_accountancy_code_sell_export) {
597 if ($search_accountancy_code_buy) {
600 if ($search_accountancy_code_buy_intra) {
603 if ($search_accountancy_code_buy_export) {
606 if (!empty($conf->global->PRODUCT_USE_UNITS) && $search_units) {
610 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
612 $parameters = array();
613 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
614 $sql .= $hookmanager->resPrint;
615 $sql .=
" GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,";
616 $sql .=
" p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
617 $sql .=
' p.datec, p.tms, p.entity, p.tobatch, p.pmp, p.cost_price, p.stock,';
618 if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
619 $sql .=
" p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
621 $sql .=
" ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
623 $sql .=
' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.fk_country, p.fk_state';
624 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
625 $sql .=
', p.fk_unit, cu.label';
628 $sql .=
', p.fk_default_workstation, ws.status, ws.ref ';
631 if (
isModEnabled(
'variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
632 $sql .=
', pac.rowid';
635 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
636 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
637 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
641 $parameters = array();
642 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
643 $sql .= $hookmanager->resPrint;
646 $nbtotalofrecords =
'';
649 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
650 $sqlforcount = preg_replace(
'/'.preg_quote($linktopfp,
'/').
'/',
'', $sqlforcount);
651 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
653 $resql = $db->query($sqlforcount);
655 $objforcount = $db->fetch_object($resql);
656 $nbtotalofrecords = $objforcount->nbtotalofrecords;
661 if (($page * $limit) > $nbtotalofrecords) {
669 $sql .= $db->order($sortfield, $sortorder);
671 $sql .= $db->plimit($limit + 1, $offset);
674 $resql = $db->query(
$sql);
680 $num = $db->num_rows($resql);
684 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
685 $obj = $db->fetch_object($resql);
687 header(
"Location: ".DOL_URL_ROOT.
'/product/card.php?id='.$id);
696 if ($search_type !=
'') {
697 if ($search_type == 0) {
698 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
699 } elseif ($search_type == 1) {
700 $helpurl =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
705 foreach ($searchCategoryProductList as $searchCategoryProduct) {
706 $paramsCat .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
710 llxHeader(
'', $title, $helpurl,
'', 0, 0, array(), array(), $paramsCat,
'');
712 $arrayofselected = is_array($toselect) ? $toselect : array();
721 $param .=
'&mode='.urlencode($mode);
723 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
724 $param .=
'&contextpage='.urlencode($contextpage);
726 if ($limit > 0 && $limit != $conf->liste_limit) {
727 $param .=
'&limit='.((int) $limit);
729 if ($optioncss !=
'') {
730 $param .=
'&optioncss='.urlencode($optioncss);
733 $param .=
"&sall=".urlencode($sall);
735 if ($searchCategoryProductOperator == 1) {
736 $param .=
"&search_category_product_operator=".urlencode($searchCategoryProductOperator);
738 foreach ($searchCategoryProductList as $searchCategoryProduct) {
739 $param .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
742 $param .=
"&search_ref=".urlencode($search_ref);
744 if ($search_ref_supplier) {
745 $param .=
"&search_ref_supplier=".urlencode($search_ref_supplier);
747 if ($search_barcode) {
748 $param .= ($search_barcode ?
"&search_barcode=".urlencode($search_barcode) :
"");
751 $param .=
"&search_label=".urlencode($search_label);
753 if ($search_default_workstation) {
754 $param .=
"&search_default_workstation=".urlencode($search_default_workstation);
756 if ($search_tosell !=
'') {
757 $param .=
"&search_tosell=".urlencode($search_tosell);
759 if ($search_tobuy !=
'') {
760 $param .=
"&search_tobuy=".urlencode($search_tobuy);
762 if ($search_tobatch) {
763 $param .=
"&search_tobatch=".urlencode($search_tobatch);
765 if ($search_country !=
'') {
766 $param .=
"&search_country=".urlencode($search_country);
768 if ($search_state !=
'') {
769 $param .=
"&search_state=".urlencode($search_state);
771 if ($search_vatrate) {
772 $param .=
"&search_vatrate=".urlencode($search_vatrate);
775 $param .=
"&fourn_id=".urlencode($fourn_id);
777 if ($show_childproducts) {
778 $param .= ($show_childproducts ?
"&search_show_childproducts=".urlencode($show_childproducts) :
"");
781 $param .=
'&type='.urlencode($type);
783 if ($search_type !=
'') {
784 $param .=
'&search_type='.urlencode($search_type);
786 if ($search_accountancy_code_sell) {
787 $param .=
"&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
789 if ($search_accountancy_code_sell_intra) {
790 $param .=
"&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra);
792 if ($search_accountancy_code_sell_export) {
793 $param .=
"&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export);
795 if ($search_accountancy_code_buy) {
796 $param .=
"&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
798 if ($search_accountancy_code_buy_intra) {
799 $param .=
"&search_accountancy_code_buy_intra=".urlencode($search_accountancy_code_buy_intra);
801 if ($search_accountancy_code_buy_export) {
802 $param .=
"&search_accountancy_code_buy_export=".urlencode($search_accountancy_code_buy_export);
804 if ($search_finished) {
805 $param .=
"&search_finished=".urlencode($search_finished);
808 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
811 $arrayofmassactions = array(
812 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
813 'edit_extrafields'=>
img_picto(
'',
'edit',
'class="pictofixedwidth"').$langs->trans(
"ModifyValueExtrafields"),
818 if ($user->hasRight($rightskey,
'supprimer')) {
819 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
821 if ($user->hasRight($rightskey,
'creer')) {
822 $arrayofmassactions[
'switchonsalestatus'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SwitchOnSaleStatus");
823 $arrayofmassactions[
'switchonpurchasestatus'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SwitchOnPurchaseStatus");
824 $arrayofmassactions[
'preupdateprice'] =
img_picto(
'',
'edit',
'class="pictofixedwidth"').$langs->trans(
"UpdatePrice");
826 if (
isModEnabled(
'category') && $user->hasRight($rightskey,
'creer')) {
827 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
829 if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'edit_extrafields',
'preupdateprice'))) {
830 $arrayofmassactions = array();
832 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
835 $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'));
836 $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'));
839 $perm = ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'));
841 $perm = $user->hasRight(
'service',
'creer');
843 $perm = $user->hasRight(
'produit',
'creer');
848 $params[
'forcenohideoftext'] = 1;
852 $label =
'NewProduct';
853 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/card.php?action=create&type=0',
'', $perm, $params);
856 $label =
'NewService';
857 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/card.php?action=create&type=1',
'', $perm, $params);
860 print
'<form id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire">';
861 if ($optioncss !=
'') {
862 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
864 print
'<input type="hidden" name="token" value="'.newToken().
'">';
865 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
866 print
'<input type="hidden" name="action" value="list">';
867 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
868 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
870 print
'<input type="hidden" name="type" value="'.$type.
'">';
871 print
'<input type="hidden" name="page_y" value="">';
872 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
874 if (empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
875 print
'<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).
'">';
883 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
885 $topicmail =
"Information";
886 $modelmail =
"product";
888 $trackid =
'prod'.$object->id;
889 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
891 if (!empty($catid)) {
892 print
"<div id='ways'>";
894 $ways = $c->print_all_ways(
' > ',
'product/list.php');
895 print
" > ".$ways[0].
"<br>\n";
901 foreach ($fieldstosearchall as $key => $val) {
902 $fieldstosearchall[$key] = $langs->trans($val);
903 $setupstring .= $key.
"=".$val.
";";
905 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
906 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
911 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'read')) {
913 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList,
'minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0);
917 if (
isModEnabled(
'variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
918 $moreforfilter .=
'<div class="divsearchfield">';
919 $moreforfilter .=
'<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ?
'checked="checked"' :
'').
'>';
920 $moreforfilter .=
' <label for="search_show_childproducts">'.$langs->trans(
'ShowChildProducts').
'</label>';
921 $moreforfilter .=
'</div>';
924 $parameters = array();
925 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
926 if (empty($reshook)) {
927 $moreforfilter .= $hookmanager->resPrint;
929 $moreforfilter = $hookmanager->resPrint;
932 if (!empty($moreforfilter)) {
933 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
934 print $moreforfilter;
938 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
939 $selectedfields = ($mode !=
'kanban' ?
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
940 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
942 print
'<div class="div-table-responsive">';
943 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
947 print
'<tr class="liste_titre_filter">';
950 print
'<td class="liste_titre center maxwidthsearch">';
951 $searchpicto =
$form->showFilterButtons(
'left');
955 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
956 print
'<td class="liste_titre left">';
957 print
'<input class="flat" type="text" name="search_id" size="4" value="'.dol_escape_htmltag($search_id).
'">';
960 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
961 print
'<td class="liste_titre left">';
962 print
'<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).
'">';
965 if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
966 print
'<td class="liste_titre left">';
967 print
'<input class="flat" type="text" name="search_ref_supplier" size="8" value="'.dol_escape_htmltag($search_ref_supplier).
'">';
971 if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
972 print
'<td class="liste_titre center">';
975 if (!empty($arrayfields[
'p.label'][
'checked'])) {
976 print
'<td class="liste_titre left">';
977 print
'<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).
'">';
981 if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
982 print
'<td class="liste_titre center">';
983 $array = array(
'-1'=>
' ',
'0'=>$langs->trans(
'Product'),
'1'=>$langs->trans(
'Service'));
984 print
$form->selectarray(
'search_type', $array, $search_type);
988 if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
989 print
'<td class="liste_titre">';
990 print
'<input class="flat" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).
'">';
994 if (!empty($arrayfields[
'p.duration'][
'checked'])) {
995 print
'<td class="liste_titre">';
1000 if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1001 print
'<td class="liste_titre">';
1002 print $formproduct->selectProductNature(
'search_finished', $search_finished);
1006 if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1007 print
'<td class="liste_titre">';
1011 if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1012 print
'<td class="liste_titre">';
1016 if (!empty($arrayfields[
'p.length'][
'checked'])) {
1017 print
'<td class="liste_titre">';
1021 if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1022 print
'<td class="liste_titre">';
1026 if (!empty($arrayfields[
'p.width'][
'checked'])) {
1027 print
'<td class="liste_titre">';
1031 if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1032 print
'<td class="liste_titre">';
1036 if (!empty($arrayfields[
'p.height'][
'checked'])) {
1037 print
'<td class="liste_titre">';
1041 if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1042 print
'<td class="liste_titre">';
1046 if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1047 print
'<td class="liste_titre">';
1051 if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1052 print
'<td class="liste_titre">';
1056 if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1057 print
'<td class="liste_titre">';
1061 if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1062 print
'<td class="liste_titre">';
1067 if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1068 print
'<td class="liste_titre">';
1069 print
$form->selectUnits($search_units,
'search_units', 1);
1074 if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1075 print
'<td class="liste_titre">';
1076 print
'<input class="flat width75" type="text" name="search_default_workstation" value="'.dol_escape_htmltag($search_default_workstation).
'">';
1081 if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1082 print
'<td class="liste_titre right">';
1087 if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
1088 foreach ($arraypricelevel as $key => $value) {
1089 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1090 print
'<td class="liste_titre right">';
1097 if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
1098 print
'<td class="liste_titre">';
1103 if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
1104 print
'<td class="liste_titre">';
1109 if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
1110 print
'<td class="liste_titre right">';
1111 print
'<input class="right flat maxwidth50" placeholder="%" type="text" name="search_vatrate" size="1" value="'.dol_escape_htmltag($search_vatrate).
'">';
1115 if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
1116 print
'<td class="liste_titre">';
1121 if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
1122 print
'<td class="liste_titre">';
1127 if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
1128 print
'<td class="liste_titre">';
1133 if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
1134 print
'<td class="liste_titre">';
1139 if (!empty($arrayfields[
'p.stock'][
'checked'])) {
1140 print
'<td class="liste_titre"> </td>';
1143 if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
1144 print
'<td class="liste_titre"> </td>';
1147 if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
1148 print
'<td class="liste_titre center">';
1149 $statutarray = array(
1151 '0' => $langs->trans(
"ProductStatusNotOnBatchShort"),
1152 '1' => $langs->trans(
"ProductStatusOnBatchShort"),
1153 '2' => $langs->trans(
"ProductStatusOnSerialShort")
1155 print
$form->selectarray(
'search_tobatch', $statutarray, $search_tobatch);
1159 if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
1160 print
'<td class="liste_titre center">';
1161 print
$form->select_country($search_country,
'search_country',
'', 0);
1165 if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
1166 print
'<td class="liste_titre center">';
1167 print $formcompany->select_state($search_state, $search_country);
1171 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
1172 print
'<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell" value="'.dol_escape_htmltag($search_accountancy_code_sell).
'"></td>';
1174 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
1175 print
'<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_intra" value="'.dol_escape_htmltag($search_accountancy_code_sell_intra).
'"></td>';
1177 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
1178 print
'<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_export" value="'.dol_escape_htmltag($search_accountancy_code_sell_export).
'"></td>';
1181 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
1182 print
'<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy" value="'.dol_escape_htmltag($search_accountancy_code_buy).
'"></td>';
1184 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
1185 print
'<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy_intra" value="'.dol_escape_htmltag($search_accountancy_code_buy_intra).
'"></td>';
1187 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
1188 print
'<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy_export" value="'.dol_escape_htmltag($search_accountancy_code_buy_export).
'"></td>';
1191 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1193 $parameters = array(
'arrayfields'=>$arrayfields);
1194 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1195 print $hookmanager->resPrint;
1197 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1198 print
'<td class="liste_titre">';
1202 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1203 print
'<td class="liste_titre">';
1206 if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
1207 print
'<td class="liste_titre center parentonrightofpage">';
1208 print
$form->selectarray(
'search_tosell', array(
'0'=>$langs->trans(
'ProductStatusNotOnSellShort'),
'1'=>$langs->trans(
'ProductStatusOnSellShort')), $search_tosell, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
1211 if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
1212 print
'<td class="liste_titre center parentonrightofpage">';
1213 print
$form->selectarray(
'search_tobuy', array(
'0'=>$langs->trans(
'ProductStatusNotOnBuyShort'),
'1'=>$langs->trans(
'ProductStatusOnBuyShort')), $search_tobuy, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
1218 print
'<td class="liste_titre center maxwidthsearch">';
1219 $searchpicto =
$form->showFilterButtons();
1225 $totalarray = array();
1226 $totalarray[
'nbfield'] = 0;
1230 print
'<tr class="liste_titre">';
1233 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1234 $totalarray[
'nbfield']++;
1236 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1237 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1238 $totalarray[
'nbfield']++;
1240 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1241 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1242 $totalarray[
'nbfield']++;
1244 if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
1245 print_liste_field_titre($arrayfields[
'pfp.ref_fourn'][
'label'], $_SERVER[
"PHP_SELF"],
"pfp.ref_fourn",
"", $param,
"", $sortfield, $sortorder);
1246 $totalarray[
'nbfield']++;
1248 if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
1249 print_liste_field_titre($arrayfields[
'thumbnail'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1250 $totalarray[
'nbfield']++;
1252 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1253 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
"p.label",
"", $param,
"", $sortfield, $sortorder);
1254 $totalarray[
'nbfield']++;
1256 if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
1257 print_liste_field_titre($arrayfields[
'p.fk_product_type'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_product_type",
"", $param,
"", $sortfield, $sortorder,
'center ');
1258 $totalarray[
'nbfield']++;
1260 if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
1261 print_liste_field_titre($arrayfields[
'p.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"p.barcode",
"", $param,
"", $sortfield, $sortorder);
1262 $totalarray[
'nbfield']++;
1264 if (!empty($arrayfields[
'p.duration'][
'checked'])) {
1265 print_liste_field_titre($arrayfields[
'p.duration'][
'label'], $_SERVER[
"PHP_SELF"],
"p.duration",
"", $param,
'', $sortfield, $sortorder,
'center ');
1266 $totalarray[
'nbfield']++;
1268 if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1269 print_liste_field_titre($arrayfields[
'p.finished'][
'label'], $_SERVER[
"PHP_SELF"],
"p.finished",
"", $param,
'', $sortfield, $sortorder,
'center ');
1270 $totalarray[
'nbfield']++;
1273 if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1274 print_liste_field_titre($arrayfields[
'p.weight'][
'label'], $_SERVER[
'PHP_SELF'],
'p.weight',
'', $param,
'', $sortfield, $sortorder,
'center ');
1275 $totalarray[
'nbfield']++;
1277 if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1278 print_liste_field_titre($arrayfields[
'p.weight_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.weight_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1279 $totalarray[
'nbfield']++;
1281 if (!empty($arrayfields[
'p.length'][
'checked'])) {
1282 print_liste_field_titre($arrayfields[
'p.length'][
'label'], $_SERVER[
'PHP_SELF'],
'p.length',
'', $param,
'', $sortfield, $sortorder,
'center ');
1283 $totalarray[
'nbfield']++;
1285 if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1286 print_liste_field_titre($arrayfields[
'p.length_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.length_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1287 $totalarray[
'nbfield']++;
1289 if (!empty($arrayfields[
'p.width'][
'checked'])) {
1290 print_liste_field_titre($arrayfields[
'p.width'][
'label'], $_SERVER[
'PHP_SELF'],
'p.width',
'', $param,
'', $sortfield, $sortorder,
'center ');
1291 $totalarray[
'nbfield']++;
1293 if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1294 print_liste_field_titre($arrayfields[
'p.width_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.width_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1295 $totalarray[
'nbfield']++;
1297 if (!empty($arrayfields[
'p.height'][
'checked'])) {
1298 print_liste_field_titre($arrayfields[
'p.height'][
'label'], $_SERVER[
'PHP_SELF'],
'p.height',
'', $param,
'', $sortfield, $sortorder,
'center ');
1299 $totalarray[
'nbfield']++;
1301 if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1302 print_liste_field_titre($arrayfields[
'p.height_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.height_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1303 $totalarray[
'nbfield']++;
1305 if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1306 print_liste_field_titre($arrayfields[
'p.surface'][
'label'], $_SERVER[
'PHP_SELF'],
"p.surface",
'', $param,
'', $sortfield, $sortorder,
'center ');
1307 $totalarray[
'nbfield']++;
1309 if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1310 print_liste_field_titre($arrayfields[
'p.surface_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.surface_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1311 $totalarray[
'nbfield']++;
1313 if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1314 print_liste_field_titre($arrayfields[
'p.volume'][
'label'], $_SERVER[
'PHP_SELF'],
'p.volume',
'', $param,
'', $sortfield, $sortorder,
'center ');
1315 $totalarray[
'nbfield']++;
1317 if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1318 print_liste_field_titre($arrayfields[
'p.volume_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.volume_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1319 $totalarray[
'nbfield']++;
1321 if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1322 print_liste_field_titre($arrayfields[
'cu.label'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1323 $totalarray[
'nbfield']++;
1325 if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1326 print_liste_field_titre($arrayfields[
'p.fk_default_workstation'][
'label'], $_SERVER[
'PHP_SELF'],
'ws.ref',
'', $param,
'', $sortfield, $sortorder);
1327 $totalarray[
'nbfield']++;
1329 if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1330 print_liste_field_titre($arrayfields[
'p.sellprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1331 $totalarray[
'nbfield']++;
1335 if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
1336 foreach ($arraypricelevel as $key => $value) {
1337 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1338 print_liste_field_titre($arrayfields[
'p.sellprice'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1339 $totalarray[
'nbfield']++;
1344 if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
1345 print_liste_field_titre($arrayfields[
'p.minbuyprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1346 $totalarray[
'nbfield']++;
1348 if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
1349 print_liste_field_titre($arrayfields[
'p.numbuyprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1350 $totalarray[
'nbfield']++;
1352 if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
1353 print_liste_field_titre($arrayfields[
'p.tva_tx'][
'label'], $_SERVER[
"PHP_SELF"],
'p.tva_tx',
"", $param,
'', $sortfield, $sortorder,
'right ');
1354 $totalarray[
'nbfield']++;
1356 if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
1357 print_liste_field_titre($arrayfields[
'p.pmp'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1358 $totalarray[
'nbfield']++;
1360 if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
1361 print_liste_field_titre($arrayfields[
'p.cost_price'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1362 $totalarray[
'nbfield']++;
1364 if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
'p.seuil_stock_alerte'][
'label'], $_SERVER[
"PHP_SELF"],
"p.seuil_stock_alerte",
"", $param,
'', $sortfield, $sortorder,
'right ');
1366 $totalarray[
'nbfield']++;
1368 if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
1369 print_liste_field_titre($arrayfields[
'p.desiredstock'][
'label'], $_SERVER[
"PHP_SELF"],
"p.desiredstock",
"", $param,
'', $sortfield, $sortorder,
'right ');
1370 $totalarray[
'nbfield']++;
1372 if (!empty($arrayfields[
'p.stock'][
'checked'])) {
1373 print_liste_field_titre($arrayfields[
'p.stock'][
'label'], $_SERVER[
"PHP_SELF"],
"p.stock",
"", $param,
'', $sortfield, $sortorder,
'right ');
1374 $totalarray[
'nbfield']++;
1376 if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
'stock_virtual'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ',
'VirtualStockDesc');
1378 $totalarray[
'nbfield']++;
1380 if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
1381 print_liste_field_titre($arrayfields[
'p.tobatch'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tobatch",
"", $param,
'', $sortfield, $sortorder,
'center ');
1382 $totalarray[
'nbfield']++;
1384 if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
1385 print_liste_field_titre($arrayfields[
'p.fk_country'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_country",
"", $param,
'', $sortfield, $sortorder);
1386 $totalarray[
'nbfield']++;
1388 if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
1389 print_liste_field_titre($arrayfields[
'p.fk_state'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_state",
"", $param,
'', $sortfield, $sortorder);
1390 $totalarray[
'nbfield']++;
1392 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
1393 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_sell",
"", $param,
'', $sortfield, $sortorder);
1394 $totalarray[
'nbfield']++;
1396 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
1397 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_sell_intra",
"", $param,
'', $sortfield, $sortorder);
1398 $totalarray[
'nbfield']++;
1400 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
1401 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_sell_export",
"", $param,
'', $sortfield, $sortorder);
1402 $totalarray[
'nbfield']++;
1404 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
1405 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_buy",
"", $param,
'', $sortfield, $sortorder);
1406 $totalarray[
'nbfield']++;
1408 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
1409 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_buy_intra",
"", $param,
'', $sortfield, $sortorder);
1410 $totalarray[
'nbfield']++;
1412 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
1413 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_buy_export",
"", $param,
'', $sortfield, $sortorder);
1414 $totalarray[
'nbfield']++;
1417 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1419 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1420 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1421 print $hookmanager->resPrint;
1422 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1423 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1424 $totalarray[
'nbfield']++;
1426 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1427 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1428 $totalarray[
'nbfield']++;
1430 if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
1431 print_liste_field_titre($arrayfields[
'p.tosell'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tosell",
"", $param,
'', $sortfield, $sortorder,
'center ');
1432 $totalarray[
'nbfield']++;
1434 if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
1435 print_liste_field_titre($arrayfields[
'p.tobuy'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tobuy",
"", $param,
'', $sortfield, $sortorder,
'center ');
1436 $totalarray[
'nbfield']++;
1440 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1441 $totalarray[
'nbfield']++;
1449 $savnbfield = $totalarray[
'nbfield'];
1450 $totalarray = array();
1451 $totalarray[
'nbfield'] = 0;
1452 $imaxinloop = ($limit ? min($num, $limit) : $num);
1453 while ($i < $imaxinloop) {
1454 $obj = $db->fetch_object($resql);
1461 $sql =
"SELECT label";
1462 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1463 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1464 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1467 $result = $db->query(
$sql);
1469 $objtp = $db->fetch_object($result);
1470 if (!empty($objtp->label)) {
1471 $obj->label = $objtp->label;
1476 $parameters = array(
'staticdata' => $obj);
1479 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $product_static, $action);
1480 if (empty($reshook)) {
1481 $product_static->id = $obj->rowid;
1482 $product_static->ref = $obj->ref;
1483 $product_static->ref_fourn = empty($obj->ref_supplier) ?
'' : $obj->ref_supplier;
1484 $product_static->ref_supplier = empty($obj->ref_supplier) ?
'' : $obj->ref_supplier;
1485 $product_static->label = $obj->label;
1486 $product_static->barcode = $obj->barcode;
1487 $product_static->finished = $obj->finished;
1488 $product_static->type = $obj->fk_product_type;
1489 $product_static->status_buy = $obj->tobuy;
1490 $product_static->status = $obj->tosell;
1491 $product_static->status_batch = $obj->tobatch;
1492 $product_static->entity = $obj->entity;
1493 $product_static->pmp = $obj->pmp;
1494 $product_static->accountancy_code_sell = $obj->accountancy_code_sell;
1495 $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
1496 $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
1497 $product_static->accountancy_code_buy = $obj->accountancy_code_buy;
1498 $product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
1499 $product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
1500 $product_static->length = $obj->length;
1501 $product_static->length_units = $obj->length_units;
1502 $product_static->width = $obj->width;
1503 $product_static->width_units = $obj->width_units;
1504 $product_static->height = $obj->height;
1505 $product_static->height_units = $obj->height_units;
1506 $product_static->weight = $obj->weight;
1507 $product_static->weight_units = $obj->weight_units;
1508 $product_static->volume = $obj->volume;
1509 $product_static->volume_units = $obj->volume_units;
1510 $product_static->surface = $obj->surface;
1511 $product_static->surface_units = $obj->surface_units;
1512 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1513 $product_static->fk_unit = $obj->fk_unit;
1517 if ((
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) {
1518 if ($product_static->type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1519 $option =
'nobatch';
1520 if (empty($arrayfields[
'stock_virtual'][
'checked'])) {
1521 $option .=
',novirtual';
1523 $product_static->load_stock($option);
1528 $product_static->price = $obj->price;
1530 $object = $product_static;
1532 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS')?$user->hasRight(
'product',
'product_advance',
'read_prices'):$user->hasRight(
'product',
'lire');
1533 if ($product_static->isService()) {
1534 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS')?$user->hasRight(
'service',
'service_advance',
'read_prices'):$user->hasRight(
'service',
'lire');
1537 if ($mode ==
'kanban') {
1539 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1540 print
'<div class="box-flex-container kanban">';
1544 if ($massactionbutton || $massaction) {
1546 if (in_array($object->id, $arrayofselected)) {
1550 print $object->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected)));
1551 if ($i == ($imaxinloop - 1)) {
1558 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1562 print
'<td class="nowrap center">';
1563 if ($massactionbutton || $massaction) {
1565 if (in_array($object->id, $arrayofselected)) {
1568 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1572 $totalarray[
'nbfield']++;
1576 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1577 print
'<td class="nowraponall">';
1578 print $product_static->id;
1581 $totalarray[
'nbfield']++;
1586 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1587 print
'<td class="tdoverflowmax250">';
1588 print $product_static->getNomUrl(1);
1591 $totalarray[
'nbfield']++;
1596 if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
1597 print
'<td class="tdoverflowmax200">';
1598 print $product_static->getNomUrl(1);
1601 $totalarray[
'nbfield']++;
1606 if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
1607 $product_thumbnail_html =
'';
1608 if (!empty($product_static->entity)) {
1609 $product_thumbnail = $product_static->show_photos(
'product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
1610 if ($product_static->nbphoto > 0) {
1611 $product_thumbnail_html = $product_thumbnail;
1615 print
'<td class="center">' . $product_thumbnail_html .
'</td>';
1617 $totalarray[
'nbfield']++;
1622 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1623 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($product_static->label).
'">'.$product_static->label.
'</td>';
1625 $totalarray[
'nbfield']++;
1630 if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
1631 print
'<td class="center">';
1633 if ($product_static->type == 0) {
1634 $s .=
img_picto($langs->trans(
"Product"),
'product',
'class="paddingleftonly paddingrightonly colorgrey"');
1636 $s .=
img_picto($langs->trans(
"Service"),
'service',
'class="paddingleftonly paddingrightonly colorgrey"');
1641 $totalarray[
'nbfield']++;
1646 if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
1647 print
'<td>'.$product_static->barcode.
'</td>';
1649 $totalarray[
'nbfield']++;
1654 if (!empty($arrayfields[
'p.duration'][
'checked'])) {
1655 print
'<td class="center nowraponall">';
1657 if (preg_match(
'/([^a-z]+)[a-z]$/i', $obj->duration)) {
1658 $duration_value = substr($obj->duration, 0,
dol_strlen($obj->duration) - 1);
1659 $duration_unit = substr($obj->duration, -1);
1661 if ((
float) $duration_value > 1) {
1662 $dur = array(
"i"=>$langs->trans(
"Minutes"),
"h"=>$langs->trans(
"Hours"),
"d"=>$langs->trans(
"Days"),
"w"=>$langs->trans(
"Weeks"),
"m"=>$langs->trans(
"Months"),
"y"=>$langs->trans(
"Years"));
1663 } elseif ((
float) $duration_value > 0) {
1664 $dur = array(
"i"=>$langs->trans(
"Minute"),
"h"=>$langs->trans(
"Hour"),
"d"=>$langs->trans(
"Day"),
"w"=>$langs->trans(
"Week"),
"m"=>$langs->trans(
"Month"),
"y"=>$langs->trans(
"Year"));
1666 print $duration_value;
1667 print ((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value !=
'') ?
' '.$langs->trans($dur[$duration_unit]) :
'');
1668 } elseif (!preg_match(
'/^[a-z]$/i', $obj->duration)) {
1669 print $obj->duration;
1674 $totalarray[
'nbfield']++;
1679 if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1680 print
'<td class="center">';
1681 print $product_static->getLibFinished();
1684 $totalarray[
'nbfield']++;
1689 if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1690 print
'<td class="center">';
1691 print $product_static->weight;
1694 $totalarray[
'nbfield']++;
1698 if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1699 print
'<td class="center">';
1700 if ($product_static->weight !=
'') {
1705 $totalarray[
'nbfield']++;
1709 if (!empty($arrayfields[
'p.length'][
'checked'])) {
1710 print
'<td class="center">';
1711 print $product_static->length;
1714 $totalarray[
'nbfield']++;
1718 if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1719 print
'<td class="center">';
1720 if ($product_static->length !=
'') {
1725 $totalarray[
'nbfield']++;
1729 if (!empty($arrayfields[
'p.width'][
'checked'])) {
1730 print
'<td align="center">';
1731 print $product_static->width;
1734 $totalarray[
'nbfield']++;
1738 if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1739 print
'<td class="center">';
1740 if ($product_static->width !=
'') {
1745 $totalarray[
'nbfield']++;
1749 if (!empty($arrayfields[
'p.height'][
'checked'])) {
1750 print
'<td align="center">';
1751 print $product_static->height;
1754 $totalarray[
'nbfield']++;
1758 if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1759 print
'<td class="center">';
1760 if ($product_static->height !=
'') {
1765 $totalarray[
'nbfield']++;
1769 if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1770 print
'<td class="center">';
1771 print $product_static->surface;
1774 $totalarray[
'nbfield']++;
1778 if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1779 print
'<td class="center">';
1780 if ($product_static->surface !=
'') {
1785 $totalarray[
'nbfield']++;
1789 if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1790 print
'<td class="center">';
1791 print $product_static->volume;
1794 $totalarray[
'nbfield']++;
1798 if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1799 print
'<td class="center">';
1800 if ($product_static->volume !=
'') {
1805 $totalarray[
'nbfield']++;
1809 if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1810 print
'<td align="center">';
1811 if (!empty($obj->cu_label)) {
1812 print $langs->trans($obj->cu_label);
1816 $totalarray[
'nbfield']++;
1821 if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1822 print
'<td align="left">';
1823 if (!empty($obj->fk_default_workstation)) {
1824 $static_ws->id = $obj->fk_default_workstation;
1825 $static_ws->ref = $obj->ref_workstation;
1826 $static_ws->status = $obj->status_workstation;
1828 print $static_ws->getNomUrl(1);
1832 $totalarray[
'nbfield']++;
1837 if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1838 print
'<td class="right nowraponall">';
1839 if ($product_static->status && $usercancreadprice) {
1840 if ($obj->price_base_type ==
'TTC') {
1841 print
'<span class="amount">'.price($obj->price_ttc).
' '.$langs->trans(
"TTC").
'</span>';
1843 print
'<span class="amount">'.price($obj->price).
' '.$langs->trans(
"HT").
'</span>';
1848 $totalarray[
'nbfield']++;
1854 if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
1855 if (! isset($productpricescache)) {
1856 $productpricescache=array();
1858 if (! isset($productpricescache[$obj->rowid])) {
1859 $productpricescache[$obj->rowid] = array();
1862 if ($product_static->status && $usercancreadprice) {
1865 $sqlp =
"SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price, p.price_base_type";
1866 $sqlp .=
" FROM ".MAIN_DB_PREFIX.
"product_price as p";
1867 $sqlp .=
" WHERE fk_product = ".((int) $obj->rowid);
1868 $sqlp .=
" ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC";
1869 $resultp = $db->query($sqlp);
1871 $nump = $db->num_rows($resultp);
1873 while ($j < $nump) {
1874 $objp = $db->fetch_object($resultp);
1876 if (empty($productpricescache[$obj->rowid][$objp->price_level])) {
1877 $productpricescache[$obj->rowid][$objp->price_level][
'price'] = $objp->price;
1878 $productpricescache[$obj->rowid][$objp->price_level][
'price_ttc'] = $objp->price_ttc;
1879 $productpricescache[$obj->rowid][$objp->price_level][
'price_base_type'] = $objp->price_base_type;
1885 $db->free($resultp);
1891 foreach ($arraypricelevel as $key => $value) {
1892 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1893 print
'<td class="right nowraponall">';
1894 if (!empty($productpricescache[$obj->rowid])) {
1895 if ($productpricescache[$obj->rowid][$key][
'price_base_type'] ==
'TTC') {
1896 print
'<span class="amount">'.price($productpricescache[$obj->rowid][$key][
'price_ttc']).
' '.$langs->trans(
"TTC").
'</span>';
1898 print
'<span class="amount">'.price($productpricescache[$obj->rowid][$key][
'price']).
' '.$langs->trans(
"HT").
'</span>';
1903 $totalarray[
'nbfield']++;
1910 if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
1911 print
'<td class="right nowraponall">';
1912 if ($product_static->status_buy && $obj->bestpurchaseprice !=
'' && $usercancreadprice) {
1913 if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) {
1914 if ($product_fourn->product_fourn_price_id > 0) {
1915 if ((
isModEnabled(
"fournisseur") && !empty($user->rights->fournisseur->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (
isModEnabled(
"supplier_order") && !empty($user->rights->supplier_order->lire)) || (
isModEnabled(
"supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) {
1916 $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
1917 print
'<span class="amount">'.$form->textwithpicto(
price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent / 100) - $product_fourn->fourn_remise).
' '.$langs->trans(
"HT"), $htmltext).
'</span>';
1919 print
'<span class="amount">'.price($product_fourn->fourn_unitprice).
' '.$langs->trans(
"HT").
'</span>';
1926 $totalarray[
'nbfield']++;
1931 if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
1932 print
'<td class="right">';
1933 if ($product_static->status_buy && $usercancreadprice) {
1934 if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) {
1935 $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList);
1936 print
$form->textwithpicto(count($productFournList), $htmltext);
1943 if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
1944 print
'<td class="right">';
1945 print
vatrate($obj->tva_tx,
true);
1948 $totalarray[
'nbfield']++;
1953 if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
1954 print
'<td class="nowrap right">';
1955 if ($usercancreadprice) {
1956 print
'<span class="amount">'.price($product_static->pmp, 1, $langs).
"</span>";
1961 if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
1962 print
'<td class="nowrap right">';
1964 if ($usercancreadprice) {
1965 print
'<span class="amount">'.price($obj->cost_price).
' '.$langs->trans(
"HT").
'</span>';
1971 if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
1972 print
'<td class="right">';
1973 if ($product_static->type != 1) {
1974 print $obj->seuil_stock_alerte;
1978 $totalarray[
'nbfield']++;
1982 if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
1983 print
'<td class="right">';
1984 if ($product_static->type != 1) {
1985 print $obj->desiredstock;
1989 $totalarray[
'nbfield']++;
1993 if (!empty($arrayfields[
'p.stock'][
'checked'])) {
1994 print
'<td class="right">';
1995 if ($product_static->type != 1) {
1996 if ($obj->seuil_stock_alerte !=
'' && $product_static->stock_reel < (
float) $obj->seuil_stock_alerte) {
1997 print
img_warning($langs->trans(
"StockLowerThanLimit", $obj->seuil_stock_alerte)).
' ';
1999 if ($usercancreadprice) {
2000 if ($product_static->stock_reel < 0) { print
'<span class="warning">'; }
2001 print
price(
price2num($product_static->stock_reel,
'MS'), 0, $langs, 1, 0);
2002 if ($product_static->stock_reel < 0) { print
'</span>'; }
2007 $totalarray[
'nbfield']++;
2011 if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
2012 print
'<td class="right">';
2013 if ($product_static->type != 1) {
2014 if ($obj->seuil_stock_alerte !=
'' && $product_static->stock_theorique < (
float) $obj->seuil_stock_alerte) {
2015 print
img_warning($langs->trans(
"StockLowerThanLimit", $obj->seuil_stock_alerte)).
' ';
2017 if ($usercancreadprice) {
2018 if ($product_static->stock_theorique < 0) { print
'<span class="warning">'; }
2019 print
price(
price2num($product_static->stock_theorique,
'MS'), 0, $langs, 1, 0);
2020 if ($product_static->stock_theorique < 0) { print
'</span>'; }
2025 $totalarray[
'nbfield']++;
2029 if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
2030 print
'<td class="center">';
2031 print $product_static->getLibStatut(1, 2);
2034 $totalarray[
'nbfield']++;
2038 if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
2039 print
'<td>'.getCountry($obj->fk_country, 0, $db).
'</td>';
2041 $totalarray[
'nbfield']++;
2045 if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
2047 if (!empty($obj->fk_state)) {
2048 print
getState($obj->fk_state, 0, $db);
2052 $totalarray[
'nbfield']++;
2056 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
2057 print
'<td>'.length_accountg($product_static->accountancy_code_sell).
'</td>';
2059 $totalarray[
'nbfield']++;
2062 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
2063 print
'<td>'.length_accountg($product_static->accountancy_code_sell_intra).
'</td>';
2065 $totalarray[
'nbfield']++;
2068 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
2069 print
'<td>'.length_accountg($product_static->accountancy_code_sell_export).
'</td>';
2071 $totalarray[
'nbfield']++;
2075 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
2076 print
'<td>'.length_accountg($product_static->accountancy_code_buy).
'</td>';
2078 $totalarray[
'nbfield']++;
2081 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
2082 print
'<td>'.length_accountg($product_static->accountancy_code_buy_intra).
'</td>';
2084 $totalarray[
'nbfield']++;
2087 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
2088 print
'<td>'.length_accountg($product_static->accountancy_code_buy_export).
'</td>';
2090 $totalarray[
'nbfield']++;
2094 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2096 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2097 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2098 print $hookmanager->resPrint;
2100 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2101 print
'<td class="center nowraponall">';
2102 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2105 $totalarray[
'nbfield']++;
2109 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2110 print
'<td class="center nowraponall">';
2111 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2114 $totalarray[
'nbfield']++;
2119 if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
2120 print
'<td class="center nowrap">';
2121 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
"produit",
"creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
2122 print
ajax_object_onoff($product_static,
'status',
'tosell',
'ProductStatusOnSell',
'ProductStatusNotOnSell');
2124 print $product_static->LibStatut($product_static->status, 5, 0);
2128 $totalarray[
'nbfield']++;
2132 if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
2133 print
'<td class="center nowrap">';
2134 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
"produit",
"creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
2135 print
ajax_object_onoff($product_static,
'status_buy',
'tobuy',
'ProductStatusOnBuy',
'ProductStatusNotOnBuy');
2137 print $product_static->LibStatut($product_static->status_buy, 5, 1);
2141 $totalarray[
'nbfield']++;
2147 print
'<td class="nowrap center">';
2148 if ($massactionbutton || $massaction) {
2150 if (in_array($object->id, $arrayofselected)) {
2153 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2157 $totalarray[
'nbfield']++;
2170 foreach ($arrayfields as $key => $val) {
2171 if (!empty($val[
'checked'])) {
2175 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2180 print
'</table>'.
"\n";
2181 print
'</div>'.
"\n";
2183 print
'</form>'.
"\n";
clean_account($account)
Return accounting account without zero on the right.
ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=array(), $morecss='', $htmlname='', $forcenojs=0)
On/off button to change a property status of an object This uses the ajax service objectonoff....
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage categories.
Class to manage predefined suppliers products.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
getState($id, $withcode='', $dbtouse=0, $withregion=0, $outputlangs='', $entconv=1)
Return state translated from an id.
isInEEC($object)
Return if a country of an object is inside the EEC (European Economic Community)
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
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...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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).
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.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
measuringUnitString($unit, $measuring_style='', $scale='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
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.