42 require
'../main.inc.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
61 $langs->loadLangs(array(
'products',
'stocks',
'suppliers',
'companies',
'margins'));
63 $langs->load(
"productbatch");
68 $action =
GETPOST(
'action',
'aZ09');
69 $massaction =
GETPOST(
'massaction',
'alpha');
71 $confirm =
GETPOST(
'confirm',
'alpha');
72 $toselect =
GETPOST(
'toselect',
'array');
73 $optioncss =
GETPOST(
'optioncss',
'alpha');
74 $mode =
GETPOST(
'mode',
'alpha');
79 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
80 $search_id =
GETPOST(
"search_id",
'alpha');
81 $search_ref =
GETPOST(
"search_ref",
'alpha');
82 $search_ref_supplier =
GETPOST(
"search_ref_supplier",
'alpha');
83 $search_barcode =
GETPOST(
"search_barcode",
'alpha');
84 $search_label =
GETPOST(
"search_label",
'alpha');
85 $search_default_workstation =
GETPOST(
"search_default_workstation",
'alpha');
86 $search_type =
GETPOST(
"search_type",
"int");
87 $search_vatrate =
GETPOST(
"search_vatrate",
'alpha');
88 $searchCategoryProductOperator = 0;
90 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
94 $searchCategoryProductList =
GETPOST(
'search_category_product_list',
'array');
96 if (!empty($catid) && empty($searchCategoryProductList)) {
97 $searchCategoryProductList = array($catid);
99 $search_tosell =
GETPOST(
"search_tosell");
100 $search_tobuy =
GETPOST(
"search_tobuy");
101 $search_country =
GETPOST(
"search_country",
'aZ09');
102 $search_state =
GETPOST(
"state_id",
'intcomma');
103 $search_tobatch =
GETPOST(
"search_tobatch");
104 $search_accountancy_code_sell =
GETPOST(
"search_accountancy_code_sell",
'alpha');
105 $search_accountancy_code_sell_intra =
GETPOST(
"search_accountancy_code_sell_intra",
'alpha');
106 $search_accountancy_code_sell_export =
GETPOST(
"search_accountancy_code_sell_export",
'alpha');
107 $search_accountancy_code_buy =
GETPOST(
"search_accountancy_code_buy",
'alpha');
108 $search_accountancy_code_buy_intra =
GETPOST(
"search_accountancy_code_buy_intra",
'alpha');
109 $search_accountancy_code_buy_export =
GETPOST(
"search_accountancy_code_buy_export",
'alpha');
110 $search_import_key =
GETPOST(
"search_import_key",
'alpha');
111 $search_finished =
GETPOST(
"search_finished");
112 $search_units =
GETPOST(
'search_units',
'alpha');
113 $type =
GETPOST(
"type",
'alpha');
116 $show_childproducts = 0;
118 $show_childproducts =
GETPOST(
'search_show_childproducts');
121 $diroutputmassaction = $conf->product->dir_output.
'/temp/massgeneration/'.$user->id;
125 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
126 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
128 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
132 $offset = $limit * $page;
133 $pageprev = $page - 1;
134 $pagenext = $page + 1;
136 $sortfield =
"p.ref";
143 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'productservicelist';
144 if ((
string) $type ==
'1') {
145 $contextpage =
'servicelist';
146 if ($search_type ==
'') {
150 if ((
string) $type ==
'0') {
151 $contextpage =
'productlist';
152 if ($search_type ==
'') {
159 $hookmanager->initHooks(array(
'productservicelist'));
161 $form =
new Form($db);
166 $extrafields->fetch_name_optionals_label(
$object->table_element);
167 $search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
169 if (empty($action)) {
176 if (!empty($canvas)) {
177 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
178 $objcanvas =
new Canvas($db, $action);
179 $objcanvas->getCanvas(
'product',
'list', $canvas);
183 $virtualdiffersfromphysical = 0;
190 $virtualdiffersfromphysical = 1;
194 $fieldstosearchall = array(
196 'p.label' =>
"ProductLabel",
197 'p.description' =>
"Description",
199 'pfp.ref_fourn' =>
'RefSupplier'
203 $fieldstosearchall[
'pl.label'] =
'ProductLabelTranslated';
204 $fieldstosearchall[
'pl.description'] =
'ProductDescriptionTranslated';
205 $fieldstosearchall[
'pl.note'] =
'ProductNoteTranslated';
208 $fieldstosearchall[
'p.barcode'] =
'Gencod';
209 $fieldstosearchall[
'pfp.barcode'] =
'GencodBuyPrice';
217 $titlesellprice = $langs->trans(
"SellingPrice");
219 $titlesellprice = $form->textwithpicto($langs->trans(
"SellingPrice"), $langs->trans(
"DefaultPriceRealPriceMayDependOnCustomer"));
225 $alias_product_perentity = !
getDolGlobalString(
'MAIN_PRODUCT_PERENTITY_SHARED') ?
"p" :
"ppe";
227 $arraypricelevel = array();
229 $arrayfields = array(
230 'p.rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'visible' => -2,
'noteditable' => 1,
'notnull' => 1,
'index' => 1,
'position' => 1,
'comment' =>
'Id',
'css' =>
'left'),
231 'p.ref' => array(
'label' =>
'ProductRef',
'checked' => 1,
'position' => 10),
233 'thumbnail' => array(
'label' =>
'Photo',
'checked' => 0,
'position' => 10),
234 'p.description' => array(
'label' =>
'Description',
'checked' => 0,
'position' => 10),
235 'p.label' => array(
'label' =>
"Label",
'checked' => 1,
'position' => 10),
236 'p.fk_product_type' => array(
'label' =>
"Type",
'checked' => 0,
'enabled' => (
isModEnabled(
"product") &&
isModEnabled(
"service")),
'position' => 11),
237 'p.barcode' => array(
'label' =>
"Gencod",
'checked' => 1,
'enabled' => (
isModEnabled(
'barcode')),
'position' => 12),
238 'p.duration' => array(
'label' =>
"Duration",
'checked' => ($contextpage !=
'productlist'),
'enabled' => (
isModEnabled(
"service") && (
string) $type ==
'1'),
'position' => 13),
239 'pac.fk_product_parent' => array(
'label' =>
"ParentProductOfVariant",
'checked' => -1,
'enabled' => (
isModEnabled(
'variants')),
'position' => 14),
240 'p.finished' => array(
'label' =>
"Nature",
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && $type !=
'1'),
'position' => 19),
241 'p.weight' => array(
'label' =>
'Weight',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && $type !=
'1'),
'position' => 20),
242 'p.weight_units' => array(
'label' =>
'WeightUnits',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && $type !=
'1'),
'position' => 21),
243 'p.length' => array(
'label' =>
'Length',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position' => 22),
244 'p.length_units' => array(
'label' =>
'LengthUnits',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position' => 23),
245 'p.width' => array(
'label' =>
'Width',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position' => 24),
246 'p.width_units' => array(
'label' =>
'WidthUnits',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position' => 25),
247 'p.height' => array(
'label' =>
'Height',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position' => 26),
248 'p.height_units' => array(
'label' =>
'HeightUnits',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SIZE') && $type !=
'1'),
'position' => 27),
249 'p.surface' => array(
'label' =>
'Surface',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SURFACE') && $type !=
'1'),
'position' => 28),
250 'p.surface_units' => array(
'label' =>
'SurfaceUnits',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_SURFACE') && $type !=
'1'),
'position' => 29),
251 'p.volume' => array(
'label' =>
'Volume',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_VOLUME') && $type !=
'1'),
'position' => 30),
252 'p.volume_units' => array(
'label' =>
'VolumeUnits',
'checked' => 0,
'enabled' => (
isModEnabled(
"product") && !
getDolGlobalString(
'PRODUCT_DISABLE_VOLUME') && $type !=
'1'),
'position' => 31),
253 'cu.label' => array(
'label' =>
"DefaultUnitToShow",
'checked' => 0,
'enabled' => (
isModEnabled(
"product") &&
getDolGlobalString(
'PRODUCT_USE_UNITS')),
'position' => 32),
254 'p.fk_default_workstation' => array(
'label' =>
'DefaultWorkstation',
'checked' => 0,
'enabled' =>
isModEnabled(
'workstation') && $type == 1,
'position' => 33),
255 'p.sellprice' => array(
'label' =>
"SellingPrice",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'PRODUIT_MULTIPRICES'),
'position' => 40),
256 'p.tva_tx' => array(
'label' =>
"VATRate",
'checked' => 0,
'enabled' => !
getDolGlobalString(
'PRODUIT_MULTIPRICES'),
'position' => 41),
257 'p.minbuyprice' => array(
'label' =>
"BuyingPriceMinShort",
'checked' => 1,
'enabled' => ($user->hasRight(
'fournisseur',
'lire')),
'position' => 42),
258 'p.numbuyprice' => array(
'label' =>
"BuyingPriceNumShort",
'checked' => 0,
'enabled' => ($user->hasRight(
'fournisseur',
'lire')),
'position' => 43),
259 'p.pmp' => array(
'label' =>
"PMPValueShort",
'checked' => 0,
'enabled' => ($user->hasRight(
'fournisseur',
'lire')),
'position' => 44),
260 'p.cost_price' => array(
'label' =>
"CostPrice",
'checked' => 0,
'enabled' => ($user->hasRight(
'fournisseur',
'lire')),
'position' => 45),
261 'p.seuil_stock_alerte' => array(
'label' =>
"StockLimit",
'checked' => 0,
'enabled' => (
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' ||
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES'))),
'position' => 50),
262 'p.desiredstock' => array(
'label' =>
"DesiredStock",
'checked' => 1,
'enabled' => (
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' ||
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES'))),
'position' => 51),
263 'p.stock' => array(
'label' =>
"PhysicalStock",
'checked' => 1,
'enabled' => (
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' ||
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES'))),
'position' => 52),
264 'stock_virtual' => array(
'label' =>
"VirtualStock",
'checked' => 1,
'enabled' => (
isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && ($contextpage !=
'servicelist' ||
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES')) && $virtualdiffersfromphysical),
'position' => 53),
265 'p.tobatch' => array(
'label' =>
"ManageLotSerial",
'checked' => 0,
'enabled' => (
isModEnabled(
'productbatch')),
'position' => 60),
266 'p.fk_country' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 100),
267 'p.fk_state' => array(
'label' =>
"State",
'checked' => 0,
'position' => 101),
268 $alias_product_perentity .
'.accountancy_code_sell' => array(
'label' =>
"ProductAccountancySellCode",
'checked' => 0,
'enabled' => !
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position' => 400),
269 $alias_product_perentity .
'.accountancy_code_sell_intra' => array(
'label' =>
"ProductAccountancySellIntraCode",
'checked' => 0,
'enabled' => $isInEEC && !
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position' => 401),
270 $alias_product_perentity .
'.accountancy_code_sell_export' => array(
'label' =>
"ProductAccountancySellExportCode",
'checked' => 0,
'enabled' => !
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position' => 402),
271 $alias_product_perentity .
'.accountancy_code_buy' => array(
'label' =>
"ProductAccountancyBuyCode",
'checked' => 0,
'enabled' => !
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position' => 403),
272 $alias_product_perentity .
'.accountancy_code_buy_intra' => array(
'label' =>
"ProductAccountancyBuyIntraCode",
'checked' => 0,
'enabled' => $isInEEC && !
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position' => 404),
273 $alias_product_perentity .
'.accountancy_code_buy_export' => array(
'label' =>
"ProductAccountancyBuyExportCode",
'checked' => 0,
'enabled' => !
getDolGlobalString(
'PRODUCT_DISABLE_ACCOUNTING'),
'position' => 405),
274 'p.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
275 'p.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
276 'p.tosell' => array(
'label' => $langs->transnoentitiesnoconv(
"Status").
' ('.$langs->transnoentitiesnoconv(
"Sell").
')',
'checked' => 1,
'position' => 1000),
277 'p.tobuy' => array(
'label' => $langs->transnoentitiesnoconv(
"Status").
' ('.$langs->transnoentitiesnoconv(
"Buy").
')',
'checked' => 1,
'position' => 1000),
278 'p.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'notnull' => -1,
'index' => 0,
'checked' => -1,
'position' => 1100),
296 for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
297 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$i;
298 if (!empty($conf->global->$keyforlabel)) {
299 $labelp = $i.
' - '.$langs->transnoentitiesnoconv($conf->global->$keyforlabel);
301 $labelp = $langs->transnoentitiesnoconv(
"SellingPrice").
" ".$i;
303 $arrayfields[
'p.sellprice'.$i] = array(
'label' => $labelp,
'checked' => ($i == 1 ? 1 : 0),
'enabled' =>
getDolGlobalString(
'PRODUIT_MULTIPRICES'),
'position' => (
float) (
'40.'.sprintf(
'%03d', $i)));
304 $arraypricelevel[$i] = array($i);
310 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
314 '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
317 if ($search_type ==
'0') {
318 $result =
restrictedArea($user,
'produit',
'',
'',
'',
'',
'', 0);
319 } elseif ($search_type ==
'1') {
320 $result =
restrictedArea($user,
'service',
'',
'',
'',
'',
'', 0);
322 $result =
restrictedArea($user,
'produit|service',
'',
'',
'',
'',
'', 0);
330 if (
GETPOST(
'cancel',
'alpha')) {
334 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
337 $parameters = array(
'arrayfields' => &$arrayfields);
338 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
343 $rightskey =
'produit';
345 $rightskey =
'service';
348 if (empty($reshook)) {
350 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
353 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
357 $search_ref_supplier =
"";
359 $search_default_workstation =
"";
360 $search_barcode =
"";
361 $searchCategoryProductOperator = 0;
362 $searchCategoryProductList = array();
365 $search_tobatch =
'';
366 $search_country =
"";
368 $search_vatrate =
"";
369 $search_finished =
'';
372 $show_childproducts =
'';
373 $search_import_key =
'';
374 $search_accountancy_code_sell =
'';
375 $search_accountancy_code_sell_intra =
'';
376 $search_accountancy_code_sell_export =
'';
377 $search_accountancy_code_buy =
'';
378 $search_accountancy_code_buy_intra =
'';
379 $search_accountancy_code_buy_export =
'';
380 $search_array_options = array();
385 $objectclass =
'Product';
386 if ((
string) $search_type ==
'1') {
387 $objectlabel =
'Services';
389 if ((
string) $search_type ==
'0') {
390 $objectlabel =
'Products';
393 $permissiontoread = $user->hasRight($rightskey,
'lire');
394 $permissiontodelete = $user->hasRight($rightskey,
'supprimer');
395 $permissiontoadd = $user->hasRight($rightskey,
'creer');
396 $uploaddir = $conf->product->dir_output;
397 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
399 if (!$error && $massaction ==
'switchonsalestatus' && $permissiontoadd) {
401 foreach ($toselect as $toselectid) {
402 $result = $product->fetch($toselectid);
403 if ($result > 0 && $product->id > 0) {
404 if ($product->setStatut($product->status ? 0 : 1,
null,
'product',
'PRODUCT_MODIFY',
'tosell') < 0) {
410 if (!$error && $massaction ==
'switchonpurchasestatus' && $permissiontoadd) {
412 foreach ($toselect as $toselectid) {
413 $result = $product->fetch($toselectid);
414 if ($result > 0 && $product->id > 0) {
415 if ($product->setStatut($product->status_buy ? 0 : 1,
null,
'product',
'PRODUCT_MODIFY',
'tobuy') < 0) {
428 $product_static =
new Product($db);
434 $title = $langs->trans(
"ProductsAndServices");
436 if ($search_type !=
'' && $search_type !=
'-1') {
437 if ($search_type == 1) {
438 $title = $langs->trans(
"Services");
440 $title = $langs->trans(
"Products");
446 $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,';
447 $sql .=
' p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
448 $sql .=
' p.tobatch, ';
450 $sql .=
' p.fk_default_workstation, ws.status as status_workstation, ws.ref as ref_workstation, ';
453 $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,";
455 $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,";
457 $sql .=
' p.datec as date_creation, p.tms as date_modification, p.pmp, p.stock, p.cost_price,';
458 $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,';
459 $sql .=
' p.fk_country, p.fk_state,';
460 $sql .=
' p.import_key,';
462 $sql .=
' p.fk_unit, cu.label as cu_label,';
464 $sql .=
' MIN(pfp.unitprice) as bestpurchaseprice';
466 $sql .=
', pac.rowid as prod_comb_id';
467 $sql .=
', pac.fk_product_parent';
470 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
471 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
472 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
476 $parameters = array();
477 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
478 $sql .= $hookmanager->resPrint;
479 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
483 $sql .=
' FROM '.MAIN_DB_PREFIX.
'product as p';
485 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"workstation_workstation as ws ON (p.fk_default_workstation = ws.rowid)";
488 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
490 if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
491 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_extrafields as ef on (p.rowid = ef.fk_object)";
493 $linktopfp =
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
497 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$db->escape($langs->getDefaultLang()).
"'";
500 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_attribute_combination pac ON pac.fk_product_child = p.rowid";
503 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_units cu ON cu.rowid = p.fk_unit";
507 $parameters = array();
508 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object, $action);
509 $sql .= $hookmanager->resPrint;
511 $sql .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
514 $newfieldstosearchall = $fieldstosearchall;
515 unset($newfieldstosearchall[
'pfp.ref_fourn']);
516 unset($newfieldstosearchall[
'pfp.barcode']);
521 $sql .=
' OR EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.
'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid';
522 $sql .=
' AND ('.natural_search(
'pfp.ref_fourn', $search_all, 0, 1);
525 $sql .=
' OR '.natural_search(
'pfp.barcode', $search_all, 0, 1);
530 if (
dol_strlen($search_type) && $search_type !=
'-1') {
531 if ($search_type == 1) {
532 $sql .=
" AND p.fk_product_type = 1";
534 $sql .=
" AND p.fk_product_type <> 1";
539 $sql .=
" AND pac.rowid IS NULL";
551 if ($search_default_workstation) {
554 if ($search_barcode) {
557 if ($search_import_key) {
560 if (isset($search_tosell) &&
dol_strlen($search_tosell) > 0 && $search_tosell != -1) {
561 $sql .=
" AND p.tosell = ".((int) $search_tosell);
563 if (isset($search_tobuy) &&
dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) {
564 $sql .=
" AND p.tobuy = ".((int) $search_tobuy);
566 if (isset($search_tobatch) &&
dol_strlen($search_tobatch) > 0 && $search_tobatch != -1) {
567 $sql .=
" AND p.tobatch = ".((int) $search_tobatch);
569 if ($search_vatrate) {
573 $sql .=
" AND p.canvas = '".$db->escape($canvas).
"'";
576 if (!empty($searchCategoryProductList)) {
577 $searchCategoryProductSqlList = array();
578 $listofcategoryid =
'';
579 foreach ($searchCategoryProductList as $searchCategoryProduct) {
580 if (intval($searchCategoryProduct) == -2) {
581 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck WHERE p.rowid = ck.fk_product)";
582 } elseif (intval($searchCategoryProduct) > 0) {
583 if ($searchCategoryProductOperator == 0) {
584 $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).
")";
586 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
590 if ($listofcategoryid) {
591 $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).
"))";
593 if ($searchCategoryProductOperator == 1) {
594 if (!empty($searchCategoryProductSqlList)) {
595 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
598 if (!empty($searchCategoryProductSqlList)) {
599 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
604 $sql .=
" AND pfp.fk_soc = ".((int) $fourn_id);
606 if ($search_country) {
607 $sql .=
" AND p.fk_country = ".((int) $search_country);
610 $sql .=
" AND p.fk_state = ".((int) $search_state);
612 if ($search_finished >= 0 && $search_finished !==
'') {
613 $sql .=
" AND p.finished = ".((int) $search_finished);
615 if ($search_accountancy_code_sell) {
618 if ($search_accountancy_code_sell_intra) {
621 if ($search_accountancy_code_sell_export) {
624 if ($search_accountancy_code_buy) {
627 if ($search_accountancy_code_buy_intra) {
630 if ($search_accountancy_code_buy_export) {
637 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
639 $parameters = array();
640 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
641 $sql .= $hookmanager->resPrint;
642 $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,";
643 $sql .=
" p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
644 $sql .=
' p.datec, p.tms, p.entity, p.tobatch, p.pmp, p.cost_price, p.stock,';
646 $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,";
648 $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,";
650 $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,';
651 $sql .=
' p.fk_country, p.fk_state,';
652 $sql .=
' p.import_key';
654 $sql .=
', p.fk_unit, cu.label';
657 $sql .=
', p.fk_default_workstation, ws.status, ws.ref';
660 $sql .=
', pac.rowid';
661 $sql .=
', pac.fk_product_parent';
664 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
665 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
666 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
670 $parameters = array();
671 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters,
$object, $action);
672 $sql .= $hookmanager->resPrint;
675 $nbtotalofrecords =
'';
678 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
679 $sqlforcount = preg_replace(
'/'.preg_quote($linktopfp,
'/').
'/',
'', $sqlforcount);
680 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
682 $resql = $db->query($sqlforcount);
684 $objforcount = $db->fetch_object($resql);
685 $nbtotalofrecords = $objforcount->nbtotalofrecords;
690 if (($page * $limit) > $nbtotalofrecords) {
698 $sql .= $db->order($sortfield, $sortorder);
700 $sql .= $db->plimit($limit + 1, $offset);
703 $resql = $db->query(
$sql);
709 $num = $db->num_rows($resql);
713 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
714 $obj = $db->fetch_object($resql);
716 header(
"Location: ".DOL_URL_ROOT.
'/product/card.php?id='.$id);
725 if ($search_type !=
'') {
726 if ($search_type == 0) {
727 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
728 } elseif ($search_type == 1) {
729 $helpurl =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
734 foreach ($searchCategoryProductList as $searchCategoryProduct) {
735 $paramsCat .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
739 llxHeader(
'', $title, $helpurl,
'', 0, 0, array(), array(), $paramsCat,
'');
741 $arrayofselected = is_array($toselect) ? $toselect : array();
750 $param .=
'&mode='.urlencode($mode);
752 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
753 $param .=
'&contextpage='.urlencode($contextpage);
755 if ($limit > 0 && $limit != $conf->liste_limit) {
756 $param .=
'&limit='.((int) $limit);
758 if ($optioncss !=
'') {
759 $param .=
'&optioncss='.urlencode($optioncss);
762 $param .=
"&search_all=".urlencode($search_all);
764 if ($searchCategoryProductOperator == 1) {
765 $param .=
"&search_category_product_operator=".urlencode((
string) ($searchCategoryProductOperator));
767 foreach ($searchCategoryProductList as $searchCategoryProduct) {
768 $param .=
"&search_category_product_list[]=".urlencode($searchCategoryProduct);
771 $param .=
"&search_ref=".urlencode($search_ref);
773 if ($search_ref_supplier) {
774 $param .=
"&search_ref_supplier=".urlencode($search_ref_supplier);
776 if ($search_barcode) {
777 $param .= ($search_barcode ?
"&search_barcode=".urlencode($search_barcode) :
"");
779 if ($search_import_key) {
780 $param .=
"&search_import_key=".urlencode($search_import_key);
783 $param .=
"&search_label=".urlencode($search_label);
785 if ($search_default_workstation) {
786 $param .=
"&search_default_workstation=".urlencode($search_default_workstation);
788 if ($search_tosell !=
'') {
789 $param .=
"&search_tosell=".urlencode($search_tosell);
791 if ($search_tobuy !=
'') {
792 $param .=
"&search_tobuy=".urlencode($search_tobuy);
794 if ($search_tobatch) {
795 $param .=
"&search_tobatch=".urlencode($search_tobatch);
797 if ($search_country !=
'') {
798 $param .=
"&search_country=".urlencode((
string) ($search_country));
800 if ($search_state !=
'') {
801 $param .=
"&search_state=".urlencode((
string) ($search_state));
803 if ($search_vatrate) {
804 $param .=
"&search_vatrate=".urlencode($search_vatrate);
807 $param .=
"&fourn_id=".urlencode((
string) ($fourn_id));
809 if ($show_childproducts) {
810 $param .= ($show_childproducts ?
"&search_show_childproducts=".urlencode($show_childproducts) :
"");
813 $param .=
'&type='.urlencode((
string) ($type));
815 if ($search_type !=
'') {
816 $param .=
'&search_type='.urlencode($search_type);
818 if ($search_accountancy_code_sell) {
819 $param .=
"&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
821 if ($search_accountancy_code_sell_intra) {
822 $param .=
"&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra);
824 if ($search_accountancy_code_sell_export) {
825 $param .=
"&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export);
827 if ($search_accountancy_code_buy) {
828 $param .=
"&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
830 if ($search_accountancy_code_buy_intra) {
831 $param .=
"&search_accountancy_code_buy_intra=".urlencode($search_accountancy_code_buy_intra);
833 if ($search_accountancy_code_buy_export) {
834 $param .=
"&search_accountancy_code_buy_export=".urlencode($search_accountancy_code_buy_export);
836 if ($search_finished) {
837 $param .=
"&search_finished=".urlencode($search_finished);
840 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
843 $parameters = array(
'param' => &$param);
844 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
845 $param .= $hookmanager->resPrint;
848 $arrayofmassactions = array(
849 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
850 'edit_extrafields' =>
img_picto(
'',
'edit',
'class="pictofixedwidth"').$langs->trans(
"ModifyValueExtrafields"),
854 if ($user->hasRight($rightskey,
'creer')) {
855 $arrayofmassactions[
'preupdateprice'] =
img_picto(
'',
'edit',
'class="pictofixedwidth"').$langs->trans(
"UpdatePrice");
856 $arrayofmassactions[
'switchonsalestatus'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SwitchOnSaleStatus");
857 $arrayofmassactions[
'switchonpurchasestatus'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SwitchOnPurchaseStatus");
859 if (
isModEnabled(
'category') && $user->hasRight($rightskey,
'creer')) {
860 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
862 if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'edit_extrafields',
'preupdateprice'))) {
863 $arrayofmassactions = array();
865 if ($user->hasRight($rightskey,
'supprimer')) {
866 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
868 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
871 $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'));
872 $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'));
875 $perm = ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'));
877 $perm = $user->hasRight(
'service',
'creer');
879 $perm = $user->hasRight(
'produit',
'creer');
884 $params[
'forcenohideoftext'] = 1;
888 $label =
'NewProduct';
889 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/card.php?action=create&type=0',
'', $perm, $params);
892 $label =
'NewService';
893 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/card.php?action=create&type=1',
'', $perm, $params);
896 print
'<form id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire">';
897 if ($optioncss !=
'') {
898 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
900 print
'<input type="hidden" name="token" value="'.newToken().
'">';
901 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
902 print
'<input type="hidden" name="action" value="list">';
903 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
904 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
906 print
'<input type="hidden" name="type" value="'.$type.
'">';
907 print
'<input type="hidden" name="page_y" value="">';
908 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
910 if (empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
911 print
'<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).
'">';
919 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
921 $topicmail =
"Information";
922 $modelmail =
"product";
924 $trackid =
'prod'.$object->id;
925 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
927 if (!empty($catid)) {
928 print
"<div id='ways'>";
930 $ways = $c->print_all_ways(
' > ',
'product/list.php');
931 print
" > ".$ways[0].
"<br>\n";
937 foreach ($fieldstosearchall as $key => $val) {
938 $fieldstosearchall[$key] = $langs->trans($val);
939 $setupstring .= $key.
"=".$val.
";";
941 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
942 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
947 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
949 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList,
'minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0);
954 $moreforfilter .=
'<div class="divsearchfield">';
955 $moreforfilter .=
'<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ?
'checked="checked"' :
'').
'>';
956 $moreforfilter .=
' <label for="search_show_childproducts">'.$langs->trans(
'ShowChildProducts').
'</label>';
957 $moreforfilter .=
'</div>';
960 $parameters = array();
961 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
962 if (empty($reshook)) {
963 $moreforfilter .= $hookmanager->resPrint;
965 $moreforfilter = $hookmanager->resPrint;
968 if (!empty($moreforfilter)) {
969 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
970 print $moreforfilter;
974 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
975 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
976 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
977 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
979 print
'<div class="div-table-responsive">';
980 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
984 print
'<tr class="liste_titre_filter">';
987 print
'<td class="liste_titre center maxwidthsearch">';
988 $searchpicto = $form->showFilterButtons(
'left');
992 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
993 print
'<td class="liste_titre left">';
994 print
'<input class="flat" type="text" name="search_id" size="4" value="'.dol_escape_htmltag($search_id).
'">';
997 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
998 print
'<td class="liste_titre left">';
999 print
'<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).
'">';
1002 if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
1003 print
'<td class="liste_titre left">';
1004 print
'<input class="flat" type="text" name="search_ref_supplier" size="8" value="'.dol_escape_htmltag($search_ref_supplier).
'">';
1008 if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
1009 print
'<td class="liste_titre center">';
1012 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1013 print
'<td class="liste_titre left">';
1014 print
'<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).
'">';
1018 if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
1019 print
'<td class="liste_titre center">';
1020 $array = array(
'-1' =>
' ',
'0' => $langs->trans(
'Product'),
'1' => $langs->trans(
'Service'));
1021 print $form->selectarray(
'search_type', $array, $search_type);
1025 if (!empty($arrayfields[
'p.description'][
'checked'])) {
1026 print
'<td class="liste_titre left">';
1030 if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
1031 print
'<td class="liste_titre">';
1032 print
'<input class="flat" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).
'">';
1036 if (!empty($arrayfields[
'p.duration'][
'checked'])) {
1037 print
'<td class="liste_titre">';
1041 if (!empty($arrayfields[
'pac.fk_product_parent'][
'checked'])) {
1042 print
'<td class="liste_titre">';
1046 if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1047 print
'<td class="liste_titre">';
1048 print $formproduct->selectProductNature(
'search_finished', $search_finished);
1052 if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1053 print
'<td class="liste_titre">';
1057 if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1058 print
'<td class="liste_titre">';
1062 if (!empty($arrayfields[
'p.length'][
'checked'])) {
1063 print
'<td class="liste_titre">';
1067 if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1068 print
'<td class="liste_titre">';
1072 if (!empty($arrayfields[
'p.width'][
'checked'])) {
1073 print
'<td class="liste_titre">';
1077 if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1078 print
'<td class="liste_titre">';
1082 if (!empty($arrayfields[
'p.height'][
'checked'])) {
1083 print
'<td class="liste_titre">';
1087 if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1088 print
'<td class="liste_titre">';
1092 if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1093 print
'<td class="liste_titre">';
1097 if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1098 print
'<td class="liste_titre">';
1102 if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1103 print
'<td class="liste_titre">';
1107 if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1108 print
'<td class="liste_titre">';
1113 if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1114 print
'<td class="liste_titre">';
1115 print $form->selectUnits($search_units,
'search_units', 1);
1120 if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1121 print
'<td class="liste_titre">';
1122 print
'<input class="flat width75" type="text" name="search_default_workstation" value="'.dol_escape_htmltag($search_default_workstation).
'">';
1127 if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1128 print
'<td class="liste_titre right">';
1134 foreach ($arraypricelevel as $key => $value) {
1135 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1136 print
'<td class="liste_titre right">';
1143 if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
1144 print
'<td class="liste_titre">';
1149 if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
1150 print
'<td class="liste_titre">';
1155 if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
1156 print
'<td class="liste_titre right">';
1157 print
'<input class="right flat maxwidth50" placeholder="%" type="text" name="search_vatrate" size="1" value="'.dol_escape_htmltag($search_vatrate).
'">';
1161 if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
1162 print
'<td class="liste_titre">';
1167 if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
1168 print
'<td class="liste_titre">';
1173 if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
1174 print
'<td class="liste_titre">';
1179 if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
1180 print
'<td class="liste_titre">';
1185 if (!empty($arrayfields[
'p.stock'][
'checked'])) {
1186 print
'<td class="liste_titre"> </td>';
1189 if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
1190 print
'<td class="liste_titre"> </td>';
1193 if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
1194 print
'<td class="liste_titre center">';
1195 $statutarray = array(
1197 '0' => $langs->trans(
"ProductStatusNotOnBatchShort"),
1198 '1' => $langs->trans(
"ProductStatusOnBatchShort"),
1199 '2' => $langs->trans(
"ProductStatusOnSerialShort")
1201 print $form->selectarray(
'search_tobatch', $statutarray, $search_tobatch);
1205 if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
1206 print
'<td class="liste_titre center">';
1207 print $form->select_country($search_country,
'search_country',
'', 0);
1211 if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
1212 print
'<td class="liste_titre center">';
1213 print $formcompany->select_state($search_state, $search_country);
1217 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
1218 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>';
1220 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
1221 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>';
1223 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
1224 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>';
1227 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
1228 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>';
1230 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
1231 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>';
1233 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
1234 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>';
1237 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1239 $parameters = array(
'arrayfields' => $arrayfields);
1240 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
1241 print $hookmanager->resPrint;
1243 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1244 print
'<td class="liste_titre">';
1248 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1249 print
'<td class="liste_titre">';
1252 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1253 print
'<td class="liste_titre center">';
1254 print
'<input class="flat maxwidth75" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1257 if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
1258 print
'<td class="liste_titre center parentonrightofpage">';
1259 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');
1262 if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
1263 print
'<td class="liste_titre center parentonrightofpage">';
1264 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');
1269 print
'<td class="liste_titre center maxwidthsearch">';
1270 $searchpicto = $form->showFilterButtons();
1276 $totalarray = array();
1277 $totalarray[
'nbfield'] = 0;
1281 print
'<tr class="liste_titre">';
1284 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1285 $totalarray[
'nbfield']++;
1287 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1288 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1289 $totalarray[
'nbfield']++;
1291 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1292 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1293 $totalarray[
'nbfield']++;
1295 if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
1296 print_liste_field_titre($arrayfields[
'pfp.ref_fourn'][
'label'], $_SERVER[
"PHP_SELF"],
"pfp.ref_fourn",
"", $param,
"", $sortfield, $sortorder);
1297 $totalarray[
'nbfield']++;
1299 if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
1300 print_liste_field_titre($arrayfields[
'thumbnail'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1301 $totalarray[
'nbfield']++;
1303 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1304 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
"p.label",
"", $param,
"", $sortfield, $sortorder);
1305 $totalarray[
'nbfield']++;
1307 if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
1308 print_liste_field_titre($arrayfields[
'p.fk_product_type'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_product_type",
"", $param,
"", $sortfield, $sortorder,
'center ');
1309 $totalarray[
'nbfield']++;
1311 if (!empty($arrayfields[
'p.description'][
'checked'])) {
1312 print_liste_field_titre($arrayfields[
'p.description'][
'label'], $_SERVER[
"PHP_SELF"],
"p.description",
"", $param,
"", $sortfield, $sortorder);
1313 $totalarray[
'nbfield']++;
1315 if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
1316 print_liste_field_titre($arrayfields[
'p.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"p.barcode",
"", $param,
"", $sortfield, $sortorder);
1317 $totalarray[
'nbfield']++;
1319 if (!empty($arrayfields[
'p.duration'][
'checked'])) {
1320 print_liste_field_titre($arrayfields[
'p.duration'][
'label'], $_SERVER[
"PHP_SELF"],
"p.duration",
"", $param,
'', $sortfield, $sortorder,
'center ');
1321 $totalarray[
'nbfield']++;
1323 if (!empty($arrayfields[
'pac.fk_product_parent'][
'checked'])) {
1324 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']);
1325 $totalarray[
'nbfield']++;
1327 if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1328 print_liste_field_titre($arrayfields[
'p.finished'][
'label'], $_SERVER[
"PHP_SELF"],
"p.finished",
"", $param,
'', $sortfield, $sortorder,
'center ');
1329 $totalarray[
'nbfield']++;
1331 if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1332 print_liste_field_titre($arrayfields[
'p.weight'][
'label'], $_SERVER[
'PHP_SELF'],
'p.weight',
'', $param,
'', $sortfield, $sortorder,
'center ');
1333 $totalarray[
'nbfield']++;
1335 if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1336 print_liste_field_titre($arrayfields[
'p.weight_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.weight_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1337 $totalarray[
'nbfield']++;
1339 if (!empty($arrayfields[
'p.length'][
'checked'])) {
1340 print_liste_field_titre($arrayfields[
'p.length'][
'label'], $_SERVER[
'PHP_SELF'],
'p.length',
'', $param,
'', $sortfield, $sortorder,
'center ');
1341 $totalarray[
'nbfield']++;
1343 if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1344 print_liste_field_titre($arrayfields[
'p.length_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.length_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1345 $totalarray[
'nbfield']++;
1347 if (!empty($arrayfields[
'p.width'][
'checked'])) {
1348 print_liste_field_titre($arrayfields[
'p.width'][
'label'], $_SERVER[
'PHP_SELF'],
'p.width',
'', $param,
'', $sortfield, $sortorder,
'center ');
1349 $totalarray[
'nbfield']++;
1351 if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1352 print_liste_field_titre($arrayfields[
'p.width_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.width_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1353 $totalarray[
'nbfield']++;
1355 if (!empty($arrayfields[
'p.height'][
'checked'])) {
1356 print_liste_field_titre($arrayfields[
'p.height'][
'label'], $_SERVER[
'PHP_SELF'],
'p.height',
'', $param,
'', $sortfield, $sortorder,
'center ');
1357 $totalarray[
'nbfield']++;
1359 if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1360 print_liste_field_titre($arrayfields[
'p.height_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.height_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1361 $totalarray[
'nbfield']++;
1363 if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1364 print_liste_field_titre($arrayfields[
'p.surface'][
'label'], $_SERVER[
'PHP_SELF'],
"p.surface",
'', $param,
'', $sortfield, $sortorder,
'center ');
1365 $totalarray[
'nbfield']++;
1367 if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1368 print_liste_field_titre($arrayfields[
'p.surface_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.surface_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1369 $totalarray[
'nbfield']++;
1371 if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'p.volume'][
'label'], $_SERVER[
'PHP_SELF'],
'p.volume',
'', $param,
'', $sortfield, $sortorder,
'center ');
1373 $totalarray[
'nbfield']++;
1375 if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1376 print_liste_field_titre($arrayfields[
'p.volume_units'][
'label'], $_SERVER[
'PHP_SELF'],
'p.volume_units',
'', $param,
'', $sortfield, $sortorder,
'center ');
1377 $totalarray[
'nbfield']++;
1379 if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1380 print_liste_field_titre($arrayfields[
'cu.label'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1381 $totalarray[
'nbfield']++;
1383 if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'p.fk_default_workstation'][
'label'], $_SERVER[
'PHP_SELF'],
'ws.ref',
'', $param,
'', $sortfield, $sortorder);
1385 $totalarray[
'nbfield']++;
1387 if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1388 print_liste_field_titre($arrayfields[
'p.sellprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1389 $totalarray[
'nbfield']++;
1394 foreach ($arraypricelevel as $key => $value) {
1395 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1396 print_liste_field_titre($arrayfields[
'p.sellprice'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1397 $totalarray[
'nbfield']++;
1402 if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
1403 print_liste_field_titre($arrayfields[
'p.minbuyprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1404 $totalarray[
'nbfield']++;
1406 if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
1407 print_liste_field_titre($arrayfields[
'p.numbuyprice'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1408 $totalarray[
'nbfield']++;
1410 if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
1411 print_liste_field_titre($arrayfields[
'p.tva_tx'][
'label'], $_SERVER[
"PHP_SELF"],
'p.tva_tx',
"", $param,
'', $sortfield, $sortorder,
'right ');
1412 $totalarray[
'nbfield']++;
1414 if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
1415 print_liste_field_titre($arrayfields[
'p.pmp'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1416 $totalarray[
'nbfield']++;
1418 if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
1419 print_liste_field_titre($arrayfields[
'p.cost_price'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1420 $totalarray[
'nbfield']++;
1422 if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
1423 print_liste_field_titre($arrayfields[
'p.seuil_stock_alerte'][
'label'], $_SERVER[
"PHP_SELF"],
"p.seuil_stock_alerte",
"", $param,
'', $sortfield, $sortorder,
'right ');
1424 $totalarray[
'nbfield']++;
1426 if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
1427 print_liste_field_titre($arrayfields[
'p.desiredstock'][
'label'], $_SERVER[
"PHP_SELF"],
"p.desiredstock",
"", $param,
'', $sortfield, $sortorder,
'right ');
1428 $totalarray[
'nbfield']++;
1430 if (!empty($arrayfields[
'p.stock'][
'checked'])) {
1431 print_liste_field_titre($arrayfields[
'p.stock'][
'label'], $_SERVER[
"PHP_SELF"],
"p.stock",
"", $param,
'', $sortfield, $sortorder,
'right ');
1432 $totalarray[
'nbfield']++;
1434 if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
1435 print_liste_field_titre($arrayfields[
'stock_virtual'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ',
'VirtualStockDesc');
1436 $totalarray[
'nbfield']++;
1438 if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
1439 print_liste_field_titre($arrayfields[
'p.tobatch'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tobatch",
"", $param,
'', $sortfield, $sortorder,
'center ');
1440 $totalarray[
'nbfield']++;
1442 if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
1443 print_liste_field_titre($arrayfields[
'p.fk_country'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_country",
"", $param,
'', $sortfield, $sortorder);
1444 $totalarray[
'nbfield']++;
1446 if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
1447 print_liste_field_titre($arrayfields[
'p.fk_state'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_state",
"", $param,
'', $sortfield, $sortorder);
1448 $totalarray[
'nbfield']++;
1450 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
1451 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_sell",
"", $param,
'', $sortfield, $sortorder);
1452 $totalarray[
'nbfield']++;
1454 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
1455 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);
1456 $totalarray[
'nbfield']++;
1458 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
1459 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);
1460 $totalarray[
'nbfield']++;
1462 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
1463 print_liste_field_titre($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'label'], $_SERVER[
"PHP_SELF"], $alias_product_perentity .
".accountancy_code_buy",
"", $param,
'', $sortfield, $sortorder);
1464 $totalarray[
'nbfield']++;
1466 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
1467 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);
1468 $totalarray[
'nbfield']++;
1470 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
1471 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);
1472 $totalarray[
'nbfield']++;
1475 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1477 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1478 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
1479 print $hookmanager->resPrint;
1480 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1481 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1482 $totalarray[
'nbfield']++;
1484 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1485 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1486 $totalarray[
'nbfield']++;
1488 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1489 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1490 $totalarray[
'nbfield']++;
1492 if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
1493 print_liste_field_titre($arrayfields[
'p.tosell'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tosell",
"", $param,
'', $sortfield, $sortorder,
'center ');
1494 $totalarray[
'nbfield']++;
1496 if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
1497 print_liste_field_titre($arrayfields[
'p.tobuy'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tobuy",
"", $param,
'', $sortfield, $sortorder,
'center ');
1498 $totalarray[
'nbfield']++;
1502 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1503 $totalarray[
'nbfield']++;
1511 $savnbfield = $totalarray[
'nbfield'];
1512 $totalarray = array();
1513 $totalarray[
'nbfield'] = 0;
1514 $imaxinloop = ($limit ? min($num, $limit) : $num);
1515 while ($i < $imaxinloop) {
1516 $obj = $db->fetch_object($resql);
1523 $sql =
"SELECT label";
1524 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
1525 $sql .=
" WHERE fk_product = ".((int) $obj->rowid);
1526 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
1529 $result = $db->query(
$sql);
1531 $objtp = $db->fetch_object($result);
1532 if (!empty($objtp->label)) {
1533 $obj->label = $objtp->label;
1538 $parameters = array(
'staticdata' => $obj);
1541 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $product_static, $action);
1542 if (empty($reshook)) {
1543 $product_static->id = $obj->rowid;
1544 $product_static->ref = $obj->ref;
1545 $product_static->description = $obj->description;
1546 $product_static->ref_fourn = empty($obj->ref_supplier) ?
'' : $obj->ref_supplier;
1547 $product_static->ref_supplier = empty($obj->ref_supplier) ?
'' : $obj->ref_supplier;
1548 $product_static->label = $obj->label;
1549 $product_static->barcode = $obj->barcode;
1550 $product_static->finished = $obj->finished;
1551 $product_static->type = $obj->fk_product_type;
1552 $product_static->status_buy = $obj->tobuy;
1553 $product_static->status = $obj->tosell;
1554 $product_static->status_batch = $obj->tobatch;
1555 $product_static->entity = $obj->entity;
1556 $product_static->pmp = $obj->pmp;
1557 $product_static->accountancy_code_sell = $obj->accountancy_code_sell;
1558 $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
1559 $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
1560 $product_static->accountancy_code_buy = $obj->accountancy_code_buy;
1561 $product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
1562 $product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
1563 $product_static->length = $obj->length;
1564 $product_static->length_units = $obj->length_units;
1565 $product_static->width = $obj->width;
1566 $product_static->width_units = $obj->width_units;
1567 $product_static->height = $obj->height;
1568 $product_static->height_units = $obj->height_units;
1569 $product_static->weight = $obj->weight;
1570 $product_static->weight_units = $obj->weight_units;
1571 $product_static->volume = $obj->volume;
1572 $product_static->volume_units = $obj->volume_units;
1573 $product_static->surface = $obj->surface;
1574 $product_static->surface_units = $obj->surface_units;
1576 $product_static->fk_unit = $obj->fk_unit;
1578 $product_static->import_key = $obj->import_key;
1583 $option =
'nobatch';
1584 if (empty($arrayfields[
'stock_virtual'][
'checked'])) {
1585 $option .=
',novirtual';
1587 $product_static->load_stock($option);
1592 $product_static->price = $obj->price;
1596 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_prices') : $user->hasRight(
'product',
'lire');
1597 if ($product_static->isService()) {
1598 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'lire');
1601 if ($mode ==
'kanban') {
1603 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1604 print
'<div class="box-flex-container kanban">';
1609 if ($massactionbutton || $massaction) {
1611 if (in_array(
$object->id, $arrayofselected)) {
1615 print
$object->getKanbanView(
'', array(
'selected' => $selected));
1616 if ($i == ($imaxinloop - 1)) {
1623 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1627 print
'<td class="nowrap center">';
1628 if ($massactionbutton || $massaction) {
1630 if (in_array(
$object->id, $arrayofselected)) {
1633 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1637 $totalarray[
'nbfield']++;
1641 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1642 print
'<td class="nowraponall">';
1643 print $product_static->id;
1646 $totalarray[
'nbfield']++;
1651 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1652 print
'<td class="tdoverflowmax250">';
1653 print $product_static->getNomUrl(1);
1656 $totalarray[
'nbfield']++;
1661 if (!empty($arrayfields[
'pfp.ref_fourn'][
'checked'])) {
1662 print
'<td class="tdoverflowmax200">';
1663 print $product_static->getNomUrl(1);
1666 $totalarray[
'nbfield']++;
1671 if (!empty($arrayfields[
'thumbnail'][
'checked'])) {
1672 $product_thumbnail_html =
'';
1673 if (!empty($product_static->entity)) {
1674 $product_thumbnail = $product_static->show_photos(
'product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
1675 if ($product_static->nbphoto > 0) {
1676 $product_thumbnail_html = $product_thumbnail;
1680 print
'<td class="center">' . $product_thumbnail_html .
'</td>';
1682 $totalarray[
'nbfield']++;
1687 if (!empty($arrayfields[
'p.label'][
'checked'])) {
1688 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($product_static->label).
'">'.$product_static->label.
'</td>';
1690 $totalarray[
'nbfield']++;
1695 if (!empty($arrayfields[
'p.fk_product_type'][
'checked'])) {
1696 print
'<td class="center">';
1698 if ($product_static->type == 0) {
1699 $s .=
img_picto($langs->trans(
"Product"),
'product',
'class="paddingleftonly paddingrightonly colorgrey"');
1701 $s .=
img_picto($langs->trans(
"Service"),
'service',
'class="paddingleftonly paddingrightonly colorgrey"');
1706 $totalarray[
'nbfield']++;
1711 if (!empty($arrayfields[
'p.description'][
'checked'])) {
1712 print
'<td class="left">';
1718 $totalarray[
'nbfield']++;
1723 if (!empty($arrayfields[
'p.barcode'][
'checked'])) {
1724 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($product_static->barcode).
'">'.
dol_escape_htmltag($product_static->barcode).
'</td>';
1726 $totalarray[
'nbfield']++;
1731 if (!empty($arrayfields[
'p.duration'][
'checked'])) {
1732 print
'<td class="center nowraponall">';
1734 if (preg_match(
'/([^a-z]+)[a-z]$/i', $obj->duration)) {
1735 $duration_value = substr($obj->duration, 0,
dol_strlen($obj->duration) - 1);
1736 $duration_unit = substr($obj->duration, -1);
1738 if ((
float) $duration_value > 1) {
1739 $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"));
1740 } elseif ((
float) $duration_value > 0) {
1741 $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"));
1743 print $duration_value;
1744 print((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value !=
'') ?
' '.$langs->trans($dur[$duration_unit]) :
'');
1745 } elseif (!preg_match(
'/^[a-z]$/i', $obj->duration)) {
1746 print $obj->duration;
1751 $totalarray[
'nbfield']++;
1755 if (!empty($arrayfields[
'pac.fk_product_parent'][
'checked'])) {
1756 print
'<td class="nowraponall">';
1757 if ($obj->fk_product_parent > 0) {
1758 if (!empty($conf->cache[
'product'][$obj->fk_product_parent])) {
1759 $product_parent_static = $conf->cache[
'product'][$obj->fk_product_parent];
1761 $product_parent_static =
new Product($db);
1762 $product_parent_static->fetch($obj->fk_product_parent);
1763 $conf->cache[
'product'][$obj->fk_product_parent] = $product_parent_static;
1765 print $product_parent_static->getNomUrl(1);
1769 $totalarray[
'nbfield']++;
1773 if (!empty($arrayfields[
'p.finished'][
'checked'])) {
1774 print
'<td class="center">';
1775 print $product_static->getLibFinished();
1778 $totalarray[
'nbfield']++;
1782 if (!empty($arrayfields[
'p.weight'][
'checked'])) {
1783 print
'<td class="center">';
1784 print $product_static->weight;
1787 $totalarray[
'nbfield']++;
1791 if (!empty($arrayfields[
'p.weight_units'][
'checked'])) {
1792 print
'<td class="center">';
1793 if ($product_static->weight !=
'') {
1798 $totalarray[
'nbfield']++;
1802 if (!empty($arrayfields[
'p.length'][
'checked'])) {
1803 print
'<td class="center">';
1804 print $product_static->length;
1807 $totalarray[
'nbfield']++;
1811 if (!empty($arrayfields[
'p.length_units'][
'checked'])) {
1812 print
'<td class="center">';
1813 if ($product_static->length !=
'') {
1818 $totalarray[
'nbfield']++;
1822 if (!empty($arrayfields[
'p.width'][
'checked'])) {
1823 print
'<td align="center">';
1824 print $product_static->width;
1827 $totalarray[
'nbfield']++;
1831 if (!empty($arrayfields[
'p.width_units'][
'checked'])) {
1832 print
'<td class="center">';
1833 if ($product_static->width !=
'') {
1838 $totalarray[
'nbfield']++;
1842 if (!empty($arrayfields[
'p.height'][
'checked'])) {
1843 print
'<td align="center">';
1844 print $product_static->height;
1847 $totalarray[
'nbfield']++;
1851 if (!empty($arrayfields[
'p.height_units'][
'checked'])) {
1852 print
'<td class="center">';
1853 if ($product_static->height !=
'') {
1858 $totalarray[
'nbfield']++;
1862 if (!empty($arrayfields[
'p.surface'][
'checked'])) {
1863 print
'<td class="center">';
1864 print $product_static->surface;
1867 $totalarray[
'nbfield']++;
1871 if (!empty($arrayfields[
'p.surface_units'][
'checked'])) {
1872 print
'<td class="center">';
1873 if ($product_static->surface !=
'') {
1878 $totalarray[
'nbfield']++;
1882 if (!empty($arrayfields[
'p.volume'][
'checked'])) {
1883 print
'<td class="center">';
1884 print $product_static->volume;
1887 $totalarray[
'nbfield']++;
1891 if (!empty($arrayfields[
'p.volume_units'][
'checked'])) {
1892 print
'<td class="center">';
1893 if ($product_static->volume !=
'') {
1898 $totalarray[
'nbfield']++;
1902 if (!empty($arrayfields[
'cu.label'][
'checked'])) {
1903 print
'<td align="center">';
1904 if (!empty($obj->cu_label)) {
1905 print $langs->trans($obj->cu_label);
1909 $totalarray[
'nbfield']++;
1914 if (!empty($arrayfields[
'p.fk_default_workstation'][
'checked'])) {
1915 print
'<td align="left">';
1916 if (
isModEnabled(
'workstation') && !empty($obj->fk_default_workstation)) {
1917 $workstation_static->id = $obj->fk_default_workstation;
1918 $workstation_static->ref = $obj->ref_workstation;
1919 $workstation_static->status = $obj->status_workstation;
1921 print $workstation_static->getNomUrl(1);
1925 $totalarray[
'nbfield']++;
1930 if (!empty($arrayfields[
'p.sellprice'][
'checked'])) {
1931 print
'<td class="right nowraponall">';
1932 if ($product_static->status && $usercancreadprice) {
1933 if ($obj->price_base_type ==
'TTC') {
1934 print
'<span class="amount">'.price($obj->price_ttc).
' '.$langs->trans(
"TTC").
'</span>';
1936 print
'<span class="amount">'.price($obj->price).
' '.$langs->trans(
"HT").
'</span>';
1941 $totalarray[
'nbfield']++;
1947 if (! isset($productpricescache)) {
1948 $productpricescache = array();
1950 if (! isset($productpricescache[$obj->rowid])) {
1951 $productpricescache[$obj->rowid] = array();
1954 if ($product_static->status && $usercancreadprice) {
1957 $sqlp =
"SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price, p.price_base_type";
1958 $sqlp .=
" FROM ".MAIN_DB_PREFIX.
"product_price as p";
1959 $sqlp .=
" WHERE fk_product = ".((int) $obj->rowid);
1960 $sqlp .=
" ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC";
1961 $resultp = $db->query($sqlp);
1963 $nump = $db->num_rows($resultp);
1965 while ($j < $nump) {
1966 $objp = $db->fetch_object($resultp);
1968 if (empty($productpricescache[$obj->rowid][$objp->price_level])) {
1969 $productpricescache[$obj->rowid][$objp->price_level][
'price'] = $objp->price;
1970 $productpricescache[$obj->rowid][$objp->price_level][
'price_ttc'] = $objp->price_ttc;
1971 $productpricescache[$obj->rowid][$objp->price_level][
'price_base_type'] = $objp->price_base_type;
1977 $db->free($resultp);
1983 foreach ($arraypricelevel as $key => $value) {
1984 if (!empty($arrayfields[
'p.sellprice'.$key][
'checked'])) {
1985 print
'<td class="right nowraponall">';
1986 if (!empty($productpricescache[$obj->rowid])) {
1987 if ($productpricescache[$obj->rowid][$key][
'price_base_type'] ==
'TTC') {
1988 print
'<span class="amount">'.price($productpricescache[$obj->rowid][$key][
'price_ttc']).
' '.$langs->trans(
"TTC").
'</span>';
1990 print
'<span class="amount">'.price($productpricescache[$obj->rowid][$key][
'price']).
' '.$langs->trans(
"HT").
'</span>';
1995 $totalarray[
'nbfield']++;
2002 if (!empty($arrayfields[
'p.minbuyprice'][
'checked'])) {
2003 print
'<td class="right nowraponall">';
2004 if ($product_static->status_buy && $obj->bestpurchaseprice !=
'' && $usercancreadprice) {
2005 if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) {
2006 if ($product_fourn->product_fourn_price_id > 0) {
2007 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'))) {
2008 $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
2009 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>';
2011 print
'<span class="amount">'.price($product_fourn->fourn_unitprice).
' '.$langs->trans(
"HT").
'</span>';
2018 $totalarray[
'nbfield']++;
2023 if (!empty($arrayfields[
'p.numbuyprice'][
'checked'])) {
2024 print
'<td class="right">';
2025 if ($product_static->status_buy && $usercancreadprice) {
2026 if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) {
2027 $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList);
2028 print $form->textwithpicto(count($productFournList), $htmltext);
2033 $totalarray[
'nbfield']++;
2038 if (!empty($arrayfields[
'p.tva_tx'][
'checked'])) {
2039 print
'<td class="right">';
2040 print
vatrate($obj->tva_tx,
true);
2043 $totalarray[
'nbfield']++;
2048 if (!empty($arrayfields[
'p.pmp'][
'checked'])) {
2049 print
'<td class="nowrap right">';
2050 if ($usercancreadprice) {
2051 print
'<span class="amount">'.price($product_static->pmp, 1, $langs).
"</span>";
2055 $totalarray[
'nbfield']++;
2059 if (!empty($arrayfields[
'p.cost_price'][
'checked'])) {
2060 print
'<td class="nowrap right">';
2062 if ($usercancreadprice) {
2063 print
'<span class="amount">'.price($obj->cost_price).
' '.$langs->trans(
"HT").
'</span>';
2067 $totalarray[
'nbfield']++;
2072 if (!empty($arrayfields[
'p.seuil_stock_alerte'][
'checked'])) {
2073 print
'<td class="right">';
2074 if ($product_static->type != 1) {
2075 print $obj->seuil_stock_alerte;
2079 $totalarray[
'nbfield']++;
2083 if (!empty($arrayfields[
'p.desiredstock'][
'checked'])) {
2084 print
'<td class="right">';
2085 if ($product_static->type != 1) {
2086 print $obj->desiredstock;
2090 $totalarray[
'nbfield']++;
2094 if (!empty($arrayfields[
'p.stock'][
'checked'])) {
2095 print
'<td class="right">';
2096 if ($product_static->type != 1) {
2097 if ($obj->seuil_stock_alerte !=
'' && $product_static->stock_reel < (
float) $obj->seuil_stock_alerte) {
2098 print
img_warning($langs->trans(
"StockLowerThanLimit", $obj->seuil_stock_alerte)).
' ';
2100 if ($usercancreadprice) {
2101 if ($product_static->stock_reel < 0) {
2102 print
'<span class="warning">';
2104 print
price(
price2num($product_static->stock_reel,
'MS'), 0, $langs, 1, 0);
2105 if ($product_static->stock_reel < 0) {
2112 $totalarray[
'nbfield']++;
2116 if (!empty($arrayfields[
'stock_virtual'][
'checked'])) {
2117 print
'<td class="right">';
2118 if ($product_static->type != 1) {
2119 if ($obj->seuil_stock_alerte !=
'' && $product_static->stock_theorique < (
float) $obj->seuil_stock_alerte) {
2120 print
img_warning($langs->trans(
"StockLowerThanLimit", $obj->seuil_stock_alerte)).
' ';
2122 if ($usercancreadprice) {
2123 if ($product_static->stock_theorique < 0) {
2124 print
'<span class="warning">';
2126 print
price(
price2num($product_static->stock_theorique,
'MS'), 0, $langs, 1, 0);
2127 if ($product_static->stock_theorique < 0) {
2134 $totalarray[
'nbfield']++;
2138 if (!empty($arrayfields[
'p.tobatch'][
'checked'])) {
2139 print
'<td class="center">';
2140 print $product_static->getLibStatut(1, 2);
2143 $totalarray[
'nbfield']++;
2147 if (!empty($arrayfields[
'p.fk_country'][
'checked'])) {
2148 print
'<td>'.getCountry($obj->fk_country, 0, $db).
'</td>';
2150 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
'p.fk_state'][
'checked'])) {
2156 if (!empty($obj->fk_state)) {
2157 print
getState($obj->fk_state, 0, $db);
2161 $totalarray[
'nbfield']++;
2165 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell'][
'checked'])) {
2166 print
'<td>'.length_accountg($product_static->accountancy_code_sell).
'</td>';
2168 $totalarray[
'nbfield']++;
2171 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_intra'][
'checked'])) {
2172 print
'<td>'.length_accountg($product_static->accountancy_code_sell_intra).
'</td>';
2174 $totalarray[
'nbfield']++;
2177 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_sell_export'][
'checked'])) {
2178 print
'<td>'.length_accountg($product_static->accountancy_code_sell_export).
'</td>';
2180 $totalarray[
'nbfield']++;
2184 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy'][
'checked'])) {
2185 print
'<td>'.length_accountg($product_static->accountancy_code_buy).
'</td>';
2187 $totalarray[
'nbfield']++;
2190 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_intra'][
'checked'])) {
2191 print
'<td>'.length_accountg($product_static->accountancy_code_buy_intra).
'</td>';
2193 $totalarray[
'nbfield']++;
2196 if (!empty($arrayfields[$alias_product_perentity .
'.accountancy_code_buy_export'][
'checked'])) {
2197 print
'<td>'.length_accountg($product_static->accountancy_code_buy_export).
'</td>';
2199 $totalarray[
'nbfield']++;
2203 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2205 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2206 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
2207 print $hookmanager->resPrint;
2209 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2210 print
'<td class="center nowraponall">';
2211 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2214 $totalarray[
'nbfield']++;
2218 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2219 print
'<td class="center nowraponall">';
2220 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2223 $totalarray[
'nbfield']++;
2228 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
2229 print
'<td class="center nowrap">';
2233 $totalarray[
'nbfield']++;
2238 if (!empty($arrayfields[
'p.tosell'][
'checked'])) {
2239 print
'<td class="center nowrap">';
2240 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
"produit",
"creer") &&
getDolGlobalString(
'MAIN_DIRECT_STATUS_UPDATE')) {
2241 print
ajax_object_onoff($product_static,
'status',
'tosell',
'ProductStatusOnSell',
'ProductStatusNotOnSell');
2243 print $product_static->LibStatut($product_static->status, 5, 0);
2247 $totalarray[
'nbfield']++;
2251 if (!empty($arrayfields[
'p.tobuy'][
'checked'])) {
2252 print
'<td class="center nowrap">';
2253 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
"produit",
"creer") &&
getDolGlobalString(
'MAIN_DIRECT_STATUS_UPDATE')) {
2254 print
ajax_object_onoff($product_static,
'status_buy',
'tobuy',
'ProductStatusOnBuy',
'ProductStatusNotOnBuy');
2256 print $product_static->LibStatut($product_static->status_buy, 5, 1);
2260 $totalarray[
'nbfield']++;
2266 print
'<td class="nowrap center">';
2267 if ($massactionbutton || $massaction) {
2269 if (in_array(
$object->id, $arrayofselected)) {
2272 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2276 $totalarray[
'nbfield']++;
2289 foreach ($arrayfields as $key => $val) {
2290 if (!empty($val[
'checked'])) {
2294 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2299 print
'</table>'.
"\n";
2300 print
'</div>'.
"\n";
2302 print
'</form>'.
"\n";
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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='0', $dbtouse=null, $withregion=0, $outputlangs=null, $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('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('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') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted 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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
print_barre_liste($title, $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.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.