40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
50if (isModEnabled(
'workstation')) {
51 require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
53if (isModEnabled(
'categorie')) {
54 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
59$langs->loadLangs(array(
'products',
'stocks',
'suppliers',
'companies',
'margins'));
60if (isModEnabled(
'productbatch')) {
61 $langs->load(
"productbatch");
66$action =
GETPOST(
'action',
'aZ09');
67$massaction =
GETPOST(
'massaction',
'alpha');
68$show_files =
GETPOST(
'show_files',
'int');
69$confirm =
GETPOST(
'confirm',
'alpha');
70$toselect =
GETPOST(
'toselect',
'array');
73$sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
74$search_id =
GETPOST(
"search_id",
'alpha');
75$search_ref =
GETPOST(
"search_ref",
'alpha');
76$search_ref_supplier =
GETPOST(
"search_ref_supplier",
'alpha');
77$search_barcode =
GETPOST(
"search_barcode",
'alpha');
78$search_label =
GETPOST(
"search_label",
'alpha');
79$search_default_workstation =
GETPOST(
"search_default_workstation",
'alpha');
80$search_type =
GETPOST(
"search_type",
'int');
81$search_vatrate =
GETPOST(
"search_vatrate",
'alpha');
82$searchCategoryProductOperator = 0;
83if (GETPOSTISSET(
'formfilteraction')) {
84 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
86 $searchCategoryProductOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
88$searchCategoryProductList =
GETPOST(
'search_category_product_list',
'array');
89$catid =
GETPOST(
'catid',
'int');
90if (!empty($catid) && empty($searchCategoryProductList)) {
91 $searchCategoryProductList = array($catid);
93$search_tosell =
GETPOST(
"search_tosell",
'int');
94$search_tobuy =
GETPOST(
"search_tobuy",
'int');
95$search_country =
GETPOST(
"search_country",
'int');
96$search_state =
GETPOST(
"state_id",
'int');
97$fourn_id =
GETPOST(
"fourn_id",
'int');
98$search_tobatch =
GETPOST(
"search_tobatch",
'int');
99$search_accountancy_code_sell =
GETPOST(
"search_accountancy_code_sell",
'alpha');
100$search_accountancy_code_sell_intra =
GETPOST(
"search_accountancy_code_sell_intra",
'alpha');
101$search_accountancy_code_sell_export =
GETPOST(
"search_accountancy_code_sell_export",
'alpha');
102$search_accountancy_code_buy =
GETPOST(
"search_accountancy_code_buy",
'alpha');
103$search_accountancy_code_buy_intra =
GETPOST(
"search_accountancy_code_buy_intra",
'alpha');
104$search_accountancy_code_buy_export =
GETPOST(
"search_accountancy_code_buy_export",
'alpha');
105$search_finished =
GETPOST(
"search_finished",
'int');
106$search_units =
GETPOST(
'search_units',
'int');
107$optioncss =
GETPOST(
'optioncss',
'alpha');
109$mode =
GETPOST(
'mode',
'alpha');
112$show_childproducts = 0;
113if (isModEnabled(
'variants')) {
114 $show_childproducts =
GETPOST(
'search_show_childproducts');
117$diroutputmassaction = $conf->product->dir_output.
'/temp/massgeneration/'.$user->id;
120$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
121$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
122$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
123$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
124if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
128$offset = $limit * $page;
129$pageprev = $page - 1;
130$pagenext = $page + 1;
132 $sortfield =
"p.ref";
139$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'productservicelist';
140if ((
string) $type ==
'1') {
141 $contextpage =
'servicelist';
142 if ($search_type ==
'') {
146if ((
string) $type ==
'0') {
147 $contextpage =
'productlist';
148 if ($search_type ==
'') {
155$hookmanager->initHooks(array(
'productservicelist'));
157$form =
new Form($db);
162$extrafields->fetch_name_optionals_label($object->table_element);
163$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
172if (!empty($canvas)) {
173 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
174 $objcanvas =
new Canvas($db, $action);
175 $objcanvas->getCanvas(
'product',
'list', $canvas);
179$virtualdiffersfromphysical = 0;
185 || isModEnabled(
'mrp')) {
186 $virtualdiffersfromphysical = 1;
190$fieldstosearchall = array(
192 'p.label'=>
"ProductLabel",
193 'p.description'=>
"Description",
195 'pfp.ref_fourn'=>
'RefSupplier'
199 $fieldstosearchall[
'pl.label'] =
'ProductLabelTranslated';
200 $fieldstosearchall[
'pl.description'] =
'ProductDescriptionTranslated';
201 $fieldstosearchall[
'pl.note'] =
'ProductNoteTranslated';
203if (isModEnabled(
'barcode')) {
204 $fieldstosearchall[
'p.barcode'] =
'Gencod';
205 $fieldstosearchall[
'pfp.barcode'] =
'GencodBuyPrice';
213 $titlesellprice = $langs->trans(
"SellingPrice");
215 $titlesellprice = $form->textwithpicto($langs->trans(
"SellingPrice"), $langs->trans(
"DefaultPriceRealPriceMayDependOnCustomer"));
221$alias_product_perentity = !
getDolGlobalString(
'MAIN_PRODUCT_PERENTITY_SHARED') ?
"p" :
"ppe";
225 'p.rowid'=>array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>1,
'visible'=>-2,
'noteditable'=>1,
'notnull'=> 1,
'index'=>1,
'position'=>1,
'comment'=>
'Id',
'css'=>
'left'),
226 'p.ref'=>array(
'label'=>
'ProductRef',
'checked'=>1,
'position'=>10),
228 'thumbnail'=>array(
'label'=>
'Photo',
'checked'=>0,
'position'=>10),
229 'p.description'=>array(
'label'=>
'Description',
'checked'=>0,
'position'=>10),
230 'p.label'=>array(
'label'=>
"Label",
'checked'=>1,
'position'=>10),
231 'p.fk_product_type'=>array(
'label'=>
"Type",
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && isModEnabled(
"service")),
'position'=>11),
232 'p.barcode'=>array(
'label'=>
"Gencod",
'checked'=>1,
'enabled'=>(isModEnabled(
'barcode')),
'position'=>12),
233 'p.duration'=>array(
'label'=>
"Duration",
'checked'=>($contextpage !=
'productlist'),
'enabled'=>(isModEnabled(
"service") && (
string) $type ==
'1'),
'position'=>13),
234 'pac.fk_product_parent' => array(
'label'=>
"ParentProductOfVariant",
'checked'=>-1,
'enabled'=>(isModEnabled(
'variants')),
'position'=>14),
235 'p.finished'=>array(
'label'=>
"Nature",
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && $type !=
'1'),
'position'=>19),
236 'p.weight'=>array(
'label'=>
'Weight',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && $type !=
'1'),
'position'=>20),
237 'p.weight_units'=>array(
'label'=>
'WeightUnits',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && $type !=
'1'),
'position'=>21),
238 'p.length'=>array(
'label'=>
'Length',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position'=>22),
239 'p.length_units'=>array(
'label'=>
'LengthUnits',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position'=>23),
240 'p.width'=>array(
'label'=>
'Width',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position'=>24),
241 'p.width_units'=>array(
'label'=>
'WidthUnits',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position'=>25),
242 'p.height'=>array(
'label'=>
'Height',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position'=>26),
243 'p.height_units'=>array(
'label'=>
'HeightUnits',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position'=>27),
244 'p.surface'=>array(
'label'=>
'Surface',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SURFACE') && $type !=
'1'),
'position'=>28),
245 'p.surface_units'=>array(
'label'=>
'SurfaceUnits',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SURFACE') && $type !=
'1'),
'position'=>29),
246 'p.volume'=>array(
'label'=>
'Volume',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_VOLUME') && $type !=
'1'),
'position'=>30),
247 'p.volume_units'=>array(
'label'=>
'VolumeUnits',
'checked'=>0,
'enabled'=>(isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_VOLUME') && $type !=
'1'),
'position'=>31),
248 'cu.label'=>array(
'label'=>
"DefaultUnitToShow",
'checked'=>0,
'enabled'=>(isModEnabled(
"product") &&
getDolGlobalString(
'PRODUCT_USE_UNITS')),
'position'=>32),
249 'p.fk_default_workstation'=>array(
'label'=>
'DefaultWorkstation',
'checked'=>0,
'enabled'=>isModEnabled(
'workstation') && $type == 1,
'position'=>33),
250 'p.sellprice'=>array(
'label'=>
"SellingPrice",
'checked'=>1,
'enabled'=>!
getDolGlobalString(
'PRODUIT_MULTIPRICES'),
'position'=>40),
251 'p.tva_tx'=>array(
'label'=>
"VATRate",
'checked'=>0,
'enabled'=>!
getDolGlobalString(
'PRODUIT_MULTIPRICES'),
'position'=>41),
252 'p.minbuyprice'=>array(
'label'=>
"BuyingPriceMinShort",
'checked'=>1,
'enabled'=>(!empty($user->rights->fournisseur->lire)),
'position'=>42),
253 'p.numbuyprice'=>array(
'label'=>
"BuyingPriceNumShort",
'checked'=>0,
'enabled'=>(!empty($user->rights->fournisseur->lire)),
'position'=>43),
254 'p.pmp'=>array(
'label'=>
"PMPValueShort",
'checked'=>0,
'enabled'=>(!empty($user->rights->fournisseur->lire)),
'position'=>44),
255 'p.cost_price'=>array(
'label'=>
"CostPrice",
'checked'=>0,
'enabled'=>(!empty($user->rights->fournisseur->lire)),
'position'=>45),
256 'p.seuil_stock_alerte'=>array(
'label'=>
"StockLimit",
'checked'=>0,
'enabled'=>(isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' ||
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES'))),
'position'=>50),
257 'p.desiredstock'=>array(
'label'=>
"DesiredStock",
'checked'=>1,
'enabled'=>(isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' ||
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES'))),
'position'=>51),
258 'p.stock'=>array(
'label'=>
"PhysicalStock",
'checked'=>1,
'enabled'=>(isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' ||
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES'))),
'position'=>52),
259 'stock_virtual'=>array(
'label'=>
"VirtualStock",
'checked'=>1,
'enabled'=>(isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' ||
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES')) && $virtualdiffersfromphysical),
'position'=>53),
260 'p.tobatch'=>array(
'label'=>
"ManageLotSerial",
'checked'=>0,
'enabled'=>(isModEnabled(
'productbatch')),
'position'=>60),
261 'p.fk_country'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>100),
262 'p.fk_state'=>array(
'label'=>
"State",
'checked'=>0,
'position'=>101),
263 $alias_product_perentity .
'.accountancy_code_sell'=>array(
'label'=>
"ProductAccountancySellCode",
'checked'=>0,
'enabled'=>!
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position'=>400),
264 $alias_product_perentity .
'.accountancy_code_sell_intra'=>array(
'label'=>
"ProductAccountancySellIntraCode",
'checked'=>0,
'enabled'=>$isInEEC && !
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position'=>401),
265 $alias_product_perentity .
'.accountancy_code_sell_export'=>array(
'label'=>
"ProductAccountancySellExportCode",
'checked'=>0,
'enabled'=>!
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position'=>402),
266 $alias_product_perentity .
'.accountancy_code_buy'=>array(
'label'=>
"ProductAccountancyBuyCode",
'checked'=>0,
'enabled'=>!
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position'=>403),
267 $alias_product_perentity .
'.accountancy_code_buy_intra'=>array(
'label'=>
"ProductAccountancyBuyIntraCode",
'checked'=>0,
'enabled'=>$isInEEC && !
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position'=>404),
268 $alias_product_perentity .
'.accountancy_code_buy_export'=>array(
'label'=>
"ProductAccountancyBuyExportCode",
'checked'=>0,
'enabled'=>!
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position'=>405),
269 'p.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
270 'p.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
271 'p.tosell'=>array(
'label'=>$langs->transnoentitiesnoconv(
"Status").
' ('.$langs->transnoentitiesnoconv(
"Sell").
')',
'checked'=>1,
'position'=>1000),
272 'p.tobuy'=>array(
'label'=>$langs->transnoentitiesnoconv(
"Status").
' ('.$langs->transnoentitiesnoconv(
"Buy").
')',
'checked'=>1,
'position'=>1000)
290 for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
291 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$i;
292 if (!empty($conf->global->$keyforlabel)) {
293 $labelp = $i.
' - '.$langs->transnoentitiesnoconv($conf->global->$keyforlabel);
295 $labelp = $langs->transnoentitiesnoconv(
"SellingPrice").
" ".$i;
297 $arrayfields[
'p.sellprice'.$i] = array(
'label'=>$labelp,
'checked'=>($i == 1 ? 1 : 0),
'enabled'=>$conf->global->PRODUIT_MULTIPRICES,
'position'=>(float) (
'40.'.sprintf(
'%03s', $i)));
298 $arraypricelevel[$i] = array($i);
304include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
310if ($search_type ==
'0') {
311 $result =
restrictedArea($user,
'produit',
'',
'',
'',
'',
'', 0);
312} elseif ($search_type ==
'1') {
313 $result =
restrictedArea($user,
'service',
'',
'',
'',
'',
'', 0);
315 $result =
restrictedArea($user,
'produit|service',
'',
'',
'',
'',
'', 0);
323if (
GETPOST(
'cancel',
'alpha')) {
327if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
330$parameters = array();
331$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
336$rightskey =
'produit';
338 $rightskey =
'service';
341if (empty($reshook)) {
343 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
346 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
350 $search_ref_supplier =
"";
352 $search_default_workstation =
"";
353 $search_barcode =
"";
354 $searchCategoryProductOperator = 0;
355 $searchCategoryProductList = array();
358 $search_tobatch =
'';
359 $search_country =
"";
361 $search_vatrate =
"";
362 $search_finished =
'';
365 $show_childproducts =
'';
366 $search_accountancy_code_sell =
'';
367 $search_accountancy_code_sell_intra =
'';
368 $search_accountancy_code_sell_export =
'';
369 $search_accountancy_code_buy =
'';
370 $search_accountancy_code_buy_intra =
'';
371 $search_accountancy_code_buy_export =
'';
372 $search_array_options = array();
377 $objectclass =
'Product';
378 if ((
string) $search_type ==
'1') {
379 $objectlabel =
'Services';
381 if ((
string) $search_type ==
'0') {
382 $objectlabel =
'Products';
385 $permissiontoread = $user->hasRight($rightskey,
'lire');
386 $permissiontodelete = $user->hasRight($rightskey,
'supprimer');
387 $permissiontoadd = $user->hasRight($rightskey,
'creer');
388 $uploaddir = $conf->product->dir_output;
389 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
391 if (!$error && $massaction ==
'switchonsalestatus' && $permissiontoadd) {
393 foreach ($toselect as $toselectid) {
394 $result = $product->fetch($toselectid);
395 if ($result > 0 && $product->id > 0) {
396 if ($product->setStatut($product->status ? 0 : 1, null,
'product',
'PRODUCT_MODIFY',
'tosell') < 0) {
402 if (!$error && $massaction ==
'switchonpurchasestatus' && $permissiontoadd) {
404 foreach ($toselect as $toselectid) {
405 $result = $product->fetch($toselectid);
406 if ($result > 0 && $product->id > 0) {
407 if ($product->setStatut($product->status_buy ? 0 : 1, null,
'product',
'PRODUCT_MODIFY',
'tobuy') < 0) {
420$product_static =
new Product($db);
421if (isModEnabled(
'workstation')) {
426$title = $langs->trans(
"ProductsAndServices");
428if ($search_type !=
'' && $search_type !=
'-1') {
429 if ($search_type == 1) {
430 $title = $langs->trans(
"Services");
432 $title = $langs->trans(
"Products");
438$sql =
'SELECT p.rowid, p.ref, p.description, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,';
439$sql .=
' p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
440$sql .=
' p.tobatch, ';
441if (isModEnabled(
'workstation')) {
442 $sql .=
' p.fk_default_workstation, ws.status as status_workstation, ws.ref as ref_workstation, ';
445 $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,";
447 $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,";
449$sql .=
' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock, p.cost_price,';
450$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,';
452 $sql .=
' p.fk_unit, cu.label as cu_label,';
454$sql .=
' MIN(pfp.unitprice) as bestpurchaseprice';
455if (isModEnabled(
'variants')) {
456 $sql .=
', pac.rowid as prod_comb_id';
457 $sql .=
', pac.fk_product_parent';
460if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
461 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
462 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
466$parameters = array();
467$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
468$sql .= $hookmanager->resPrint;
469$sql = preg_replace(
'/,\s*$/',
'', $sql);
473$sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
474if (isModEnabled(
'workstation')) {
475 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"workstation_workstation as ws ON (p.fk_default_workstation = ws.rowid)";
478 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
480if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
481 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_extrafields as ef on (p.rowid = ef.fk_object)";
483$linktopfp =
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
487 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$db->escape($langs->getDefaultLang()).
"'";
489if (isModEnabled(
'variants')) {
490 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_attribute_combination pac ON pac.fk_product_child = p.rowid";
493 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_units cu ON cu.rowid = p.fk_unit";
497$parameters = array();
498$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
499$sql .= $hookmanager->resPrint;
501$sql .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
504 $newfieldstosearchall = $fieldstosearchall;
505 unset($newfieldstosearchall[
'pfp.ref_fourn']);
506 unset($newfieldstosearchall[
'pfp.barcode']);
509 $sql .=
natural_search(array_keys($newfieldstosearchall), $sall, 0, 1);
511 $sql .=
' OR EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.
'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid';
512 $sql .=
' AND ('.natural_search(
'pfp.ref_fourn', $sall, 0, 1);
513 if (isModEnabled(
'barcode')) {
515 $sql .=
' OR '.natural_search(
'pfp.barcode', $sall, 0, 1);
520if (
dol_strlen($search_type) && $search_type !=
'-1') {
521 if ($search_type == 1) {
522 $sql .=
" AND p.fk_product_type = 1";
524 $sql .=
" AND p.fk_product_type <> 1";
528if (isModEnabled(
'variants') && !$show_childproducts) {
529 $sql .=
" AND pac.rowid IS NULL";
541if ($search_default_workstation) {
544if ($search_barcode) {
547if (isset($search_tosell) &&
dol_strlen($search_tosell) > 0 && $search_tosell != -1) {
548 $sql .=
" AND p.tosell = ".((int) $search_tosell);
550if (isset($search_tobuy) &&
dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) {
551 $sql .=
" AND p.tobuy = ".((int) $search_tobuy);
553if (isset($search_tobatch) &&
dol_strlen($search_tobatch) > 0 && $search_tobatch != -1) {
554 $sql .=
" AND p.tobatch = ".((int) $search_tobatch);
556if ($search_vatrate) {
560 $sql .=
" AND p.canvas = '".$db->escape($canvas).
"'";
563if (!empty($searchCategoryProductList)) {
564 $searchCategoryProductSqlList = array();
565 $listofcategoryid =
'';
566 foreach ($searchCategoryProductList as $searchCategoryProduct) {
567 if (intval($searchCategoryProduct) == -2) {
568 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product)";
569 } elseif (intval($searchCategoryProduct) > 0) {
570 if ($searchCategoryProductOperator == 0) {
571 $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).
")";
573 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
577 if ($listofcategoryid) {
578 $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).
"))";
580 if ($searchCategoryProductOperator == 1) {
581 if (!empty($searchCategoryProductSqlList)) {
582 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
585 if (!empty($searchCategoryProductSqlList)) {
586 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
591 $sql .=
" AND pfp.fk_soc = ".((int) $fourn_id);
593if ($search_country) {
594 $sql .=
" AND p.fk_country = ".((int) $search_country);
597 $sql .=
" AND p.fk_state = ".((int) $search_state);
599if ($search_finished >= 0 && $search_finished !==
'') {
600 $sql .=
" AND p.finished = ".((int) $search_finished);
602if ($search_accountancy_code_sell) {
605if ($search_accountancy_code_sell_intra) {
606 $sql .=
natural_search($alias_product_perentity .
'.accountancy_code_sell_intra',
clean_account($search_accountancy_code_sell_intra));
608if ($search_accountancy_code_sell_export) {
609 $sql .=
natural_search($alias_product_perentity .
'.accountancy_code_sell_export',
clean_account($search_accountancy_code_sell_export));
611if ($search_accountancy_code_buy) {
614if ($search_accountancy_code_buy_intra) {
615 $sql .=
natural_search($alias_product_perentity .
'.accountancy_code_buy_intra',
clean_account($search_accountancy_code_buy_intra));
617if ($search_accountancy_code_buy_export) {
618 $sql .=
natural_search($alias_product_perentity .
'.accountancy_code_buy_export',
clean_account($search_accountancy_code_buy_export));
624include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
626$parameters = array();
627$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
628$sql .= $hookmanager->resPrint;
629$sql .=
" GROUP BY p.rowid, p.ref, p.description, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,";
630$sql .=
" p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
631$sql .=
' p.datec, p.tms, p.entity, p.tobatch, p.pmp, p.cost_price, p.stock,';
633 $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,";
635 $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,";
637$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';
639 $sql .=
', p.fk_unit, cu.label';
641if (isModEnabled(
'workstation')) {
642 $sql .=
', p.fk_default_workstation, ws.status, ws.ref';
644if (isModEnabled(
'variants')) {
645 $sql .=
', pac.rowid';
646 $sql .=
', pac.fk_product_parent';
649if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
650 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
651 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
655$parameters = array();
656$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
657$sql .= $hookmanager->resPrint;
660$nbtotalofrecords =
'';
663 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
664 $sqlforcount = preg_replace(
'/'.preg_quote($linktopfp,
'/').
'/',
'', $sqlforcount);
665 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
667 $resql = $db->query($sqlforcount);
669 $objforcount = $db->fetch_object($resql);
670 $nbtotalofrecords = $objforcount->nbtotalofrecords;
675 if (($page * $limit) > $nbtotalofrecords) {
683$sql .= $db->order($sortfield, $sortorder);
685 $sql .= $db->plimit($limit + 1, $offset);
688$resql = $db->query($sql);
694$num = $db->num_rows($resql);
699 $obj = $db->fetch_object($resql);
701 header(
"Location: ".DOL_URL_ROOT.
'/product/card.php?id='.$id);
710if ($search_type !=
'') {
711 if ($search_type == 0) {
712 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
713 } elseif ($search_type == 1) {
714 $helpurl =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
719foreach ($searchCategoryProductList as $searchCategoryProduct) {
720 $paramsCat .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
724llxHeader(
'', $title, $helpurl,
'', 0, 0, array(), array(), $paramsCat,
'');
726$arrayofselected = is_array($toselect) ? $toselect : array();
735 $param .=
'&mode='.urlencode($mode);
737if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
738 $param .=
'&contextpage='.urlencode($contextpage);
740if ($limit > 0 && $limit != $conf->liste_limit) {
741 $param .=
'&limit='.((int) $limit);
743if ($optioncss !=
'') {
744 $param .=
'&optioncss='.urlencode($optioncss);
747 $param .=
"&sall=".urlencode($sall);
749if ($searchCategoryProductOperator == 1) {
750 $param .=
"&search_category_product_operator=".urlencode($searchCategoryProductOperator);
752foreach ($searchCategoryProductList as $searchCategoryProduct) {
753 $param .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
756 $param .=
"&search_ref=".urlencode($search_ref);
758if ($search_ref_supplier) {
759 $param .=
"&search_ref_supplier=".urlencode($search_ref_supplier);
761if ($search_barcode) {
762 $param .= ($search_barcode ?
"&search_barcode=".urlencode($search_barcode) :
"");
765 $param .=
"&search_label=".urlencode($search_label);
767if ($search_default_workstation) {
768 $param .=
"&search_default_workstation=".urlencode($search_default_workstation);
770if ($search_tosell !=
'') {
771 $param .=
"&search_tosell=".urlencode($search_tosell);
773if ($search_tobuy !=
'') {
774 $param .=
"&search_tobuy=".urlencode($search_tobuy);
776if ($search_tobatch) {
777 $param .=
"&search_tobatch=".urlencode($search_tobatch);
779if ($search_country !=
'') {
780 $param .=
"&search_country=".urlencode($search_country);
782if ($search_state !=
'') {
783 $param .=
"&search_state=".urlencode($search_state);
785if ($search_vatrate) {
786 $param .=
"&search_vatrate=".urlencode($search_vatrate);
789 $param .=
"&fourn_id=".urlencode($fourn_id);
791if ($show_childproducts) {
792 $param .= ($show_childproducts ?
"&search_show_childproducts=".urlencode($show_childproducts) :
"");
795 $param .=
'&type='.urlencode($type);
797if ($search_type !=
'') {
798 $param .=
'&search_type='.urlencode($search_type);
800if ($search_accountancy_code_sell) {
801 $param .=
"&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
803if ($search_accountancy_code_sell_intra) {
804 $param .=
"&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra);
806if ($search_accountancy_code_sell_export) {
807 $param .=
"&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export);
809if ($search_accountancy_code_buy) {
810 $param .=
"&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
812if ($search_accountancy_code_buy_intra) {
813 $param .=
"&search_accountancy_code_buy_intra=".urlencode($search_accountancy_code_buy_intra);
815if ($search_accountancy_code_buy_export) {
816 $param .=
"&search_accountancy_code_buy_export=".urlencode($search_accountancy_code_buy_export);
818if ($search_finished) {
819 $param .=
"&search_finished=".urlencode($search_finished);
822include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
825$parameters = array(
'param' => &$param);
826$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
827$param .= $hookmanager->resPrint;
830$arrayofmassactions = array(
831 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
832 'edit_extrafields'=>
img_picto(
'',
'edit',
'class="pictofixedwidth"').$langs->trans(
"ModifyValueExtrafields"),
836if ($user->hasRight($rightskey,
'creer')) {
840 $arrayofmassactions[
'preupdateprice'] =
img_picto(
'',
'edit',
'class="pictofixedwidth"').$langs->trans(
"UpdatePrice");
843 $arrayofmassactions[
'switchonsalestatus'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SwitchOnSaleStatus");
844 $arrayofmassactions[
'switchonpurchasestatus'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SwitchOnPurchaseStatus");
846if (isModEnabled(
'category') && $user->hasRight($rightskey,
'creer')) {
847 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
849if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'edit_extrafields',
'preupdateprice'))) {
850 $arrayofmassactions = array();
852if ($user->hasRight($rightskey,
'supprimer')) {
853 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
855$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
858$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'));
859$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'));
862 $perm = ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'));
864 $perm = $user->hasRight(
'service',
'creer');
866 $perm = $user->hasRight(
'produit',
'creer');
871 $params[
'forcenohideoftext'] = 1;
875 $label =
'NewProduct';
876 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/card.php?action=create&type=0',
'', $perm, $params);
879 $label =
'NewService';
880 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/card.php?action=create&type=1',
'', $perm, $params);
883print
'<form id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire">';
884if ($optioncss !=
'') {
885 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
887print
'<input type="hidden" name="token" value="'.newToken().
'">';
888print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
889print
'<input type="hidden" name="action" value="list">';
890print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
891print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
893print
'<input type="hidden" name="type" value="'.$type.
'">';
894print
'<input type="hidden" name="page_y" value="">';
895print
'<input type="hidden" name="mode" value="'.$mode.
'">';
897if (empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
898 print
'<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).
'">';
906print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
908$topicmail =
"Information";
909$modelmail =
"product";
911$trackid =
'prod'.$object->id;
912include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
915 print
"<div id='ways'>";
917 $ways = $c->print_all_ways(
' > ',
'product/list.php');
918 print
" > ".$ways[0].
"<br>\n";
924 foreach ($fieldstosearchall as $key => $val) {
925 $fieldstosearchall[$key] = $langs->trans($val);
926 $setupstring .= $key.
"=".$val.
";";
928 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
929 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
934if (isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'read')) {
936 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList,
'minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0);
940if (isModEnabled(
'variants')) {
941 $moreforfilter .=
'<div class="divsearchfield">';
942 $moreforfilter .=
'<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ?
'checked="checked"' :
'').
'>';
943 $moreforfilter .=
' <label for="search_show_childproducts">'.$langs->trans(
'ShowChildProducts').
'</label>';
944 $moreforfilter .=
'</div>';
947$parameters = array();
948$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
949if (empty($reshook)) {
950 $moreforfilter .= $hookmanager->resPrint;
952 $moreforfilter = $hookmanager->resPrint;
955if (!empty($moreforfilter)) {
956 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
957 print $moreforfilter;
961$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
962$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
963$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
965print
'<div class="div-table-responsive">';
966print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
970print
'<tr class="liste_titre_filter">';
973 print
'<td class="liste_titre center maxwidthsearch">';
974 $searchpicto = $form->showFilterButtons(
'left');
978if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
979 print
'<td class="liste_titre left">';
980 print
'<input class="flat" type="text" name="search_id" size="4" value="'.dol_escape_htmltag($search_id).
'">';
983if (!empty($arrayfields[
'p.ref'][
'checked'])) {
984 print
'<td class="liste_titre left">';
985 print
'<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).
'">';
988if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
989 print
'<td class="liste_titre left">';
990 print
'<input class="flat" type="text" name="search_ref_supplier" size="8" value="'.dol_escape_htmltag($search_ref_supplier).
'">';
994if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
995 print
'<td class="liste_titre center">';
998if (!empty($arrayfields[
'p.label'][
'checked'])) {
999 print
'<td class="liste_titre left">';
1000 print
'<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).
'">';
1004if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
1005 print
'<td class="liste_titre center">';
1006 $array = array(
'-1'=>
' ',
'0'=>$langs->trans(
'Product'),
'1'=>$langs->trans(
'Service'));
1007 print $form->selectarray(
'search_type', $array, $search_type);
1011if (!empty($arrayfields[
'p.description'][
'checked'])) {
1012 print
'<td class="liste_titre left">';
1016if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
1017 print
'<td class="liste_titre">';
1018 print
'<input class="flat" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).
'">';
1022if (!empty($arrayfields[
'p.duration'][
'checked'])) {
1023 print
'<td class="liste_titre">';
1027if (!empty($arrayfields[
'pac.fk_product_parent'][
'checked'])) {
1028 print
'<td class="liste_titre">';
1032if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1033 print
'<td class="liste_titre">';
1034 print $formproduct->selectProductNature(
'search_finished', $search_finished);
1038if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1039 print
'<td class="liste_titre">';
1043if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1044 print
'<td class="liste_titre">';
1048if (!empty($arrayfields[
'p.length'][
'checked'])) {
1049 print
'<td class="liste_titre">';
1053if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1054 print
'<td class="liste_titre">';
1058if (!empty($arrayfields[
'p.width'][
'checked'])) {
1059 print
'<td class="liste_titre">';
1063if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1064 print
'<td class="liste_titre">';
1068if (!empty($arrayfields[
'p.height'][
'checked'])) {
1069 print
'<td class="liste_titre">';
1073if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1074 print
'<td class="liste_titre">';
1078if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1079 print
'<td class="liste_titre">';
1083if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1084 print
'<td class="liste_titre">';
1088if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1089 print
'<td class="liste_titre">';
1093if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1094 print
'<td class="liste_titre">';
1099if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1100 print
'<td class="liste_titre">';
1101 print $form->selectUnits($search_units,
'search_units', 1);
1106if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1107 print
'<td class="liste_titre">';
1108 print
'<input class="flat width75" type="text" name="search_default_workstation" value="'.dol_escape_htmltag($search_default_workstation).
'">';
1113if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1114 print
'<td class="liste_titre right">';
1120 foreach ($arraypricelevel as $key => $value) {
1121 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1122 print
'<td class="liste_titre right">';
1129if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
1130 print
'<td class="liste_titre">';
1135if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
1136 print
'<td class="liste_titre">';
1141if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
1142 print
'<td class="liste_titre right">';
1143 print
'<input class="right flat maxwidth50" placeholder="%" type="text" name="search_vatrate" size="1" value="'.dol_escape_htmltag($search_vatrate).
'">';
1147if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
1148 print
'<td class="liste_titre">';
1153if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
1154 print
'<td class="liste_titre">';
1159if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
1160 print
'<td class="liste_titre">';
1165if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
1166 print
'<td class="liste_titre">';
1171if (!empty($arrayfields[
'p.stock'][
'checked'])) {
1172 print
'<td class="liste_titre"> </td>';
1175if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
1176 print
'<td class="liste_titre"> </td>';
1179if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
1180 print
'<td class="liste_titre center">';
1181 $statutarray = array(
1183 '0' => $langs->trans(
"ProductStatusNotOnBatchShort"),
1184 '1' => $langs->trans(
"ProductStatusOnBatchShort"),
1185 '2' => $langs->trans(
"ProductStatusOnSerialShort")
1187 print $form->selectarray(
'search_tobatch', $statutarray, $search_tobatch);
1191if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
1192 print
'<td class="liste_titre center">';
1193 print $form->select_country($search_country,
'search_country',
'', 0);
1197if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
1198 print
'<td class="liste_titre center">';
1199 print $formcompany->select_state($search_state, $search_country);
1203if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
1204 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>';
1206if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
1207 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>';
1209if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
1210 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>';
1213if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
1214 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>';
1216if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
1217 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>';
1219if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
1220 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>';
1223include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1225$parameters = array(
'arrayfields'=>$arrayfields);
1226$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1227print $hookmanager->resPrint;
1229if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1230 print
'<td class="liste_titre">';
1234if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1235 print
'<td class="liste_titre">';
1238if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
1239 print
'<td class="liste_titre center parentonrightofpage">';
1240 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');
1243if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
1244 print
'<td class="liste_titre center parentonrightofpage">';
1245 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');
1250 print
'<td class="liste_titre center maxwidthsearch">';
1251 $searchpicto = $form->showFilterButtons();
1257$totalarray = array();
1258$totalarray[
'nbfield'] = 0;
1262print
'<tr class="liste_titre">';
1265 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1266 $totalarray[
'nbfield']++;
1268if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1269 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1270 $totalarray[
'nbfield']++;
1272if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1273 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1274 $totalarray[
'nbfield']++;
1276if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
1277 print_liste_field_titre($arrayfields[
'pfp.ref_fourn'][
'label'], $_SERVER[
"PHP_SELF"],
"pfp.ref_fourn",
"", $param,
"", $sortfield, $sortorder);
1278 $totalarray[
'nbfield']++;
1280if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
1281 print_liste_field_titre($arrayfields[
'thumbnail'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1282 $totalarray[
'nbfield']++;
1284if (!empty($arrayfields[
'p.label'][
'checked'])) {
1285 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
"p.label",
"", $param,
"", $sortfield, $sortorder);
1286 $totalarray[
'nbfield']++;
1288if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
1289 print_liste_field_titre($arrayfields[
'p.fk_product_type'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_product_type",
"", $param,
"", $sortfield, $sortorder,
'center ');
1290 $totalarray[
'nbfield']++;
1292if (!empty($arrayfields[
'p.description'][
'checked'])) {
1293 print_liste_field_titre($arrayfields[
'p.description'][
'label'], $_SERVER[
"PHP_SELF"],
"p.description",
"", $param,
"", $sortfield, $sortorder);
1294 $totalarray[
'nbfield']++;
1296if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
1297 print_liste_field_titre($arrayfields[
'p.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"p.barcode",
"", $param,
"", $sortfield, $sortorder);
1298 $totalarray[
'nbfield']++;
1300if (!empty($arrayfields[
'p.duration'][
'checked'])) {
1301 print_liste_field_titre($arrayfields[
'p.duration'][
'label'], $_SERVER[
"PHP_SELF"],
"p.duration",
"", $param,
'', $sortfield, $sortorder,
'center ');
1302 $totalarray[
'nbfield']++;
1304if (!empty($arrayfields[
'pac.fk_product_parent'][
'checked'])) {
1305 print_liste_field_titre($arrayfields[
'pac.fk_product_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"pac.fk_product_parent",
"", $param,
'', $sortfield, $sortorder,
'', empty($arrayfields[
'pac.fk_product_parent'][
'help']) ?
'' : $arrayfields[
'pac.fk_product_parent'][
'help']);
1307if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1308 print_liste_field_titre($arrayfields[
'p.finished'][
'label'], $_SERVER[
"PHP_SELF"],
"p.finished",
"", $param,
'', $sortfield, $sortorder,
'center ');
1309 $totalarray[
'nbfield']++;
1312if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1313 print_liste_field_titre($arrayfields[
'p.weight'][
'label'], $_SERVER[
'PHP_SELF'],
'p.weight',
'', $param,
'', $sortfield, $sortorder,
'center ');
1314 $totalarray[
'nbfield']++;
1316if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1317 print_liste_field_titre($arrayfields[
'p.weight_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.weight_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1318 $totalarray[
'nbfield']++;
1320if (!empty($arrayfields[
'p.length'][
'checked'])) {
1321 print_liste_field_titre($arrayfields[
'p.length'][
'label'], $_SERVER[
'PHP_SELF'],
'p.length',
'', $param,
'', $sortfield, $sortorder,
'center ');
1322 $totalarray[
'nbfield']++;
1324if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1325 print_liste_field_titre($arrayfields[
'p.length_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.length_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1326 $totalarray[
'nbfield']++;
1328if (!empty($arrayfields[
'p.width'][
'checked'])) {
1329 print_liste_field_titre($arrayfields[
'p.width'][
'label'], $_SERVER[
'PHP_SELF'],
'p.width',
'', $param,
'', $sortfield, $sortorder,
'center ');
1330 $totalarray[
'nbfield']++;
1332if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1333 print_liste_field_titre($arrayfields[
'p.width_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.width_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1334 $totalarray[
'nbfield']++;
1336if (!empty($arrayfields[
'p.height'][
'checked'])) {
1337 print_liste_field_titre($arrayfields[
'p.height'][
'label'], $_SERVER[
'PHP_SELF'],
'p.height',
'', $param,
'', $sortfield, $sortorder,
'center ');
1338 $totalarray[
'nbfield']++;
1340if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1341 print_liste_field_titre($arrayfields[
'p.height_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.height_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1342 $totalarray[
'nbfield']++;
1344if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1345 print_liste_field_titre($arrayfields[
'p.surface'][
'label'], $_SERVER[
'PHP_SELF'],
"p.surface",
'', $param,
'', $sortfield, $sortorder,
'center ');
1346 $totalarray[
'nbfield']++;
1348if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1349 print_liste_field_titre($arrayfields[
'p.surface_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.surface_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1350 $totalarray[
'nbfield']++;
1352if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1353 print_liste_field_titre($arrayfields[
'p.volume'][
'label'], $_SERVER[
'PHP_SELF'],
'p.volume',
'', $param,
'', $sortfield, $sortorder,
'center ');
1354 $totalarray[
'nbfield']++;
1356if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1357 print_liste_field_titre($arrayfields[
'p.volume_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.volume_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1358 $totalarray[
'nbfield']++;
1360if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1361 print_liste_field_titre($arrayfields[
'cu.label'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1362 $totalarray[
'nbfield']++;
1364if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
'p.fk_default_workstation'][
'label'], $_SERVER[
'PHP_SELF'],
'ws.ref',
'', $param,
'', $sortfield, $sortorder);
1366 $totalarray[
'nbfield']++;
1368if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1369 print_liste_field_titre($arrayfields[
'p.sellprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1370 $totalarray[
'nbfield']++;
1375 foreach ($arraypricelevel as $key => $value) {
1376 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
'p.sellprice'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1378 $totalarray[
'nbfield']++;
1383if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'p.minbuyprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1385 $totalarray[
'nbfield']++;
1387if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
1388 print_liste_field_titre($arrayfields[
'p.numbuyprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1389 $totalarray[
'nbfield']++;
1391if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
1392 print_liste_field_titre($arrayfields[
'p.tva_tx'][
'label'], $_SERVER[
"PHP_SELF"],
'p.tva_tx',
"", $param,
'', $sortfield, $sortorder,
'right ');
1393 $totalarray[
'nbfield']++;
1395if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
1396 print_liste_field_titre($arrayfields[
'p.pmp'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1397 $totalarray[
'nbfield']++;
1399if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
1400 print_liste_field_titre($arrayfields[
'p.cost_price'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1401 $totalarray[
'nbfield']++;
1403if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
1404 print_liste_field_titre($arrayfields[
'p.seuil_stock_alerte'][
'label'], $_SERVER[
"PHP_SELF"],
"p.seuil_stock_alerte",
"", $param,
'', $sortfield, $sortorder,
'right ');
1405 $totalarray[
'nbfield']++;
1407if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
1408 print_liste_field_titre($arrayfields[
'p.desiredstock'][
'label'], $_SERVER[
"PHP_SELF"],
"p.desiredstock",
"", $param,
'', $sortfield, $sortorder,
'right ');
1409 $totalarray[
'nbfield']++;
1411if (!empty($arrayfields[
'p.stock'][
'checked'])) {
1412 print_liste_field_titre($arrayfields[
'p.stock'][
'label'], $_SERVER[
"PHP_SELF"],
"p.stock",
"", $param,
'', $sortfield, $sortorder,
'right ');
1413 $totalarray[
'nbfield']++;
1415if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
1416 print_liste_field_titre($arrayfields[
'stock_virtual'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ',
'VirtualStockDesc');
1417 $totalarray[
'nbfield']++;
1419if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
1420 print_liste_field_titre($arrayfields[
'p.tobatch'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tobatch",
"", $param,
'', $sortfield, $sortorder,
'center ');
1421 $totalarray[
'nbfield']++;
1423if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
1424 print_liste_field_titre($arrayfields[
'p.fk_country'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_country",
"", $param,
'', $sortfield, $sortorder);
1425 $totalarray[
'nbfield']++;
1427if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
1428 print_liste_field_titre($arrayfields[
'p.fk_state'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_state",
"", $param,
'', $sortfield, $sortorder);
1429 $totalarray[
'nbfield']++;
1431if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
1432 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_sell",
"", $param,
'', $sortfield, $sortorder);
1433 $totalarray[
'nbfield']++;
1435if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
1436 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);
1437 $totalarray[
'nbfield']++;
1439if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
1440 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);
1441 $totalarray[
'nbfield']++;
1443if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
1444 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_buy",
"", $param,
'', $sortfield, $sortorder);
1445 $totalarray[
'nbfield']++;
1447if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
1448 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);
1449 $totalarray[
'nbfield']++;
1451if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
1452 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);
1453 $totalarray[
'nbfield']++;
1456include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1458$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1459$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1460print $hookmanager->resPrint;
1461if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1462 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1463 $totalarray[
'nbfield']++;
1465if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1466 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1467 $totalarray[
'nbfield']++;
1469if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
1470 print_liste_field_titre($arrayfields[
'p.tosell'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tosell",
"", $param,
'', $sortfield, $sortorder,
'center ');
1471 $totalarray[
'nbfield']++;
1473if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
1474 print_liste_field_titre($arrayfields[
'p.tobuy'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tobuy",
"", $param,
'', $sortfield, $sortorder,
'center ');
1475 $totalarray[
'nbfield']++;
1479 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1480 $totalarray[
'nbfield']++;
1488$savnbfield = $totalarray[
'nbfield'];
1489$totalarray = array();
1490$totalarray[
'nbfield'] = 0;
1491$imaxinloop = ($limit ? min($num, $limit) : $num);
1492while ($i < $imaxinloop) {
1493 $obj = $db->fetch_object($resql);
1500 $sql =
"SELECT label";
1501 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1502 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1503 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1506 $result = $db->query($sql);
1508 $objtp = $db->fetch_object($result);
1509 if (!empty($objtp->label)) {
1510 $obj->label = $objtp->label;
1515 $parameters = array(
'staticdata' => $obj);
1518 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $product_static, $action);
1519 if (empty($reshook)) {
1520 $product_static->id = $obj->rowid;
1521 $product_static->ref = $obj->ref;
1522 $product_static->description = $obj->description;
1523 $product_static->ref_fourn = empty($obj->ref_supplier) ?
'' : $obj->ref_supplier;
1524 $product_static->ref_supplier = empty($obj->ref_supplier) ?
'' : $obj->ref_supplier;
1525 $product_static->label = $obj->label;
1526 $product_static->barcode = $obj->barcode;
1527 $product_static->finished = $obj->finished;
1528 $product_static->type = $obj->fk_product_type;
1529 $product_static->status_buy = $obj->tobuy;
1530 $product_static->status = $obj->tosell;
1531 $product_static->status_batch = $obj->tobatch;
1532 $product_static->entity = $obj->entity;
1533 $product_static->pmp = $obj->pmp;
1534 $product_static->accountancy_code_sell = $obj->accountancy_code_sell;
1535 $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
1536 $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
1537 $product_static->accountancy_code_buy = $obj->accountancy_code_buy;
1538 $product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
1539 $product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
1540 $product_static->length = $obj->length;
1541 $product_static->length_units = $obj->length_units;
1542 $product_static->width = $obj->width;
1543 $product_static->width_units = $obj->width_units;
1544 $product_static->height = $obj->height;
1545 $product_static->height_units = $obj->height_units;
1546 $product_static->weight = $obj->weight;
1547 $product_static->weight_units = $obj->weight_units;
1548 $product_static->volume = $obj->volume;
1549 $product_static->volume_units = $obj->volume_units;
1550 $product_static->surface = $obj->surface;
1551 $product_static->surface_units = $obj->surface_units;
1553 $product_static->fk_unit = $obj->fk_unit;
1557 if ((isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && $search_type != 1) ||
getDolGlobalString(
'STOCK_DISABLE_OPTIM_LOAD')) {
1559 $option =
'nobatch';
1560 if (empty($arrayfields[
'stock_virtual'][
'checked'])) {
1561 $option .=
',novirtual';
1563 $product_static->load_stock($option);
1568 $product_static->price = $obj->price;
1570 $object = $product_static;
1572 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_prices') : $user->hasRight(
'product',
'lire');
1573 if ($product_static->isService()) {
1574 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'lire');
1577 if ($mode ==
'kanban') {
1579 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1580 print
'<div class="box-flex-container kanban">';
1585 if ($massactionbutton || $massaction) {
1587 if (in_array($object->id, $arrayofselected)) {
1591 print $object->getKanbanView(
'', array(
'selected' => $selected));
1592 if ($i == ($imaxinloop - 1)) {
1599 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1603 print
'<td class="nowrap center">';
1604 if ($massactionbutton || $massaction) {
1606 if (in_array($object->id, $arrayofselected)) {
1609 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1613 $totalarray[
'nbfield']++;
1617 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1618 print
'<td class="nowraponall">';
1619 print $product_static->id;
1622 $totalarray[
'nbfield']++;
1627 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1628 print
'<td class="tdoverflowmax250">';
1629 print $product_static->getNomUrl(1);
1632 $totalarray[
'nbfield']++;
1637 if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
1638 print
'<td class="tdoverflowmax200">';
1639 print $product_static->getNomUrl(1);
1642 $totalarray[
'nbfield']++;
1647 if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
1648 $product_thumbnail_html =
'';
1649 if (!empty($product_static->entity)) {
1650 $product_thumbnail = $product_static->show_photos(
'product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
1651 if ($product_static->nbphoto > 0) {
1652 $product_thumbnail_html = $product_thumbnail;
1656 print
'<td class="center">' . $product_thumbnail_html .
'</td>';
1658 $totalarray[
'nbfield']++;
1663 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1664 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($product_static->label).
'">'.$product_static->label.
'</td>';
1666 $totalarray[
'nbfield']++;
1671 if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
1672 print
'<td class="center">';
1674 if ($product_static->type == 0) {
1675 $s .=
img_picto($langs->trans(
"Product"),
'product',
'class="paddingleftonly paddingrightonly colorgrey"');
1677 $s .=
img_picto($langs->trans(
"Service"),
'service',
'class="paddingleftonly paddingrightonly colorgrey"');
1682 $totalarray[
'nbfield']++;
1687 if (!empty($arrayfields[
'p.description'][
'checked'])) {
1688 print
'<td class="left">';
1691 print dolGetFirstLineofText($product_static->description, 2);
1694 $totalarray[
'nbfield']++;
1699 if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
1700 print
'<td>'.$product_static->barcode.
'</td>';
1702 $totalarray[
'nbfield']++;
1707 if (!empty($arrayfields[
'p.duration'][
'checked'])) {
1708 print
'<td class="center nowraponall">';
1710 if (preg_match(
'/([^a-z]+)[a-z]$/i', $obj->duration)) {
1711 $duration_value = substr($obj->duration, 0,
dol_strlen($obj->duration) - 1);
1712 $duration_unit = substr($obj->duration, -1);
1714 if ((
float) $duration_value > 1) {
1715 $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"));
1716 } elseif ((
float) $duration_value > 0) {
1717 $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"));
1719 print $duration_value;
1720 print((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value !=
'') ?
' '.$langs->trans($dur[$duration_unit]) :
'');
1721 } elseif (!preg_match(
'/^[a-z]$/i', $obj->duration)) {
1722 print $obj->duration;
1727 $totalarray[
'nbfield']++;
1731 if (!empty($arrayfields[
'pac.fk_product_parent'][
'checked'])) {
1732 print
'<td class="nowraponall">';
1733 if ($obj->fk_product_parent > 0) {
1734 if (!empty($conf->cache[
'product'][$obj->fk_product_parent])) {
1735 $product_parent_static = $conf->cache[
'product'][$obj->fk_product_parent];
1737 $product_parent_static=
new Product($db);
1738 $product_parent_static->fetch($obj->fk_product_parent);
1739 $conf->cache[
'product'][$obj->fk_product_parent] = $product_parent_static;
1741 print $product_parent_static->getNomUrl(1);
1745 $totalarray[
'nbfield']++;
1749 if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1750 print
'<td class="center">';
1751 print $product_static->getLibFinished();
1754 $totalarray[
'nbfield']++;
1758 if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1759 print
'<td class="center">';
1760 print $product_static->weight;
1763 $totalarray[
'nbfield']++;
1767 if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1768 print
'<td class="center">';
1769 if ($product_static->weight !=
'') {
1774 $totalarray[
'nbfield']++;
1778 if (!empty($arrayfields[
'p.length'][
'checked'])) {
1779 print
'<td class="center">';
1780 print $product_static->length;
1783 $totalarray[
'nbfield']++;
1787 if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1788 print
'<td class="center">';
1789 if ($product_static->length !=
'') {
1794 $totalarray[
'nbfield']++;
1798 if (!empty($arrayfields[
'p.width'][
'checked'])) {
1799 print
'<td align="center">';
1800 print $product_static->width;
1803 $totalarray[
'nbfield']++;
1807 if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1808 print
'<td class="center">';
1809 if ($product_static->width !=
'') {
1814 $totalarray[
'nbfield']++;
1818 if (!empty($arrayfields[
'p.height'][
'checked'])) {
1819 print
'<td align="center">';
1820 print $product_static->height;
1823 $totalarray[
'nbfield']++;
1827 if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1828 print
'<td class="center">';
1829 if ($product_static->height !=
'') {
1834 $totalarray[
'nbfield']++;
1838 if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1839 print
'<td class="center">';
1840 print $product_static->surface;
1843 $totalarray[
'nbfield']++;
1847 if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1848 print
'<td class="center">';
1849 if ($product_static->surface !=
'') {
1854 $totalarray[
'nbfield']++;
1858 if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1859 print
'<td class="center">';
1860 print $product_static->volume;
1863 $totalarray[
'nbfield']++;
1867 if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1868 print
'<td class="center">';
1869 if ($product_static->volume !=
'') {
1874 $totalarray[
'nbfield']++;
1878 if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1879 print
'<td align="center">';
1880 if (!empty($obj->cu_label)) {
1881 print $langs->trans($obj->cu_label);
1885 $totalarray[
'nbfield']++;
1890 if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1891 print
'<td align="left">';
1892 if (isModEnabled(
'workstation') && !empty($obj->fk_default_workstation)) {
1893 $workstation_static->id = $obj->fk_default_workstation;
1894 $workstation_static->ref = $obj->ref_workstation;
1895 $workstation_static->status = $obj->status_workstation;
1897 print $workstation_static->getNomUrl(1);
1901 $totalarray[
'nbfield']++;
1906 if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1907 print
'<td class="right nowraponall">';
1908 if ($product_static->status && $usercancreadprice) {
1909 if ($obj->price_base_type ==
'TTC') {
1910 print
'<span class="amount">'.price($obj->price_ttc).
' '.$langs->trans(
"TTC").
'</span>';
1912 print
'<span class="amount">'.price($obj->price).
' '.$langs->trans(
"HT").
'</span>';
1917 $totalarray[
'nbfield']++;
1923 if (! isset($productpricescache)) {
1924 $productpricescache=array();
1926 if (! isset($productpricescache[$obj->rowid])) {
1927 $productpricescache[$obj->rowid] = array();
1930 if ($product_static->status && $usercancreadprice) {
1933 $sqlp =
"SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price, p.price_base_type";
1934 $sqlp .=
" FROM ".MAIN_DB_PREFIX.
"product_price as p";
1935 $sqlp .=
" WHERE fk_product = ".((int) $obj->rowid);
1936 $sqlp .=
" ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC";
1937 $resultp = $db->query($sqlp);
1939 $nump = $db->num_rows($resultp);
1941 while ($j < $nump) {
1942 $objp = $db->fetch_object($resultp);
1944 if (empty($productpricescache[$obj->rowid][$objp->price_level])) {
1945 $productpricescache[$obj->rowid][$objp->price_level][
'price'] = $objp->price;
1946 $productpricescache[$obj->rowid][$objp->price_level][
'price_ttc'] = $objp->price_ttc;
1947 $productpricescache[$obj->rowid][$objp->price_level][
'price_base_type'] = $objp->price_base_type;
1953 $db->free($resultp);
1959 foreach ($arraypricelevel as $key => $value) {
1960 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1961 print
'<td class="right nowraponall">';
1962 if (!empty($productpricescache[$obj->rowid]) && isset($productpricescache[$obj->rowid][$key][
'price_base_type'])) {
1963 if ($productpricescache[$obj->rowid][$key][
'price_base_type'] ==
'TTC') {
1964 print
'<span class="amount">'.price($productpricescache[$obj->rowid][$key][
'price_ttc']).
' '.$langs->trans(
"TTC").
'</span>';
1966 print
'<span class="amount">'.price($productpricescache[$obj->rowid][$key][
'price']).
' '.$langs->trans(
"HT").
'</span>';
1971 $totalarray[
'nbfield']++;
1978 if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
1979 print
'<td class="right nowraponall">';
1980 if ($product_static->status_buy && $obj->bestpurchaseprice !=
'' && $usercancreadprice) {
1981 if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) {
1982 if ($product_fourn->product_fourn_price_id > 0) {
1983 if ((isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
1984 $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
1985 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>';
1987 print
'<span class="amount">'.price($product_fourn->fourn_unitprice).
' '.$langs->trans(
"HT").
'</span>';
1994 $totalarray[
'nbfield']++;
1999 if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
2000 print
'<td class="right">';
2001 if ($product_static->status_buy && $usercancreadprice) {
2002 if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) {
2003 $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList);
2004 print $form->textwithpicto(count($productFournList), $htmltext);
2011 if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
2012 print
'<td class="right">';
2013 print
vatrate($obj->tva_tx,
true);
2016 $totalarray[
'nbfield']++;
2021 if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
2022 print
'<td class="nowrap right">';
2023 if ($usercancreadprice) {
2024 print
'<span class="amount">'.price($product_static->pmp, 1, $langs).
"</span>";
2029 if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
2030 print
'<td class="nowrap right">';
2032 if ($usercancreadprice) {
2033 print
'<span class="amount">'.price($obj->cost_price).
' '.$langs->trans(
"HT").
'</span>';
2039 if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
2040 print
'<td class="right">';
2041 if ($product_static->type != 1) {
2042 print $obj->seuil_stock_alerte;
2046 $totalarray[
'nbfield']++;
2050 if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
2051 print
'<td class="right">';
2052 if ($product_static->type != 1) {
2053 print $obj->desiredstock;
2057 $totalarray[
'nbfield']++;
2061 if (!empty($arrayfields[
'p.stock'][
'checked'])) {
2062 print
'<td class="right">';
2063 if ($product_static->type != 1) {
2064 if ($obj->seuil_stock_alerte !=
'' && $product_static->stock_reel < (
float) $obj->seuil_stock_alerte) {
2065 print
img_warning($langs->trans(
"StockLowerThanLimit", $obj->seuil_stock_alerte)).
' ';
2067 if ($usercancreadprice) {
2068 if ($product_static->stock_reel < 0) {
2069 print
'<span class="warning">';
2071 print
price(
price2num($product_static->stock_reel,
'MS'), 0, $langs, 1, 0);
2072 if ($product_static->stock_reel < 0) {
2079 $totalarray[
'nbfield']++;
2083 if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
2084 print
'<td class="right">';
2085 if ($product_static->type != 1) {
2086 if ($obj->seuil_stock_alerte !=
'' && $product_static->stock_theorique < (
float) $obj->seuil_stock_alerte) {
2087 print
img_warning($langs->trans(
"StockLowerThanLimit", $obj->seuil_stock_alerte)).
' ';
2089 if ($usercancreadprice) {
2090 if ($product_static->stock_theorique < 0) {
2091 print
'<span class="warning">';
2093 print
price(
price2num($product_static->stock_theorique,
'MS'), 0, $langs, 1, 0);
2094 if ($product_static->stock_theorique < 0) {
2101 $totalarray[
'nbfield']++;
2105 if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
2106 print
'<td class="center">';
2107 print $product_static->getLibStatut(1, 2);
2110 $totalarray[
'nbfield']++;
2114 if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
2115 print
'<td>'.getCountry($obj->fk_country, 0, $db).
'</td>';
2117 $totalarray[
'nbfield']++;
2121 if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
2123 if (!empty($obj->fk_state)) {
2124 print
getState($obj->fk_state, 0, $db);
2128 $totalarray[
'nbfield']++;
2132 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
2133 print
'<td>'.length_accountg($product_static->accountancy_code_sell).
'</td>';
2135 $totalarray[
'nbfield']++;
2138 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
2139 print
'<td>'.length_accountg($product_static->accountancy_code_sell_intra).
'</td>';
2141 $totalarray[
'nbfield']++;
2144 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
2145 print
'<td>'.length_accountg($product_static->accountancy_code_sell_export).
'</td>';
2147 $totalarray[
'nbfield']++;
2151 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
2152 print
'<td>'.length_accountg($product_static->accountancy_code_buy).
'</td>';
2154 $totalarray[
'nbfield']++;
2157 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
2158 print
'<td>'.length_accountg($product_static->accountancy_code_buy_intra).
'</td>';
2160 $totalarray[
'nbfield']++;
2163 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
2164 print
'<td>'.length_accountg($product_static->accountancy_code_buy_export).
'</td>';
2166 $totalarray[
'nbfield']++;
2170 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2172 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2173 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2174 print $hookmanager->resPrint;
2176 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2177 print
'<td class="center nowraponall">';
2178 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2181 $totalarray[
'nbfield']++;
2185 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2186 print
'<td class="center nowraponall">';
2187 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2190 $totalarray[
'nbfield']++;
2195 if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
2196 print
'<td class="center nowrap">';
2197 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
"produit",
"creer") &&
getDolGlobalString(
'MAIN_DIRECT_STATUS_UPDATE')) {
2198 print
ajax_object_onoff($product_static,
'status',
'tosell',
'ProductStatusOnSell',
'ProductStatusNotOnSell');
2200 print $product_static->LibStatut($product_static->status, 5, 0);
2204 $totalarray[
'nbfield']++;
2208 if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
2209 print
'<td class="center nowrap">';
2210 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
"produit",
"creer") &&
getDolGlobalString(
'MAIN_DIRECT_STATUS_UPDATE')) {
2211 print
ajax_object_onoff($product_static,
'status_buy',
'tobuy',
'ProductStatusOnBuy',
'ProductStatusNotOnBuy');
2213 print $product_static->LibStatut($product_static->status_buy, 5, 1);
2217 $totalarray[
'nbfield']++;
2223 print
'<td class="nowrap center">';
2224 if ($massactionbutton || $massaction) {
2226 if (in_array($object->id, $arrayofselected)) {
2229 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2233 $totalarray[
'nbfield']++;
2246 foreach ($arrayfields as $key => $val) {
2247 if (!empty($val[
'checked'])) {
2251 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2256print
'</table>'.
"\n";
2259print
'</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)
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 a 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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.