47require
'../main.inc.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/genericobject.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/modules/product/modules_product.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
67if (isModEnabled(
'propal')) {
68 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
70if (isModEnabled(
'invoice')) {
71 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
73if (isModEnabled(
'order')) {
74 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
76if (isModEnabled(
'accounting')) {
77 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
78 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
79 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
81if (isModEnabled(
'bom')) {
82 require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
85if (isModEnabled(
'workstation')) {
86 require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
90$langs->loadLangs(array(
'products',
'other'));
91if (isModEnabled(
'stock')) {
92 $langs->load(
"stocks");
94if (isModEnabled(
'invoice')) {
95 $langs->load(
"bills");
97if (isModEnabled(
'productbatch')) {
98 $langs->load(
"productbatch");
101$backtopageforcancel =
GETPOST(
'backtopageforcancel');
107$refalreadyexists = 0;
113 $ref = (GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'nohtml') : null);
115 $ref = (GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alpha') : null);
118$action = (
GETPOST(
'action',
'alpha') ?
GETPOST(
'action',
'alpha') :
'view');
119$cancel =
GETPOST(
'cancel',
'alpha');
120$backtopage =
GETPOST(
'backtopage',
'alpha');
121$confirm =
GETPOST(
'confirm',
'alpha');
123$duration_value =
GETPOST(
'duration_value');
124$duration_unit =
GETPOST(
'duration_unit',
'alpha');
126$accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
127$accountancy_code_sell_intra =
GETPOST(
'accountancy_code_sell_intra',
'alpha');
128$accountancy_code_sell_export =
GETPOST(
'accountancy_code_sell_export',
'alpha');
129$accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
130$accountancy_code_buy_intra =
GETPOST(
'accountancy_code_buy_intra',
'alpha');
131$accountancy_code_buy_export =
GETPOST(
'accountancy_code_buy_export',
'alpha');
133$checkmandatory =
GETPOST(
'accountancy_code_buy_export',
'alpha');
137 $label_security_check =
'nohtml';
139 $label_security_check = !
getDolGlobalString(
'MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML') ?
'alphanohtml' :
'restricthtml';
142if (!empty($user->socid)) {
143 $socid = $user->socid;
148if (substr($module, 0, 16) ==
'mod_codeproduct_' && substr($module, -3) ==
'php') {
149 $module = substr($module, 0,
dol_strlen($module) - 4);
153 $modCodeProduct =
new $module();
161$extrafields->fetch_name_optionals_label(
$object->table_element);
163if ($id > 0 || !empty($ref)) {
164 $result =
$object->fetch($id, (
string) $ref);
169 if (isModEnabled(
"product")) {
170 $upload_dir =
$conf->product->multidir_output[$entity].
'/'.
get_exdir(0, 0, 0, 0,
$object,
'product').dol_sanitizeFileName(
$object->ref);
171 } elseif (isModEnabled(
"service")) {
172 $upload_dir =
$conf->service->multidir_output[$entity].
'/'.
get_exdir(0, 0, 0, 0,
$object,
'product').dol_sanitizeFileName(
$object->ref);
176 if (isModEnabled(
"product")) {
177 $upload_dirold =
$conf->product->multidir_output[$entity].
'/'.substr(substr(
"000".
$object->id, -2), 1, 1).
'/'.substr(substr(
"000".
$object->id, -2), 0, 1).
'/'.
$object->id.
"/photos";
179 $upload_dirold =
$conf->service->multidir_output[$entity].
'/'.substr(substr(
"000".
$object->id, -2), 1, 1).
'/'.substr(substr(
"000".
$object->id, -2), 0, 1).
'/'.
$object->id.
"/photos";
184$modulepart =
'product';
189if (!empty($canvas)) {
190 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
191 $objcanvas =
new Canvas($db, $action);
192 $objcanvas->getCanvas(
'product',
'card', $canvas);
196$fieldvalue = (!empty($id) ?
$id : (!empty($ref) ? $ref :
''));
197$fieldtype = (!empty($id) ?
'rowid' :
'ref');
200$hookmanager->initHooks(array(
'productcard',
'globalcard'));
203 if (
$object->type == $object::TYPE_PRODUCT) {
206 if (
$object->type == $object::TYPE_SERVICE) {
210 restrictedArea($user,
'produit|service', 0,
'product&product',
'',
'', $fieldtype);
217$permissiontoeditextra = $usercancreate;
218if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
220 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
232$createbarcode = isModEnabled(
'barcode');
233if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'creer_advance')) {
237$parameters = array(
'id' => $id,
'ref' => $ref,
'objcanvas' => $objcanvas);
238$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
243if (empty($reshook)) {
244 $backurlforlist = DOL_URL_ROOT.
'/product/list.php?type='.$type;
246 if (empty($backtopage) || ($cancel && empty($id))) {
247 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
248 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
249 $backtopage = $backurlforlist;
251 $backtopage = DOL_URL_ROOT.
'/product/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
257 if (!empty($backtopageforcancel)) {
258 header(
"Location: ".$backtopageforcancel);
260 } elseif (!empty($backtopage)) {
261 header(
"Location: ".$backtopage);
267 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
269 $productOriginId =
GETPOSTINT(
'product_origin');
270 $productOrigin =
new Product($db);
272 if ($productOriginId <= 0) {
273 $langs->load(
'errors');
274 setEventMessages($langs->trans(
'ErrorProductIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginProduct')),
null,
'errors');
276 if (!$error && $productOrigin->fetch($productOriginId) < 1) {
286 $listofproperties = array(
296 'accountancy_code_buy',
297 'accountancy_code_buy_intra',
298 'accountancy_code_buy_export',
299 'accountancy_code_sell',
300 'accountancy_code_sell_intra',
301 'accountancy_code_sell_export'
303 foreach ($listofproperties as $property) {
304 if (empty(
$object->$property)) {
305 $object->$property = $productOrigin->$property;
309 $listofproperties = array(
310 'note_public',
'note_private'
312 foreach ($listofproperties as $property) {
317 if (is_array($productOrigin->array_options)) {
318 foreach ($productOrigin->array_options as $key => $val) {
319 if (empty(
$object->array_options[$key])) {
320 $object->array_options[$key] = $val;
327 $custcats_ori = $static_cat->containing($productOrigin->id,
'product',
'id');
328 $custcats = $static_cat->containing(
$object->id,
'product',
'id');
329 $custcats = array_merge($custcats, $custcats_ori);
330 $object->setCategories($custcats);
333 if ($productOrigin->barcode ==
$object->barcode) {
334 dol_syslog(
"We clean customer and supplier code so we will be able to make the update of target");
335 $productOrigin->barcode =
'';
351 'ActionComm' =>
'/comm/action/class/actioncomm.class.php',
352 'Bom' =>
'/bom/class/bom.class.php',
355 'Commande' =>
'/commande/class/commande.class.php',
356 'CommandeFournisseur' =>
'/fourn/class/fournisseur.commande.class.php',
357 'Contrat' =>
'/contrat/class/contrat.class.php',
358 'Delivery' =>
'/delivery/class/delivery.class.php',
359 'Facture' =>
'/compta/facture/class/facture.class.php',
360 'FactureFournisseur' =>
'/fourn/class/fournisseur.facture.class.php',
361 'FactureRec' =>
'/compta/facture/class/facture-rec.class.php',
362 'FichinterRec' =>
'/fichinter/class/fichinterrec.class.php',
363 'ProductFournisseur' =>
'/fourn/class/fournisseur.product.class.php',
364 'Propal' =>
'/comm/propal/class/propal.class.php',
365 'Reception' =>
'/reception/class/reception.class.php',
366 'SupplierProposal' =>
'/supplier_proposal/class/supplier_proposal.class.php',
370 foreach ($objects as $object_name => $object_file) {
371 require_once DOL_DOCUMENT_ROOT.$object_file;
373 if (!$error && !$object_name::replaceProduct($db, $productOrigin->id,
$object->id)) {
383 $parameters = array(
'soc_origin' => $productOrigin->id,
'soc_dest' =>
$object->id);
384 $reshook = $hookmanager->executeHooks(
401 'mergefromid' => $productOrigin->id,
405 $result =
$object->call_trigger(
'PRODUCT_MODIFY', $user);
415 if ($productOrigin->delete($user) < 1) {
422 if (!empty(
$conf->product->multidir_output[$productOrigin->entity])) {
423 $srcdir =
$conf->product->multidir_output[$productOrigin->entity].
"/".$productOrigin->ref;
428 foreach ($dirlist as $filetomove) {
429 $destfile = $destdir.
'/'.$filetomove[
'relativename'];
431 dol_move($filetomove[
'fullname'], $destfile,
'0', 0, 0, 1);
442 $langs->load(
"errors");
451 if ($action ==
'setfk_product_type' && $usercancreate) {
452 $result =
$object->setValueFrom(
'fk_product_type',
GETPOST(
'fk_product_type'),
'',
null,
'text',
'', $user,
'PRODUCT_MODIFY');
453 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
458 $upload_dir =
$conf->product->dir_output;
459 $permissiontoadd = $usercancreate;
460 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
462 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
465 if ($action ==
'setfk_barcode_type' && $usercancreate) {
466 $result =
$object->setValueFrom(
'fk_barcode_type',
GETPOST(
'fk_barcode_type'),
'',
null,
'text',
'', $user,
'PRODUCT_MODIFY');
467 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
472 if ($action ==
'setbarcode' && $usercancreate) {
476 $result =
$object->setValueFrom(
'barcode',
GETPOST(
'barcode'),
'',
null,
'text',
'', $user,
'PRODUCT_MODIFY');
477 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
480 $langs->load(
"errors");
482 $errors[] =
'ErrorBadBarCodeSyntax';
483 } elseif ($result == -2) {
484 $errors[] =
'ErrorBarCodeRequired';
485 } elseif ($result == -3) {
486 $errors[] =
'ErrorBarCodeAlreadyUsed';
488 $errors[] =
'FailedToValidateBarCode';
497 if ($action ==
'update_extras' && $permissiontoeditextra) {
501 $attribute_name =
GETPOST(
'attribute',
'aZ09');
504 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
510 $result =
$object->updateExtraField($attribute_name,
'PRODUCT_MODIFY');
518 $action =
'edit_extras';
523 if ($action ==
'add' && $usercancreate) {
526 if (!
GETPOST(
'label', $label_security_check)) {
527 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentities(
'Label')),
null,
'errors');
533 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentities(
'ProductRef')),
null,
'errors');
538 if (!empty($duration_value) && empty($duration_unit)) {
539 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentities(
'Unit')),
null,
'errors');
543 $stockable_product = (int) ($type == 0 || ($type == 1 &&
getDolGlobalInt(
'STOCK_SUPPORTS_SERVICES')));
544 if (
GETPOST(
'status_batch') && $stockable_product == 0 && isModEnabled(
'stock') && isModEnabled(
'productbatch')) {
545 setEventMessages($langs->trans(
'ErrorBatchesNeedStockManagement'),
null,
'errors');
557 $object->mandatory_period = empty(
GETPOST(
"mandatoryperiod",
'alpha')) ? 0 : 1;
558 if (
$object->price_base_type ==
'TTC') {
563 if (
$object->price_base_type ==
'TTC') {
569 $tva_tx_txt =
GETPOST(
'tva_tx',
'alpha');
573 $tva_tx = preg_replace(
'/[^0-9\.].*$/',
'', $tva_tx_txt);
574 $npr = preg_match(
'/\*/', $tva_tx_txt) ? 1 : 0;
577 $localtax1_type =
'0';
578 $localtax2_type =
'0';
581 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
583 $vatratecode = $reg[1];
585 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
586 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
587 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code).
"'";
588 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
589 $sql .=
" AND t.code = '".$db->escape($vatratecode).
"'";
590 $sql .=
" AND t.entity IN (".getEntity(
'c_tva').
")";
591 $resql = $db->query($sql);
593 $obj = $db->fetch_object($resql);
594 $npr = $obj->recuperableonly;
595 $localtax1 = $obj->localtax1;
596 $localtax2 = $obj->localtax2;
597 $localtax1_type = $obj->localtax1_type;
598 $localtax2_type = $obj->localtax2_type;
602 $object->default_vat_code = $vatratecode;
605 $object->localtax1_tx = $localtax1;
606 $object->localtax2_tx = $localtax2;
607 $object->localtax1_type = $localtax1_type;
608 $object->localtax2_type = $localtax2_type;
621 $stdobject->element =
'product';
622 $stdobject->barcode_type =
GETPOSTINT(
'fk_barcode_type');
623 $result = $stdobject->fetchBarCode();
626 $mesg =
'Failed to get bar code type information ';
629 $object->barcode_type_code = $stdobject->barcode_type_code;
630 $object->barcode_type_coder = $stdobject->barcode_type_coder;
631 $object->barcode_type_label = $stdobject->barcode_type_label;
642 $object->duration_value = $duration_value;
643 $object->duration_unit = $duration_unit;
662 if ($finished >= 0) {
675 $object->stockable_product = $stockable_product;
677 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
678 $accountancy_code_sell_intra =
GETPOST(
'accountancy_code_sell_intra',
'alpha');
679 $accountancy_code_sell_export =
GETPOST(
'accountancy_code_sell_export',
'alpha');
680 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
681 $accountancy_code_buy_intra =
GETPOST(
'accountancy_code_buy_intra',
'alpha');
682 $accountancy_code_buy_export =
GETPOST(
'accountancy_code_buy_export',
'alpha');
684 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
685 $object->accountancy_code_sell =
'';
687 $object->accountancy_code_sell = $accountancy_code_sell;
689 if (empty($accountancy_code_sell_intra) || $accountancy_code_sell_intra ==
'-1') {
690 $object->accountancy_code_sell_intra =
'';
692 $object->accountancy_code_sell_intra = $accountancy_code_sell_intra;
694 if (empty($accountancy_code_sell_export) || $accountancy_code_sell_export ==
'-1') {
695 $object->accountancy_code_sell_export =
'';
697 $object->accountancy_code_sell_export = $accountancy_code_sell_export;
699 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
700 $object->accountancy_code_buy =
'';
702 $object->accountancy_code_buy = $accountancy_code_buy;
704 if (empty($accountancy_code_buy_intra) || $accountancy_code_buy_intra ==
'-1') {
705 $object->accountancy_code_buy_intra =
'';
707 $object->accountancy_code_buy_intra = $accountancy_code_buy_intra;
709 if (empty($accountancy_code_buy_export) || $accountancy_code_buy_export ==
'-1') {
710 $object->accountancy_code_buy_export =
'';
712 $object->accountancy_code_buy_export = $accountancy_code_buy_export;
718 for ($i = 2; $i <= $produit_multiprices_limit; $i++) {
719 if (GETPOSTISSET(
"price_".$i)) {
721 $object->multiprices_base_type[
"$i"] =
GETPOST(
"multiprices_base_type_".$i);
723 $object->multiprices[
"$i"] =
"";
729 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
736 '@phan-var ModeleProductCode $modCodeProduct';
737 $ref = $modCodeProduct->getNextValue(
$object, $type);
746 $categories =
GETPOST(
'categories',
'array');
747 $object->setCategories($categories);
749 if (!empty($backtopage)) {
750 $backtopage = preg_replace(
'/__ID__/', (
string)
$object->id, $backtopage);
751 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
752 if (preg_match(
'/\?/', $backtopage)) {
753 $backtopage .=
'&productid='.$object->id;
756 header(
"Location: ".$backtopage);
759 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$id);
766 if (
$object->error ==
'ErrorProductAlreadyExists') {
768 $reshook = $hookmanager->executeHooks(
'onProductAlreadyExists', $parameters,
$object, $action);
787 if ($action ==
'update' && $usercancreate) {
788 if (
GETPOST(
'cancel',
'alpha')) {
844 if ($finished >= 0) {
850 $fk_default_bom =
GETPOSTINT(
'fk_default_bom');
851 if ($fk_default_bom >= 0) {
852 $object->fk_default_bom = $fk_default_bom;
858 $object->stockable_product = (int) GETPOSTISSET(
'stockable_product');
859 if (
$object->status_batch > 0 &&
$object->stockable_product == 0 && isModEnabled(
'stock') && isModEnabled(
'productbatch')) {
860 $object->stockable_product = 1;
861 setEventMessages($langs->trans(
'ForceBatchesNeedStockManagement'),
null,
'warnings');
875 $stdobject->element =
'product';
876 $stdobject->barcode_type =
GETPOSTINT(
'fk_barcode_type');
877 $result = $stdobject->fetchBarCode();
880 $mesg =
'Failed to get bar code type information ';
883 $object->barcode_type_code = $stdobject->barcode_type_code;
884 $object->barcode_type_coder = $stdobject->barcode_type_coder;
885 $object->barcode_type_label = $stdobject->barcode_type_label;
887 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
888 $accountancy_code_sell_intra =
GETPOST(
'accountancy_code_sell_intra',
'alpha');
889 $accountancy_code_sell_export =
GETPOST(
'accountancy_code_sell_export',
'alpha');
890 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
891 $accountancy_code_buy_intra =
GETPOST(
'accountancy_code_buy_intra',
'alpha');
892 $accountancy_code_buy_export =
GETPOST(
'accountancy_code_buy_export',
'alpha');
893 $checkmandatory =
GETPOST(
'mandatoryperiod',
'alpha');
894 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
895 $object->accountancy_code_sell =
'';
897 $object->accountancy_code_sell = $accountancy_code_sell;
899 if (empty($accountancy_code_sell_intra) || $accountancy_code_sell_intra ==
'-1') {
900 $object->accountancy_code_sell_intra =
'';
902 $object->accountancy_code_sell_intra = $accountancy_code_sell_intra;
904 if (empty($accountancy_code_sell_export) || $accountancy_code_sell_export ==
'-1') {
905 $object->accountancy_code_sell_export =
'';
907 $object->accountancy_code_sell_export = $accountancy_code_sell_export;
909 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
910 $object->accountancy_code_buy =
'';
912 $object->accountancy_code_buy = $accountancy_code_buy;
914 if (empty($accountancy_code_buy_intra) || $accountancy_code_buy_intra ==
'-1') {
915 $object->accountancy_code_buy_intra =
'';
917 $object->accountancy_code_buy_intra = $accountancy_code_buy_intra;
919 if (empty($accountancy_code_buy_export) || $accountancy_code_buy_export ==
'-1') {
920 $object->accountancy_code_buy_export =
'';
922 $object->accountancy_code_buy_export = $accountancy_code_buy_export;
925 $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ;
930 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
935 if (!$error &&
$object->check()) {
938 $categories =
GETPOST(
'categories',
'array');
939 $object->setCategories($categories);
954 setEventMessages($langs->trans(
"ErrorProductBadRefOrLabel"),
null,
'errors');
963 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
966 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $usercancreate) {
977 $clone->ref =
GETPOST(
'clone_ref',
'alphanohtml');
979 $clone->status_buy = 0;
980 $clone->barcode = -1;
982 if ($clone->check()) {
985 $clone->context[
'createfromclone'] =
'createfromclone';
986 $id = $clone->create($user);
988 if (
GETPOST(
'clone_composition')) {
989 $result = $clone->clone_associations(
$object->id, $id);
997 if (!$error &&
GETPOST(
'clone_categories')) {
998 $result = $clone->cloneCategories(
$object->id, $id);
1006 if (!$error &&
GETPOST(
'clone_prices')) {
1007 $result = $clone->clone_price(
$object->id, $id);
1015 if (!$error && isModEnabled(
'bom') && $user->hasRight(
'bom',
'write')) {
1018 $bomstatic =
new BOM($db);
1019 $bomclone = $bomstatic->createFromClone($user,
$object->fk_default_bom);
1020 if ((
int) $bomclone < 0) {
1021 setEventMessages($langs->trans(
'ErrorProductClone').
' : '.$langs->trans(
'ErrorProductCloneBom'),
null,
'warnings');
1023 $defbomidac =
$object->fk_default_bom;
1024 $clone->fk_default_bom = $bomclone->id;
1025 $clone->update($id, $user);
1026 $bomclone->fk_product =
$id;
1027 $bomclone->label = $langs->trans(
'BOMofRef', $clone->ref);
1028 $bomclone->update($user);
1029 $bomclone->validate($user);
1032 if (
GETPOST(
'clone_otherboms')) {
1033 $bomstatic =
new BOM($db);
1034 $bomlist = $bomstatic->fetchAll(
"",
"", 0, 0,
'fk_product:=:'.(
int)
$object->id);
1035 if (is_array($bomlist)) {
1036 foreach ($bomlist as $bom2clone) {
1037 if ($bom2clone->id != $defbomidac) {
1038 $bomclone = $bomstatic->createFromClone($user, $bom2clone->id);
1039 if ((
int) $bomclone < 0) {
1040 setEventMessages($langs->trans(
'ErrorProductClone').
' : '.$langs->trans(
'ErrorProductCloneBom'),
null,
'warnings');
1042 $bomclone->fk_product =
$id;
1043 $bomclone->label = $langs->trans(
'BOMofRef', $clone->ref);
1044 $bomclone->update($user);
1045 $bomclone->validate($user);
1054 if ($clone->error ==
'ErrorProductAlreadyExists') {
1055 $refalreadyexists++;
1058 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
1059 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
1062 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
1067 unset($clone->context[
'createfromclone']);
1074 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
1078 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
1088 if ($action ==
'confirm_delete' && $confirm !=
'yes') {
1091 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $usercandelete) {
1092 $result =
$object->delete($user);
1095 header(
'Location: '.DOL_URL_ROOT.
'/product/list.php?type='.
$object->type.
'&delprod='.urlencode(
$object->ref));
1106 if (
$object->id > 0 && $action ==
'addin') {
1108 $permissiontoaddline =
false;
1115 $propal =
new Propal($db);
1116 $result = $propal->fetch(
GETPOSTINT(
'propalid'));
1121 $thirdpartyid = $propal->socid;
1122 $permissiontoaddline = $user->hasRight(
'propal',
'creer');
1125 $result = $commande->fetch(
GETPOSTINT(
'commandeid'));
1130 $thirdpartyid = $commande->socid;
1131 $permissiontoaddline = $user->hasRight(
'commande',
'creer');
1134 $result = $facture->fetch(
GETPOSTINT(
'factureid'));
1139 $thirdpartyid = $facture->socid;
1140 $permissiontoaddline = $user->hasRight(
'facture',
'creer');
1143 if ($thirdpartyid > 0) {
1145 $result = $soc->fetch($thirdpartyid);
1155 if (empty($tva_tx)) {
1158 $localtax1_tx =
get_localtax($tva_tx, 1, $soc, $mysoc, $tva_npr);
1159 $localtax2_tx =
get_localtax($tva_tx, 2, $soc, $mysoc, $tva_npr);
1163 $price_base_type =
$object->price_base_type;
1167 $pu_ht =
$object->multiprices[$soc->price_level];
1168 $pu_ttc =
$object->multiprices_ttc[$soc->price_level];
1169 $price_base_type =
$object->multiprices_base_type[$soc->price_level];
1171 require_once DOL_DOCUMENT_ROOT.
'/product/class/productcustomerprice.class.php';
1175 $filter = array(
't.fk_product' => (
string)
$object->id,
't.fk_soc' => (
string) $soc->id);
1177 $result = $prodcustprice->fetchAll(
'',
'', 0, 0, $filter);
1179 if (count($prodcustprice->lines) > 0) {
1180 $date_now = (int) floor(
dol_now() / 86400) * 86400;
1181 foreach ($prodcustprice->lines as $k => $custprice_line) {
1182 if ($custprice_line->date_begin <= $date_now && (empty($custprice_line->date_end) || $date_now <= $custprice_line->date_end)) {
1183 $pu_ht =
price($custprice_line->price);
1184 $pu_ttc =
price($custprice_line->price_ttc);
1185 $price_base_type = $custprice_line->price_base_type;
1186 $tva_tx = $custprice_line->tva_tx;
1194 $tmpvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'', $tva_tx));
1195 $tmpprodvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'',
$object->tva_tx));
1199 if ($tmpvat != $tmpprodvat) {
1200 if ($price_base_type !=
'HT') {
1201 $pu_ht =
price2num($pu_ttc / (1 + ((
float) $tmpvat / 100)),
'MU');
1203 $pu_ttc =
price2num($pu_ht * (1 + ((
float) $tmpvat / 100)),
'MU');
1207 if (
GETPOSTINT(
'propalid') > 0 && $permissiontoaddline && is_object($propal)) {
1210 if (($result = $propal->defineBuyPrice($pu_ht, (
float)
price2num(
GETPOST(
'remise_percent'),
'', 2),
$object->id)) < 0) {
1211 dol_syslog($langs->trans(
'FailedToGetCostPrice'));
1214 $buyprice = $result;
1217 $result = $propal->addline(
1242 header(
"Location: ".DOL_URL_ROOT.
"/comm/propal/card.php?id=".$propal->id);
1246 setEventMessages($langs->trans(
"ErrorUnknown").
": $result",
null,
'errors');
1247 } elseif (
GETPOST(
'commandeid') > 0 && $permissiontoaddline && is_object($commande)) {
1250 if (($result = $commande->defineBuyPrice($pu_ht, (
float)
price2num(
GETPOST(
'remise_percent'),
'', 2),
$object->id)) < 0) {
1251 dol_syslog($langs->trans(
'FailedToGetCostPrice'));
1254 $buyprice = $result;
1257 $result = $commande->addline(
1284 header(
"Location: ".DOL_URL_ROOT.
"/commande/card.php?id=".urlencode((
string) ($commande->id)));
1288 setEventMessages($langs->trans(
"ErrorUnknown").
": $result",
null,
'errors');
1289 } elseif (
GETPOST(
'factureid') > 0 && $permissiontoaddline && is_object($facture)) {
1292 if (($result = $facture->defineBuyPrice($pu_ht, (
float)
price2num(
GETPOST(
'remise_percent'),
'', 2),
$object->id)) < 0) {
1293 dol_syslog($langs->trans(
'FailedToGetCostPrice'));
1296 $buyprice = $result;
1299 $result = $facture->addline(
1331 header(
"Location: ".DOL_URL_ROOT.
"/compta/facture/card.php?facid=".$facture->id);
1335 setEventMessages($langs->trans(
"ErrorUnknown").
": $result",
null,
'errors');
1339 setEventMessages($langs->trans(
"WarningSelectOneDocument"),
null,
'warnings');
1344 $triggersendname =
'PRODUCT_SENTBYMAIL';
1346 $autocopy =
'MAIN_MAIL_AUTOCOPY_PRODUCT_TO';
1347 $trackid =
'prod'.$object->id;
1348 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
1357$form =
new Form($db);
1361if (isModEnabled(
'accounting')) {
1364$sellOrEatByMandatoryList =
null;
1365if (isModEnabled(
'productbatch')) {
1371 if ($disableSellBy) {
1372 unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_BY]);
1373 unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_AND_EAT]);
1375 if ($disableEatBy) {
1376 unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_EAT_BY]);
1377 unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_AND_EAT]);
1381$title = $langs->trans(
'ProductServiceCard');
1386 if ($action ==
'create') {
1387 $title = $langs->trans(
"NewProduct");
1389 $title = $langs->trans(
'Product').
" ".$shortlabel.
" - ".$langs->trans(
'Card');
1390 $help_url =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos|DE:Modul_Produkte';
1394 if ($action ==
'create') {
1395 $title = $langs->trans(
"NewService");
1397 $title = $langs->trans(
'Service').
" ".$shortlabel.
" - ".$langs->trans(
'Card');
1398 $help_url =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios|DE:Modul_Leistungen';
1402llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-card');
1406$modBarCodeProduct =
null;
1409 $dirbarcode = array_merge(array(
'/core/modules/barcode/'),
$conf->modules_parts[
'barcode']);
1410 foreach ($dirbarcode as $dirroot) {
1417 $modBarCodeProduct =
new $module();
1418 '@phan-var-force ModeleNumRefBarCode $modBarCodeProduct';
1422$canvasdisplayaction = $action;
1423if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
1424 $canvasdisplayaction =
'view';
1427if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
1431 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
1432 $objcanvas->display_canvas($canvasdisplayaction);
1437 if ($action ==
'create' && $usercancreate) {
1439 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1441 if (!empty(
$conf->use_javascript_ajax)) {
1442 print
'<script type="text/javascript">';
1443 print
'$(document).ready(function () {
1444 $("#selectcountry_id").change(function() {
1445 console.log("selectcountry_id change");
1446 document.formprod.action.value="create";
1447 document.formprod.submit();
1450 print
'</script>'.
"\n";
1454 $module =
getDolGlobalString(
'PRODUCT_CODEPRODUCT_ADDON',
'mod_codeproduct_leopard');
1455 if (substr($module, 0, 16) ==
'mod_codeproduct_' && substr($module, -3) ==
'php') {
1456 $module = substr($module, 0,
dol_strlen($module) - 4);
1460 $modCodeProduct =
new $module();
1465 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formprod">';
1466 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1467 print
'<input type="hidden" name="action" value="add">';
1468 print
'<input type="hidden" name="type" value="'.$type.
'">'.
"\n";
1469 if (!empty($modCodeProduct->code_auto)) {
1470 print
'<input type="hidden" name="code_auto" value="1">';
1472 if (!empty($modBarCodeProduct->code_auto)) {
1473 print
'<input type="hidden" name="barcode_auto" value="1">';
1475 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1479 $title = $langs->trans(
"NewService");
1482 $title = $langs->trans(
"NewProduct");
1488 $object->country_id = GETPOSTISSET(
'country_id') ?
GETPOSTINT(
'country_id') : null;
1489 if (
$object->country_id > 0) {
1491 $object->country_code = $tmparray[
'code'];
1492 $object->country = $tmparray[
'label'];
1498 $parameters = array();
1500 $reshook = $hookmanager->executeHooks(
'tabContentCreateProduct', $parameters,
$object, $action);
1501 if (empty($reshook)) {
1502 print
'<table class="border centpercent">';
1507 if (!empty($modCodeProduct->code_auto)) {
1508 $tmpcode = $modCodeProduct->getNextValue(
$object, $type);
1510 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"ProductRef").
'</td><td><input id="ref" name="ref" class="maxwidth200" maxlength="128" value="'.
dol_escape_htmltag(GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alphanohtml') : $tmpcode).
'">';
1511 if ($refalreadyexists) {
1512 print $langs->trans(
"RefAlreadyExists");
1518 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input id="label" name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.
dol_escape_htmltag(
GETPOST(
'label', $label_security_check)).
'"></td></tr>';
1521 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
' ('.$langs->trans(
"Sell").
')</td><td>';
1522 $statutarray = array(
'1' => $langs->trans(
"OnSell"),
'0' => $langs->trans(
"NotOnSell"));
1523 print $form->selectarray(
'statut', $statutarray,
GETPOST(
'statut'));
1527 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
' ('.$langs->trans(
"Buy").
')</td><td>';
1528 $statutarray = array(
'1' => $langs->trans(
"ProductStatusOnBuy"),
'0' => $langs->trans(
"ProductStatusNotOnBuy"));
1529 print $form->selectarray(
'statut_buy', $statutarray,
GETPOST(
'statut_buy'));
1533 if (isModEnabled(
'productbatch')) {
1534 print
'<tr><td>'.$langs->trans(
"ManageLotSerial").
'</td><td>';
1535 $statutarray = array(
'0' => $langs->trans(
"ProductStatusNotOnBatch"),
'1' => $langs->trans(
"ProductStatusOnBatch"),
'2' => $langs->trans(
"ProductStatusOnSerial"));
1536 print $form->selectarray(
'status_batch', $statutarray,
GETPOSTINT(
'status_batch'));
1540 if ($status_batch !==
'0') {
1541 $langs->load(
"admin");
1542 $tooltip = $langs->trans(
"GenericMaskCodes", $langs->transnoentities(
"Batch"), $langs->transnoentities(
"Batch"));
1543 $tooltip .= $langs->trans(
"GenericMaskCodes1");
1544 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes2");
1545 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes3");
1546 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes4a", $langs->transnoentities(
"Batch"), $langs->transnoentities(
"Batch"));
1547 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes5");
1552 print
'<tr><td id="mask_option">'.$langs->trans(
"ManageLotMask").
'</td>';
1555 print
'<td id="field_mask">';
1556 print $form->textwithpicto(
'<input type="text" class="flat minwidth175" name="batch_mask" id="batch_mask_input">', $tooltip, 1,
'help');
1557 print
'<script type="text/javascript">
1558 $(document).ready(function() {
1559 $("#field_mask, #mask_option").addClass("hideobject");
1560 $("#status_batch").on("change", function () {
1561 console.log("We change batch status");
1562 var optionSelected = $("option:selected", this);
1563 var valueSelected = this.value;
1564 $("#field_mask, #mask_option").addClass("hideobject");
1568 if (this.value == 1) {
1569 $("#field_mask, #mask_option").toggleClass("hideobject");
1570 $("#batch_mask_input").val("'.$inherited_mask_lot.
'");
1576 if (this.value == 2) {
1577 $("#field_mask, #mask_option").toggleClass("hideobject");
1578 $("#batch_mask_input").val("'.$inherited_mask_sn.
'");
1591 if (!empty($sellOrEatByMandatoryList)) {
1592 print
'<tr><td>'.$langs->trans(
'BatchSellOrEatByMandatoryList', $langs->transnoentities(
'SellByDate'), $langs->transnoentities(
'EatByDate')).
'</td><td>';
1593 print $form->selectarray(
'sell_or_eat_by_mandatory', $sellOrEatByMandatoryList,
GETPOSTINT(
'sell_or_eat_by_mandatory'));
1598 $showbarcode = isModEnabled(
'barcode');
1599 if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'lire_advance')) {
1603 if ($showbarcode && is_object($modBarCodeProduct)) {
1606 print
'<tr><td>'.$langs->trans(
'BarcodeType').
'</td><td>';
1607 if (GETPOSTISSET(
'fk_barcode_type')) {
1608 $fk_barcode_type =
GETPOST(
'fk_barcode_type') ?
GETPOST(
'fk_barcode_type') : 0;
1613 $fk_barcode_type = 0;
1616 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbarcode.class.php';
1618 print $formbarcode->selectBarcodeType($fk_barcode_type,
'fk_barcode_type', 1);
1623 print
'<td'.($modBarCodeProduct->code_null ?
'' :
' class="fieldrequired"').
'>'.$langs->trans(
"BarcodeValue").
'</td><td>';
1624 $tmpcode = GETPOSTISSET(
'barcode') ?
GETPOST(
'barcode') :
$object->barcode;
1625 if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) {
1626 $tmpcode = $modBarCodeProduct->getNextValue(
$object, $fk_barcode_type);
1628 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1629 print
'<input class="maxwidth150" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).
'">';
1634 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
1635 $doleditor =
new DolEditor(
'desc',
GETPOST(
'desc',
'restricthtml'),
'', 160,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_4,
'90%');
1636 $doleditor->Create();
1641 print
'<tr><td>'.$langs->trans(
"PublicUrl").
'</td><td>';
1642 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
1643 print
'<input type="text" name="url" class="quatrevingtpercent" value="'.GETPOST(
'url').
'">';
1647 if (($type != 1 ||
getDolGlobalInt(
'STOCK_SUPPORTS_SERVICES')) && isModEnabled(
'stock')) {
1649 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1650 print
img_picto($langs->trans(
"DefaultWarehouse"),
'stock',
'class="pictofixedwidth"');
1651 print $formproduct->selectWarehouses(
GETPOSTINT(
'fk_default_warehouse'),
'fk_default_warehouse',
'warehouseopen', 1, 0, 0,
'', 0, 0, array(),
'minwidth300 widthcentpercentminusxx maxwidth500');
1652 print
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create&token='.
newToken().
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?&action=create&type='.
GETPOSTINT(
'type')).
'">';
1653 print
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddWarehouse").
'"></span>';
1661 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"StockLimit"), $langs->trans(
"StockLimitDesc"), 1).
'</td><td>';
1662 print
'<input name="seuil_stock_alerte" class="maxwidth50" value="'.GETPOST(
'seuil_stock_alerte').
'">';
1667 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"DesiredStock"), $langs->trans(
"DesiredStockDesc"), 1).
'</td><td>';
1668 print
'<input name="desiredstock" class="maxwidth50" value="'.GETPOST(
'desiredstock').
'">';
1673 print
'<input name="seuil_stock_alerte" type="hidden" value="0">';
1674 print
'<input name="desiredstock" type="hidden" value="0">';
1678 if ($type == $object::TYPE_SERVICE && isModEnabled(
"workstation")) {
1680 print
'<tr><td>'.$langs->trans(
"DefaultWorkstation").
'</td><td>';
1681 print
img_picto($langs->trans(
"DefaultWorkstation"),
'workstation',
'class="pictofixedwidth"');
1682 print $formproduct->selectWorkstations((GETPOSTISSET(
'fk_default_workstation') ?
GETPOSTINT(
'fk_default_workstation') :
''),
'fk_default_workstation', 1);
1688 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td>';
1689 print
img_picto(
'',
'clock',
'class="pictofixedwidth"');
1690 print
'<input name="duration_value" class="width50" value="'.(GETPOSTISSET(
'duration_value') ?
GETPOST(
'duration_value') :
'').
'">';
1691 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", (GETPOSTISSET(
'duration_unit') ?
GETPOST(
'duration_unit',
'alpha') :
'h'), 0, 1);
1694 if (
$object->duration_value > 0) {
1695 print
' ';
1697 print
'<input type="checkbox" class="marginleftonly valignmiddle" id="mandatoryperiod" name="mandatoryperiod"'.(GETPOSTISSET(
'mandatoryperiod') ?
' checked="checked"' :
'').
'>';
1698 print
'<label for="mandatoryperiod">';
1699 $htmltooltip = $langs->trans(
"mandatoryHelper");
1701 $htmltooltip .=
'<br>'.$langs->trans(
"mandatoryHelper2");
1703 print $form->textwithpicto($langs->trans(
"mandatoryperiod"), $htmltooltip, 1,
'info');
1712 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"NatureOfProductShort"), $langs->trans(
"NatureOfProductDesc")).
'</td><td>';
1713 print $formproduct->selectProductNature(
'finished', (
GETPOST(
'finished') ?
GETPOST(
'finished') : (string)
$object->finished));
1721 print
'<tr><td>'.$langs->trans(
"Weight").
'</td><td>';
1722 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1723 print
'<input name="weight" size="4" value="'.GETPOST(
'weight').
'">';
1724 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", GETPOSTISSET(
'weight_units') ?
GETPOST(
'weight_units',
'alpha') : (
GETPOST(
'weight_units',
'alpha') ?:
getDolGlobalString(
'MAIN_WEIGHT_DEFAULT_UNIT', 0)), 0, 2);
1730 print
'<tr><td>'.$langs->trans(
"Length").
' x '.$langs->trans(
"Width").
' x '.$langs->trans(
"Height").
'</td><td>';
1731 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1732 print
'<input name="size" class="width50" value="'.GETPOST(
'size').
'"> x ';
1733 print
'<input name="sizewidth" class="width50" value="'.GETPOST(
'sizewidth').
'"> x ';
1734 print
'<input name="sizeheight" class="width50" value="'.GETPOST(
'sizeheight').
'">';
1735 print $formproduct->selectMeasuringUnits(
"size_units",
"size", GETPOSTISSET(
'size_units') ?
GETPOST(
'size_units',
'alpha') : (
GETPOST(
'size_units',
'alpha') ?:
'0'), 0, 2);
1740 print
'<tr><td>'.$langs->trans(
"Surface").
'</td><td>';
1741 print
'<input name="surface" size="4" value="'.GETPOST(
'surface').
'">';
1742 print $formproduct->selectMeasuringUnits(
"surface_units",
"surface", GETPOSTISSET(
'surface_units') ?
GETPOST(
'surface_units',
'alpha') : (
GETPOST(
'surface_units',
'alpha') ?:
'0'), 0, 2);
1747 print
'<tr><td>'.$langs->trans(
"Volume").
'</td><td>';
1748 print
'<input name="volume" size="4" value="'.GETPOST(
'volume').
'">';
1749 print $formproduct->selectMeasuringUnits(
"volume_units",
"volume", GETPOSTISSET(
'volume_units') ?
GETPOST(
'volume_units',
'alpha') : (
GETPOST(
'volume_units',
'alpha') ?:
'0'), 0, 2);
1755 print
'<tr><td>'.$langs->trans(
"NetMeasure").
'</td><td>';
1756 print
'<input name="net_measure" size="4" value="'.GETPOST(
'net_measure').
'">';
1757 print $formproduct->selectMeasuringUnits(
"net_measure_units",
'', GETPOSTISSET(
'net_measure_units') ?
GETPOST(
'net_measure_units',
'alpha') : (
GETPOST(
'net_measure_units',
'alpha') ?:
getDolGlobalString(
'MAIN_WEIGHT_DEFAULT_UNIT', 0)), 0, 0);
1764 print
'<tr><td>'.$langs->trans(
'DefaultUnitToShow').
'</td>';
1766 print $form->selectUnits(GETPOSTISSET(
'units') ?
GETPOST(
'units',
'alpha') : (
GETPOST(
'units',
'alpha') ?:
'0'),
'units');
1772 print
'<tr><td class="wordbreak">'.$form->textwithpicto($langs->trans(
"CustomsCode"), $langs->trans(
"CustomsCodeHelp")).
'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.
GETPOST(
'customcode').
'"></td></tr>';
1775 print
'<tr><td>'.$langs->trans(
"CountryOrigin").
'</td>';
1777 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
1778 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth300 widthcentpercentminusx maxwidth500');
1780 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1788 print
'<td>'.$form->editfieldkey(
'RegionStateOrigin',
'state_id',
'',
$object, 0).
'</td><td>';
1790 print
'<td>'.$form->editfieldkey(
'StateOrigin',
'state_id',
'',
$object, 0).
'</td><td>';
1793 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1794 print $formcompany->select_state(
$object->state_id,
$object->country_code);
1801 print
'<tr><td>'.$langs->trans(
"LifeTime").
'</td><td><input name="lifetime" class="maxwidth50" value="'.
GETPOST(
'lifetime').
'"></td></tr>';
1802 print
'<tr><td>'.$langs->trans(
"QCFrequency").
'</td><td><input name="qc_frequency" class="maxwidth50" value="'.
GETPOST(
'qc_frequency').
'"></td></tr>';
1806 $parameters = array(
'colspan' =>
' colspan="2"',
'cols' => 2);
1807 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1808 print $hookmanager->resPrint;
1809 if (empty($reshook)) {
1810 print
$object->showOptionals($extrafields,
'create', $parameters);
1814 print
'<tr><td class="tdtop">'.$langs->trans(
"NoteNotVisibleOnBill").
'</td><td>';
1817 $doleditor =
new DolEditor(
'note_private',
GETPOST(
'note_private',
'restricthtml'),
'', 140,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8,
'90%');
1818 $doleditor->Create();
1822 if (isModEnabled(
'category')) {
1824 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1825 print $form->selectCategories(Categorie::TYPE_PRODUCT,
'categories',
$object);
1837 print
'<table class="border centpercent">';
1839 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"VATRate").
'</td><td>';
1841 print $form->load_tva(
"tva_tx", $defaultva, $mysoc, $mysoc, 0, 0,
'',
false, 1);
1849 print
'<table class="border centpercent">';
1852 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"SellingPrice").
'</td>';
1853 print
'<td><input name="price" class="maxwidth50" value="'.$object->price.
'">';
1854 print $form->selectPriceBaseType(
getDolGlobalString(
'PRODUCT_PRICE_BASE_TYPE'),
"price_base_type");
1859 print
'<tr><td>'.$langs->trans(
"MinPrice").
'</td>';
1860 print
'<td><input name="price_min" class="maxwidth50" value="'.$object->price_min.
'">';
1864 print
'<tr><td>'.$langs->trans(
"VATRate").
'</td><td>';
1866 print $form->load_tva(
"tva_tx", $defaultva, $mysoc, $mysoc, 0, 0,
'',
false, 1);
1877 print
'<!-- accountancy codes -->'.
"\n";
1878 print
'<table class="border centpercent">';
1881 if (isModEnabled(
'accounting')) {
1884 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1887 $accountancy_code_sell = (GETPOSTISSET(
'accountancy_code_sell') ?
GETPOST(
'accountancy_code_sell',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_SOLD_ACCOUNT"));
1889 $accountancy_code_sell = (GETPOSTISSET(
'accountancy_code_sell') ?
GETPOST(
'accountancy_code_sell',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_SOLD_ACCOUNT"));
1891 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1895 if ($mysoc->isInEEC()) {
1896 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellIntraCode").
'</td>';
1899 $accountancy_code_sell_intra = (GETPOSTISSET(
'accountancy_code_sell_intra') ?
GETPOST(
'accountancy_code_sell_intra',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT"));
1901 $accountancy_code_sell_intra = (GETPOSTISSET(
'accountancy_code_sell_intra') ?
GETPOST(
'accountancy_code_sell_intra',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT"));
1903 print $formaccounting->select_account($accountancy_code_sell_intra,
'accountancy_code_sell_intra', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1908 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellExportCode").
'</td>';
1911 $accountancy_code_sell_export = (
GETPOST(
'accountancy_code_sell_export') ?
GETPOST(
'accountancy_code_sell_export',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT"));
1913 $accountancy_code_sell_export = (
GETPOST(
'accountancy_code_sell_export') ?
GETPOST(
'accountancy_code_sell_export',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT"));
1915 print $formaccounting->select_account($accountancy_code_sell_export,
'accountancy_code_sell_export', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1919 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1922 $accountancy_code_buy = (
GETPOST(
'accountancy_code_buy',
'alpha') ? (
GETPOST(
'accountancy_code_buy',
'alpha')) :
getDolGlobalString(
"ACCOUNTING_PRODUCT_BUY_ACCOUNT"));
1924 $accountancy_code_buy = (
GETPOST(
'accountancy_code_buy',
'alpha') ? (
GETPOST(
'accountancy_code_buy',
'alpha')) :
getDolGlobalString(
"ACCOUNTING_SERVICE_BUY_ACCOUNT"));
1926 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1930 if ($mysoc->isInEEC()) {
1931 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyIntraCode").
'</td>';
1934 $accountancy_code_buy_intra = (GETPOSTISSET(
'accountancy_code_buy_intra') ?
GETPOST(
'accountancy_code_buy_intra',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT"));
1936 $accountancy_code_buy_intra = (GETPOSTISSET(
'accountancy_code_buy_intra') ?
GETPOST(
'accountancy_code_buy_intra',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT"));
1938 print $formaccounting->select_account($accountancy_code_buy_intra,
'accountancy_code_buy_intra', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1943 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyExportCode").
'</td>';
1946 $accountancy_code_buy_export = (
GETPOST(
'accountancy_code_buy_export') ?
GETPOST(
'accountancy_code_buy_export',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT"));
1948 $accountancy_code_buy_export = (
GETPOST(
'accountancy_code_buy_export') ?
GETPOST(
'accountancy_code_buy_export',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT"));
1950 print $formaccounting->select_account($accountancy_code_buy_export,
'accountancy_code_buy_export', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1953 if (!empty($accountancy_code_sell)) {
1954 $object->accountancy_code_sell = $accountancy_code_sell;
1956 if (!empty($accountancy_code_sell_intra)) {
1957 $object->accountancy_code_sell_intra = $accountancy_code_sell_intra;
1959 if (!empty($accountancy_code_sell_export)) {
1960 $object->accountancy_code_sell_export = $accountancy_code_sell_export;
1962 if (!empty($accountancy_code_buy)) {
1963 $object->accountancy_code_buy = $accountancy_code_buy;
1965 if (!empty($accountancy_code_buy_intra)) {
1966 $object->accountancy_code_buy_intra = $accountancy_code_buy_intra;
1968 if (!empty($accountancy_code_buy_export)) {
1969 $object->accountancy_code_buy_export = $accountancy_code_buy_export;
1973 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1974 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
1978 if ($mysoc->isInEEC()) {
1979 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellIntraCode").
'</td>';
1980 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.
'">';
1985 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellExportCode").
'</td>';
1986 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell_export" value="'.$object->accountancy_code_sell_export.
'">';
1990 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1991 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
1995 if ($mysoc->isInEEC()) {
1996 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyIntraCode").
'</td>';
1997 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy_intra" value="'.$object->accountancy_code_buy_intra.
'">';
2002 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyExportCode").
'</td>';
2003 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy_export" value="'.$object->accountancy_code_buy_export.
'">';
2012 print $form->buttonsSaveCancel(
"Create");
2021 if ($action ==
'edit' && $usercancreate) {
2023 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2025 if (!empty(
$conf->use_javascript_ajax)) {
2026 print
'<script type="text/javascript">';
2027 print
'$(document).ready(function () {
2028 $("#selectcountry_id").change(function () {
2029 document.formprod.action.value="edit";
2030 document.formprod.submit();
2033 print
'</script>'.
"\n";
2040 $object->country_code = $tmparray[
'code'];
2041 $object->country = $tmparray[
'label'];
2044 $type = $langs->trans(
'Product');
2046 $type = $langs->trans(
'Service');
2051 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="formprod">'.
"\n";
2052 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2053 print
'<input type="hidden" name="action" value="update">';
2054 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
2055 print
'<input type="hidden" name="canvas" value="'.$object->canvas.
'">';
2058 $titre = $langs->trans(
"CardProduct".
$object->type);
2060 print
dol_get_fiche_head($head,
'card', $titre, 0, $picto, 0,
'',
'', 0,
'', 1);
2063 $parameters = array();
2065 $reshook = $hookmanager->executeHooks(
'tabContentEditProduct', $parameters,
$object, $action);
2067 if (empty($reshook)) {
2068 print
'<table class="border allwidth">';
2072 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.
dol_escape_htmltag(GETPOSTISSET(
'ref') ?
GETPOST(
'ref') :
$object->
ref).
'"></td></tr>';
2074 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.
dol_escape_htmltag(
$object->ref).
'" readonly="true"></td></tr>';
2078 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td colspan="3"><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.
dol_escape_htmltag(GETPOSTISSET(
'label') ?
GETPOST(
'label') :
$object->label).
'"></td></tr>';
2081 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
' ('.$langs->trans(
"Sell").
')</td><td colspan="3">';
2082 print
'<select class="flat" name="statut">';
2083 if ((GETPOSTISSET(
'statut') &&
GETPOST(
'statut')) || (!GETPOSTISSET(
'statut') &&
$object->status)) {
2084 print
'<option value="1" selected>'.$langs->trans(
"OnSell").
'</option>';
2085 print
'<option value="0">'.$langs->trans(
"NotOnSell").
'</option>';
2087 print
'<option value="1">'.$langs->trans(
"OnSell").
'</option>';
2088 print
'<option value="0" selected>'.$langs->trans(
"NotOnSell").
'</option>';
2094 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
' ('.$langs->trans(
"Buy").
')</td><td colspan="3">';
2095 print
'<select class="flat" name="statut_buy">';
2096 if ((GETPOSTISSET(
'statut_buy') &&
GETPOST(
'statut_buy')) || (!GETPOSTISSET(
'statut_buy') &&
$object->status_buy)) {
2097 print
'<option value="1" selected>'.$langs->trans(
"ProductStatusOnBuy").
'</option>';
2098 print
'<option value="0">'.$langs->trans(
"ProductStatusNotOnBuy").
'</option>';
2100 print
'<option value="1">'.$langs->trans(
"ProductStatusOnBuy").
'</option>';
2101 print
'<option value="0" selected>'.$langs->trans(
"ProductStatusNotOnBuy").
'</option>';
2107 if (isModEnabled(
'productbatch')) {
2109 print
'<tr><td>'.$langs->trans(
"ManageLotSerial").
'</td><td>';
2110 $statutarray = array(
'0' => $langs->trans(
"ProductStatusNotOnBatch"),
'1' => $langs->trans(
"ProductStatusOnBatch"),
'2' => $langs->trans(
"ProductStatusOnSerial"));
2112 print $form->selectarray(
'status_batch', $statutarray, GETPOSTISSET(
'status_batch') ?
GETPOSTINT(
'status_batch') :
$object->status_batch);
2114 print
'<span id="statusBatchWarning" class="warning" style="display: none;">';
2115 print
img_warning().
' '.$langs->trans(
"WarningConvertFromBatchToSerial").
'</span>';
2117 print
'<span id="statusBatchMouvToGlobal" class="warning" style="display: none;">';
2118 print
img_warning().
' '.$langs->trans(
"WarningTransferBatchStockMouvToGlobal").
'</span>';
2122 print
'<script type="text/javascript">
2123 $(document).ready(function() {
2124 console.log($("#statusBatchWarning"))
2125 $("#status_batch").on("change", function() {
2126 if ($("#status_batch")[0].value == 0) {
2127 $("#statusBatchMouvToGlobal").show()
2129 $("#statusBatchMouvToGlobal").hide()
2135 if (
$object->status_batch == 1) {
2136 print
'<script type="text/javascript">
2137 $(document).ready(function() {
2138 console.log($("#statusBatchWarning"))
2139 $("#status_batch").on("change", function() {
2140 if ($("#status_batch")[0].value == 2) {
2141 $("#statusBatchWarning").show()
2143 $("#statusBatchWarning").hide()
2151 if (!empty(
$object->status_batch) || !empty(
$conf->use_javascript_ajax)) {
2152 $langs->load(
"admin");
2153 $tooltip = $langs->trans(
"GenericMaskCodes", $langs->transnoentities(
"Batch"), $langs->transnoentities(
"Batch"));
2154 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes2");
2155 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes3");
2156 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes4a", $langs->transnoentities(
"Batch"), $langs->transnoentities(
"Batch"));
2157 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes5");
2160 print
'<tr><td id="mask_option">'.$langs->trans(
"ManageLotMask").
'</td>';
2170 print
'<td id="field_mask">';
2171 print $form->textwithpicto(
'<input type="text" class="flat minwidth175" name="batch_mask" id="batch_mask_input" value="'.$mask.
'">', $tooltip, 1,
'help');
2173 if (!empty(
$conf->use_javascript_ajax)) {
2174 print
'<script type="text/javascript">
2175 $(document).ready(function() {
2176 $("#field_mask").parent().addClass("hideobject");
2177 var preselect = document.getElementById("status_batch");';
2179 print
'if (preselect.value == "2") {
2180 $("#field_mask").parent().removeClass("hideobject");
2184 print
'if (preselect.value == "1") {
2185 $("#field_mask").parent().removeClass("hideobject");
2188 print
'$("#status_batch").on("change", function () {
2189 var optionSelected = $("option:selected", this);
2190 var valueSelected = this.value;
2191 $("#field_mask").parent().addClass("hideobject");
2195 if (this.value == 1) {
2196 $("#field_mask").parent().removeClass("hideobject");
2197 $("#batch_mask_input").val("'.$inherited_mask_lot.
'");
2203 if (this.value == 2) {
2204 $("#field_mask").parent().removeClass("hideobject");
2205 $("#batch_mask_input").val("'.$inherited_mask_sn.
'");
2219 if (!empty($sellOrEatByMandatoryList)) {
2220 if (GETPOSTISSET(
'sell_or_eat_by_mandatory')) {
2221 $sellOrEatByMandatorySelectedId =
GETPOSTINT(
'sell_or_eat_by_mandatory');
2223 $sellOrEatByMandatorySelectedId =
$object->sell_or_eat_by_mandatory;
2225 print
'<tr><td>'.$langs->trans(
'BatchSellOrEatByMandatoryList', $langs->transnoentities(
'SellByDate'), $langs->transnoentities(
'EatByDate')).
'</td><td>';
2226 print $form->selectarray(
'sell_or_eat_by_mandatory', $sellOrEatByMandatoryList, $sellOrEatByMandatorySelectedId);
2232 $showbarcode = isModEnabled(
'barcode');
2233 if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'lire_advance')) {
2238 print
'<tr><td>'.$langs->trans(
'BarcodeType').
'</td><td>';
2239 if (GETPOSTISSET(
'fk_barcode_type')) {
2240 $fk_barcode_type =
GETPOST(
'fk_barcode_type');
2242 $fk_barcode_type =
$object->barcode_type;
2247 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbarcode.class.php';
2249 print $formbarcode->selectBarcodeType($fk_barcode_type,
'fk_barcode_type', 1);
2251 print
'<tr><td>'.$langs->trans(
"BarcodeValue").
'</td><td>';
2252 $tmpcode = GETPOSTISSET(
'barcode') ?
GETPOST(
'barcode') :
$object->barcode;
2253 if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) {
2254 $tmpcode = $modBarCodeProduct->getNextValue(
$object, $fk_barcode_type);
2256 print
'<input class="maxwidth150 maxwidthonsmartphone" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).
'">';
2261 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
2264 $doleditor =
new DolEditor(
'desc', GETPOSTISSET(
'desc') ?
GETPOST(
'desc',
'restricthtml') :
$object->
description,
'', 160,
'dolibarr_details',
'', false, true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_4,
'90%');
2265 $doleditor->Create();
2272 print
'<tr><td>'.$langs->trans(
"PublicUrl").
'</td><td>';
2273 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
2274 print
'<input type="text" name="url" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'url') ?
GETPOST(
'url') :
$object->url).
'">';
2280 if (isModEnabled(
'productbatch') &&
$object->hasbatch()) {
2281 print
'<tr><td><input type="hidden" id="stockable_product" name="stockable_product" value="on" /></td><td></td></tr>';
2283 print
'<tr><td><label for="stockable_product">' . $langs->trans(
"StockableProduct") .
'</label></td>';
2284 $checked = empty(
$object->stockable_product) ?
"" :
"checked";
2285 print
'<td><input type="checkbox" id="stockable_product" name="stockable_product" '. $checked .
' /></td></tr>';
2289 print
'<tr class="showifstockable'.(empty(
$object->stockable_product) ?
' hidden' :
'').
'"><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2290 print
img_picto($langs->trans(
"DefaultWarehouse"),
'stock',
'class="pictofixedwidth"');
2291 print $formproduct->selectWarehouses((GETPOSTISSET(
'fk_default_warehouse') ?
GETPOST(
'fk_default_warehouse') :
$object->fk_default_warehouse),
'fk_default_warehouse',
'warehouseopen', 1, 0, 0,
'', 0, 0, array(),
'minwidth200 maxwidth500 widthcentpercentminusxx');
2292 print
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?action=edit&id='.((
int)
$object->id)).
'">';
2293 print
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddWarehouse").
'"></span></a>';
2307 if (
$object->isService() && isModEnabled(
'workstation')) {
2309 print
'<tr><td>'.$langs->trans(
"DefaultWorkstation").
'</td><td>';
2310 print
img_picto($langs->trans(
"DefaultWorkstation"),
'workstation',
'class="pictofixedwidth"');
2311 print $formproduct->selectWorkstations(
$object->fk_default_workstation,
'fk_default_workstation', 1);
2324 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td>';
2325 print
'<input name="duration_value" class="width50" value="'.($object->duration_value ?
$object->duration_value :
'').
'"> ';
2327 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", (
$object->duration_unit ?
$object->duration_unit :
'h'), 0, 1);
2331 print
' ';
2333 print
'<input type="checkbox" class="valignmiddle" id="mandatoryperiod" name="mandatoryperiod"'.($object->mandatory_period == 1 ?
' checked="checked"' :
'').
'>';
2334 print
'<label for="mandatoryperiod">';
2335 $htmltooltip = $langs->trans(
"mandatoryHelper");
2337 $htmltooltip .=
'<br>'.$langs->trans(
"mandatoryHelper2");
2339 print $form->textwithpicto($langs->trans(
"mandatoryperiod"), $htmltooltip, 1,
'info');
2346 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"NatureOfProductShort"), $langs->trans(
"NatureOfProductDesc")).
'</td><td>';
2347 print $formproduct->selectProductNature(
'finished', (GETPOSTISSET(
'finished') ?
GETPOST(
'finished') :
$object->finished));
2352 if (!
$object->isService() && isModEnabled(
'bom')) {
2353 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"DefaultBOM"), $langs->trans(
"DefaultBOMDesc", $langs->transnoentitiesnoconv(
"Finished"))).
'</td><td>';
2354 $bomkey =
"Bom:bom/class/bom.class.php:0:(t.status:=:1) AND (t.fk_product:=:".((int)
$object->id).
')';
2355 print
img_picto($langs->trans(
"DefaultBOM"),
'bom',
'class="pictofixedwidth"');
2356 print $form->selectForForms($bomkey,
'fk_default_bom', (GETPOSTISSET(
'fk_default_bom') ?
GETPOST(
'fk_default_bom') :
$object->fk_default_bom), 1);
2363 print
'<tr><td>'.$langs->trans(
"Weight").
'</td><td>';
2364 print
'<input name="weight" size="5" value="'.(GETPOSTISSET(
'weight') ?
GETPOST(
'weight') :
$object->weight).
'"> ';
2365 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", GETPOSTISSET(
'weight_units') ?
GETPOST(
'weight_units') : (int)
$object->weight_units, 0, 2);
2371 print
'<tr><td>'.$langs->trans(
"Length").
' x '.$langs->trans(
"Width").
' x '.$langs->trans(
"Height").
'</td><td>';
2372 print
'<input name="size" size="5" value="'.(GETPOSTISSET(
'size') ?
GETPOST(
'size') :
$object->length).
'">x';
2373 print
'<input name="sizewidth" size="5" value="'.(GETPOSTISSET(
'sizewidth') ?
GETPOST(
'sizewidth') :
$object->width).
'">x';
2374 print
'<input name="sizeheight" size="5" value="'.(GETPOSTISSET(
'sizeheight') ?
GETPOST(
'sizeheight') :
$object->height).
'"> ';
2375 print $formproduct->selectMeasuringUnits(
"size_units",
"size", GETPOSTISSET(
'size_units') ?
GETPOST(
'size_units') : (int)
$object->length_units, 0, 2);
2380 print
'<tr><td>'.$langs->trans(
"Surface").
'</td><td>';
2381 print
'<input name="surface" size="5" value="'.(GETPOSTISSET(
'surface') ?
GETPOST(
'surface') :
$object->surface).
'"> ';
2382 print $formproduct->selectMeasuringUnits(
"surface_units",
"surface", GETPOSTISSET(
'surface_units') ?
GETPOST(
'surface_units') : (int)
$object->surface_units, 0, 2);
2387 print
'<tr><td>'.$langs->trans(
"Volume").
'</td><td>';
2388 print
'<input name="volume" size="5" value="'.(GETPOSTISSET(
'volume') ?
GETPOST(
'volume') :
$object->volume).
'"> ';
2389 print $formproduct->selectMeasuringUnits(
"volume_units",
"volume", GETPOSTISSET(
'volume_units') ?
GETPOST(
'volume_units') : (int)
$object->volume_units, 0, 2);
2395 print
'<tr><td>'.$langs->trans(
"NetMeasure").
'</td><td>';
2396 print
'<input name="net_measure" size="5" value="'.(GETPOSTISSET(
'net_measure') ?
GETPOST(
'net_measure') :
$object->net_measure).
'"> ';
2397 print $formproduct->selectMeasuringUnits(
"net_measure_units",
"", GETPOSTISSET(
'net_measure_units') ?
GETPOST(
'net_measure_units') : (int)
$object->net_measure_units, 0, 0);
2403 print
'<tr><td>'.$langs->trans(
'DefaultUnitToShow').
'</td>';
2405 print $form->selectUnits(
$object->fk_unit,
'units');
2411 print
'<tr><td class="wordbreak">'.$form->textwithpicto($langs->trans(
"CustomsCode"), $langs->trans(
"CustomsCodeHelp")).
'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.(GETPOSTISSET(
'customcode') ?
GETPOST(
'customcode') :
$object->customcode).
'"></td></tr>';
2413 print
'<tr><td>'.$langs->trans(
"CountryOrigin").
'</td>';
2415 print
img_picto(
'',
'globe-americas',
'class="paddingrightonly"');
2416 print $form->select_country((
string) (GETPOSTISSET(
'country_id') ?
GETPOSTINT(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth100 maxwidthonsmartphone');
2418 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2426 print
'<td>'.$form->editfieldkey(
'RegionStateOrigin',
'state_id',
'',
$object, 0).
'</td><td>';
2428 print
'<td>'.$form->editfieldkey(
'StateOrigin',
'state_id',
'',
$object, 0).
'</td><td>';
2431 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2432 print $formcompany->select_state(GETPOSTISSET(
'state_id') ?
GETPOSTINT(
'state_id') :
$object->state_id,
$object->country_code);
2440 print
'<tr><td>'.$langs->trans(
"LifeTime").
'</td><td><input name="lifetime" class="maxwidth100onsmartphone" value="'.
$object->lifetime.
'"></td></tr>';
2441 print
'<tr><td>'.$langs->trans(
"QCFrequency").
'</td><td><input name="qc_frequency" class="maxwidth100onsmartphone" value="'.
$object->qc_frequency.
'"></td></tr>';
2445 $parameters = array(
'colspan' =>
' colspan="2"',
'cols' => 2);
2446 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2447 print $hookmanager->resPrint;
2448 if (empty($reshook)) {
2449 print
$object->showOptionals($extrafields,
'edit', $parameters);
2453 if (isModEnabled(
'category')) {
2454 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
2455 print $form->selectCategories(Categorie::TYPE_PRODUCT,
'categories',
$object);
2461 print
'<tr><td class="tdtop">'.$langs->trans(
"NoteNotVisibleOnBill").
'</td><td>';
2463 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 140,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_4,
'90%');
2464 $doleditor->Create();
2474 print
'<table class="border centpercent">';
2476 if (isModEnabled(
'accounting')) {
2479 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2481 print $formaccounting->select_account((GETPOSTISSET(
'accountancy_code_sell') ?
GETPOST(
'accountancy_code_sell') :
$object->accountancy_code_sell),
'accountancy_code_sell', 1, array(), 1, 1,
'minwidth150 maxwidth300');
2485 if ($mysoc->isInEEC()) {
2486 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellIntraCode").
'</td>';
2488 print $formaccounting->select_account((GETPOSTISSET(
'accountancy_code_sell_intra') ?
GETPOST(
'accountancy_code_sell_intra') :
$object->accountancy_code_sell_intra),
'accountancy_code_sell_intra', 1, array(), 1, 1,
'minwidth150 maxwidth300');
2493 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellExportCode").
'</td>';
2495 print $formaccounting->select_account((GETPOSTISSET(
'accountancy_code_sell_export') ?
GETPOST(
'accountancy_code_sell_export') :
$object->accountancy_code_sell_export),
'accountancy_code_sell_export', 1, array(), 1, 1,
'minwidth150 maxwidth300');
2499 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2501 print $formaccounting->select_account((GETPOSTISSET(
'accountancy_code_buy') ?
GETPOST(
'accountancy_code_buy') :
$object->accountancy_code_buy),
'accountancy_code_buy', 1, array(), 1, 1,
'minwidth150 maxwidth300');
2505 if ($mysoc->isInEEC()) {
2506 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyIntraCode").
'</td>';
2508 print $formaccounting->select_account((GETPOSTISSET(
'accountancy_code_buy_intra') ?
GETPOST(
'accountancy_code_buy_intra') :
$object->accountancy_code_buy_intra),
'accountancy_code_buy_intra', 1, array(), 1, 1,
'minwidth150 maxwidth300');
2513 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyExportCode").
'</td>';
2515 print $formaccounting->select_account((GETPOSTISSET(
'accountancy_code_buy_export') ?
GETPOST(
'accountancy_code_buy_export') :
$object->accountancy_code_buy_export),
'accountancy_code_buy_export', 1, array(), 1, 1,
'minwidth150 maxwidth300');
2520 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2521 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.(GETPOSTISSET(
'accountancy_code_sell') ?
GETPOST(
'accountancy_code_sell') :
$object->accountancy_code_sell).
'">';
2525 if ($mysoc->isInEEC()) {
2526 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellIntraCode").
'</td>';
2527 print
'<td><input name="accountancy_code_sell_intra" class="maxwidth200" value="'.(GETPOSTISSET(
'accountancy_code_sell_intra') ?
GETPOST(
'accountancy_code_sell_intra') :
$object->accountancy_code_sell_intra).
'">';
2532 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellExportCode").
'</td>';
2533 print
'<td><input name="accountancy_code_sell_export" class="maxwidth200" value="'.(GETPOSTISSET(
'accountancy_code_sell_export') ?
GETPOST(
'accountancy_code_sell_export') :
$object->accountancy_code_sell_export).
'">';
2537 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2538 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.(GETPOSTISSET(
'accountancy_code_buy') ?
GETPOST(
'accountancy_code_buy') :
$object->accountancy_code_buy).
'">';
2542 if ($mysoc->isInEEC()) {
2543 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyIntraCode").
'</td>';
2544 print
'<td><input name="accountancy_code_buy_intra" class="maxwidth200" value="'.(GETPOSTISSET(
'accountancy_code_buy_intra') ?
GETPOST(
'accountancy_code_buy_intra') :
$object->accountancy_code_buy_intra).
'">';
2549 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyExportCode").
'</td>';
2550 print
'<td><input name="accountancy_code_buy_export" class="maxwidth200" value="'.(GETPOSTISSET(
'accountancy_code_buy_export') ?
GETPOST(
'accountancy_code_buy_export') :
$object->accountancy_code_buy_export).
'">';
2559 print
'$(document).ready(function() {
2560 $("#stockable_product").change(function() {
2561 $(".showifstockable").toggle(this.checked);
2570 print $form->buttonsSaveCancel();
2576 $showbarcode = isModEnabled(
'barcode');
2577 if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'lire_advance')) {
2582 $titre = $langs->trans(
"CardProduct".
$object->type);
2585 print
dol_get_fiche_head($head,
'card', $titre, -1, $picto, 0,
'',
'', 0,
'', 1);
2587 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?restore_lastsearch_values=1&type='.
$object->type.
'">'.$langs->trans(
"BackToList").
'</a>';
2588 $object->next_prev_filter =
"(te.fk_product_type:=:".((int)
$object->type).
")";
2591 if ($user->socid && !in_array(
'product', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
2595 dol_banner_tab(
$object,
'ref', $linkback, $shownav,
'ref');
2598 $parameters = array();
2600 $reshook = $hookmanager->executeHooks(
'tabContentViewProduct', $parameters,
$object, $action);
2601 if (empty($reshook)) {
2602 print
'<div class="fichecenter">';
2603 print
'<div class="fichehalfleft">';
2605 print
'<div class="underbanner clearboth"></div>';
2606 print
'<table class="border tableforfield centpercent">';
2609 if (isModEnabled(
"product") && isModEnabled(
"service")) {
2610 $typeformat =
'select;0:'.$langs->trans(
"Product").
',1:'.$langs->trans(
"Service");
2611 print
'<tr><td class="titlefield">';
2612 print (!
getDolGlobalString(
'PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey(
"Type",
'fk_product_type', (
string)
$object->type,
$object, (
int) $usercancreate, $typeformat) : $langs->trans(
'Type');
2614 print $form->editfieldval(
"Type",
'fk_product_type',
$object->type,
$object, $usercancreate, $typeformat);
2620 print
'<tr><td class="nowrap">';
2621 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
2622 print $langs->trans(
"BarcodeType");
2624 if (($action !=
'editbarcodetype') && $usercancreate && $createbarcode) {
2625 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editbarcodetype&id='.
$object->id.
'&token='.
newToken().
'">'.
img_edit($langs->trans(
'Edit'), 1).
'</a></td>';
2627 print
'</tr></table>';
2629 if ($action ==
'editbarcodetype' || $action ==
'editbarcode') {
2630 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbarcode.class.php';
2634 $fk_barcode_type =
'';
2635 if ($action ==
'editbarcodetype' && is_object($formbarcode)) {
2636 print $formbarcode->formBarcodeType($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->barcode_type,
'fk_barcode_type');
2637 $fk_barcode_type =
$object->barcode_type;
2640 $fk_barcode_type =
$object->barcode_type;
2641 print
$object->barcode_type_label ?
$object->barcode_type_label : (
$object->barcode ?
'<div class="warning">'.$langs->trans(
"SetDefaultBarcodeType").
'<div>' :
'');
2643 print
'</td></tr>'.
"\n";
2646 print
'<tr><td class="nowrap">';
2647 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
2648 print $langs->trans(
"BarcodeValue");
2650 if (($action !=
'editbarcode') && $usercancreate && $createbarcode) {
2651 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editbarcode&id='.
$object->id.
'&token='.
newToken().
'">'.
img_edit($langs->trans(
'Edit'), 1).
'</a></td>';
2653 print
'</tr></table>';
2654 print
'</td><td class="wordbreak">';
2655 if ($action ==
'editbarcode') {
2656 $tmpcode = GETPOSTISSET(
'barcode') ?
GETPOST(
'barcode') :
$object->barcode;
2657 if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) {
2658 $tmpcode = $modBarCodeProduct->getNextValue(
$object, (
string) $fk_barcode_type);
2661 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
2662 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2663 print
'<input type="hidden" name="action" value="setbarcode">';
2664 print
'<input type="hidden" name="barcode_type_code" value="'.$object->barcode_type_code.
'">';
2665 print
'<input class="width300" class="maxwidthonsmartphone" type="text" name="barcode" value="'.$tmpcode.
'">';
2666 print
' <input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
2671 print
'</td></tr>'.
"\n";
2675 if (isModEnabled(
'productbatch')) {
2677 print
'<tr><td>'.$langs->trans(
"ManageLotSerial").
'</td><td>';
2678 print
$object->getLibStatut(0, 2);
2682 print
'<tr><td>'.$langs->trans(
"ManageLotMask").
'</td><td>';
2688 print
'<tr><td>'.$langs->trans(
'BatchSellOrEatByMandatoryList', $langs->transnoentities(
'SellByDate'), $langs->transnoentities(
'EatByDate')).
'</td><td>';
2689 print
$object->getSellOrEatByMandatoryLabel();
2695 print
'<tr><td class="nowrap">';
2696 print $langs->trans(
"ProductAccountancySellCode");
2698 if (isModEnabled(
'accounting')) {
2699 if (!empty(
$object->accountancy_code_sell)) {
2701 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
2703 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
2706 print
$object->accountancy_code_sell;
2711 if ($mysoc->isInEEC()) {
2712 print
'<tr><td class="nowrap">';
2713 print $langs->trans(
"ProductAccountancySellIntraCode");
2715 if (isModEnabled(
'accounting')) {
2716 if (!empty(
$object->accountancy_code_sell_intra)) {
2718 $accountingaccount2->fetch(0,
$object->accountancy_code_sell_intra, 1);
2720 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
2723 print
$object->accountancy_code_sell_intra;
2729 print
'<tr><td class="nowrap">';
2730 print $langs->trans(
"ProductAccountancySellExportCode");
2732 if (isModEnabled(
'accounting')) {
2733 if (!empty(
$object->accountancy_code_sell_export)) {
2735 $accountingaccount3->fetch(0,
$object->accountancy_code_sell_export, 1);
2737 print $accountingaccount3->getNomUrl(0, 1, 1,
'', 1);
2740 print
$object->accountancy_code_sell_export;
2745 print
'<tr><td class="nowrap">';
2746 print $langs->trans(
"ProductAccountancyBuyCode");
2748 if (isModEnabled(
'accounting')) {
2749 if (!empty(
$object->accountancy_code_buy)) {
2751 $accountingaccount4->fetch(0,
$object->accountancy_code_buy, 1);
2753 print $accountingaccount4->getNomUrl(0, 1, 1,
'', 1);
2756 print
$object->accountancy_code_buy;
2761 if ($mysoc->isInEEC()) {
2762 print
'<tr><td class="nowrap">';
2763 print $langs->trans(
"ProductAccountancyBuyIntraCode");
2765 if (isModEnabled(
'accounting')) {
2766 if (!empty(
$object->accountancy_code_buy_intra)) {
2768 $accountingaccount5->fetch(0,
$object->accountancy_code_buy_intra, 1);
2770 print $accountingaccount5->getNomUrl(0, 1, 1,
'', 1);
2773 print
$object->accountancy_code_buy_intra;
2779 print
'<tr><td class="nowrap">';
2780 print $langs->trans(
"ProductAccountancyBuyExportCode");
2782 if (isModEnabled(
'accounting')) {
2783 if (!empty(
$object->accountancy_code_buy_export)) {
2785 $accountingaccount6->fetch(0,
$object->accountancy_code_buy_export, 1);
2787 print $accountingaccount6->getNomUrl(0, 1, 1,
'', 1);
2790 print
$object->accountancy_code_buy_export;
2796 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
2797 print
'<td class="wordbreakimp wrapimp"><div class="longmessagecut">'.(dol_textishtml(
$object->description) ?
$object->description :
dol_nl2br(
$object->description, 1,
true)).
'</div></td></tr>';
2801 print
'<tr><td>'.$langs->trans(
"PublicUrl").
'</td><td>';
2808 print
'<tr><td>' . $form->textwithpicto($langs->trans(
"StockableProduct"), $langs->trans(
'StockableProductDescription')) .
'</td>';
2809 print
'<td><input type="checkbox" readonly disabled '.($object->stockable_product == 1 ?
'checked' :
'').
'></td></tr>';
2811 if (
$object->isStockManaged()) {
2813 $warehouse->fetch(
$object->fk_default_warehouse);
2815 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2816 print(!empty($warehouse->id) ? $warehouse->getNomUrl(1) :
'');
2821 if (
$object->isService() && isModEnabled(
'workstation')) {
2823 $res = $workstation->fetch(
$object->fk_default_workstation);
2825 print
'<tr><td>'.$langs->trans(
"DefaultWorkstation").
'</td><td>';
2826 print(!empty($workstation->id) ? $workstation->getNomUrl(1) :
'');
2831 if (isModEnabled(
'variants') && (
$object->isProduct() ||
$object->isService())) {
2834 if ($combination->fetchByFkProductChild(
$object->id) > 0) {
2835 $prodstatic =
new Product($db);
2836 $prodstatic->fetch($combination->fk_product_parent);
2839 print
'<tr><td>'.$langs->trans(
"ParentProduct").
'</td><td>';
2840 print $prodstatic->getNomUrl(1);
2848 print
'<div class="fichehalfright">';
2849 print
'<div class="underbanner clearboth"></div>';
2851 print
'<table class="border tableforfield centpercent">';
2855 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
2856 $measuringUnits =
new CUnits($db);
2859 if (
$object->duration_value > 1) {
2862 $result = $measuringUnits->fetchAll(
'',
'scale', 0, 0, [
't.active' => 1,
't.unit_type' =>
'time']);
2863 if ($result !== -1) {
2864 foreach ($measuringUnits->records as $record) {
2865 $durations[$record->short_label] =
dol_ucfirst($record->label) . $plural;
2868 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Duration").
'</td><td>';
2869 if (
$object->duration_value) {
2870 print
$object->duration_value;
2871 print(!empty(
$object->duration_unit) && isset($durations[
$object->duration_unit]) ?
" ".$langs->trans($durations[
$object->duration_unit]).
" " :
'');
2875 $htmltooltip = $langs->trans(
"mandatoryHelper");
2877 $htmltooltip .=
'<br>'.$langs->trans(
"mandatoryHelper2");
2879 if (
$object->duration_value > 0) {
2880 print
' ';
2882 print
'<input type="checkbox" class="valignmiddle" name="mandatoryperiod"'.($object->mandatory_period == 1 ?
' checked="checked"' :
'').
' disabled>';
2883 print $form->textwithpicto($langs->trans(
"mandatoryperiod"), $htmltooltip, 1,
'info');
2889 print
'<tr><td class="titlefieldmiddle">'.$form->textwithpicto($langs->trans(
"NatureOfProductShort"), $langs->trans(
"NatureOfProductDesc")).
'</td><td>';
2890 print
$object->getLibFinished();
2895 if (!
$object->isService() && isModEnabled(
'bom') &&
$object->finished) {
2896 print
'<tr><td class="titlefieldmiddle">'.$form->textwithpicto($langs->trans(
"DefaultBOM"), $langs->trans(
"DefaultBOMDesc", $langs->transnoentitiesnoconv(
"Finished"))).
'</td><td>';
2897 if (
$object->fk_default_bom) {
2898 $bom_static =
new BOM($db);
2899 $bom_static->fetch(
$object->fk_default_bom);
2900 print $bom_static->getNomUrl(1);
2908 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Weight").
'</td><td>';
2914 print
"</td></tr>\n";
2919 print
'<tr><td>'.$langs->trans(
"Length").
' x '.$langs->trans(
"Width").
' x '.$langs->trans(
"Height").
'</td><td>';
2923 print
" x ".$object->width;
2926 print
" x ".$object->height;
2928 print
' '.measuringUnitString(0,
"size",
$object->length_units);
2932 print
"</td></tr>\n";
2937 print (
getDolGlobalString(
'PRODUCT_DISABLE_SURFACE') ?
'' : $langs->trans(
"Surface"));
2939 print (
getDolGlobalString(
'PRODUCT_DISABLE_VOLUME') ?
'' : $langs->trans(
"Volume")).
'</td><td>';
2947 print
"</td></tr>\n";
2952 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"NetMeasure").
'</td><td>';
2953 if (
$object->net_measure !=
'') {
2964 $unit =
$object->getLabelOfUnit(
'long', $langs);
2966 print
'<tr><td>'.$langs->trans(
'DefaultUnitToShow').
'</td><td>';
2973 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CustomsCode"), $langs->trans(
"CustomsCodeHelp")).
'</td><td>'.
dolPrintHTML(
$object->customcode).
'</td></tr>';
2976 print
'<tr><td>'.$langs->trans(
"Origin").
'</td><td>'.
getCountry(
$object->country_id,
'', $db);
2977 if (!empty(
$object->state_id)) {
2978 print
' - '.getState(
$object->state_id,
'0', $db);
2985 print
'<tr><td>'.$langs->trans(
"LifeTime").
'</td><td>'.
$object->lifetime.
'</td></tr>';
2986 print
'<tr><td>'.$langs->trans(
"QCFrequency").
'</td><td>'.
$object->qc_frequency.
'</td></tr>';
2990 $parameters = array();
2991 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2994 if (isModEnabled(
'category')) {
2995 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
2996 print $form->showCategories(
$object->id, Categorie::TYPE_PRODUCT, 1);
3002 print
'<!-- show Note --> '.
"\n";
3004 print
'<!-- End show Note --> '.
"\n";
3011 print
'<div class="clearboth"></div>';
3016 } elseif ($action !=
'create') {
3022if (!empty($modCodeProduct->code_auto)) {
3023 $tmpcode = $modCodeProduct->getNextValue(
$object,
$object->type);
3029if (($action ==
'delete' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3030 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3031 $formconfirm = $form->formconfirm(
"card.php?id=".
$object->id, $langs->trans(
"DeleteProduct"), $langs->trans(
"ConfirmDeleteProduct"),
"confirm_delete",
'', 0,
"action-delete");
3033if ($action ==
'merge') {
3034 $formquestion = array(
3036 'name' =>
'product_origin',
3037 'label' => $langs->trans(
'MergeOriginProduct'),
3039 'value' => $form->select_produits(0,
'product_origin',
'', 0, 0, 1, 2,
'', 1, array(), 0, 1, 0,
'minwidth200', 0,
'',
null, 1),
3042 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"MergeProducts"), $langs->trans(
"ConfirmMergeProducts"),
"confirm_merge", $formquestion,
'no', 1, 250);
3046if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3047 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3049 $formquestionclone = array(
3050 'text' => $langs->trans(
"ConfirmClone"),
3051 0 => array(
'type' =>
'text',
'name' =>
'clone_ref',
'label' => $langs->trans(
"NewRefForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->ref : $tmpcode,
'morecss' =>
'width150'),
3052 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_content',
'label' => $langs->trans(
"CloneContentProduct"),
'value' => 1),
3053 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 1),
3056 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_prices',
'label' => $langs->trans(
"ClonePricesProduct").
' ('.$langs->trans(
"CustomerPrices").
')',
'value' => 0);
3059 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_composition',
'label' => $langs->trans(
'CloneCompositionProduct'),
'value' => 1);
3061 if (isModEnabled(
'bom') && $user->hasRight(
'bom',
'write')) {
3062 if (
$object->fk_default_bom > 0) {
3063 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_defbom',
'label' => $langs->trans(
"CloneDefBomProduct"),
'value' =>
getDolGlobalInt(
'BOM_CLONE_DEFBOM'));
3065 $bomstatic =
new BOM($db);
3066 $bomlist = $bomstatic->fetchAll(
"",
"", 0, 0,
'fk_product:=:'.(
int)
$object->id);
3067 if (is_array($bomlist) && count($bomlist) > 0) {
3068 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_otherboms',
'label' => $langs->trans(
"CloneOtherBomsProduct"),
'value' => 0);
3071 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneProduct',
$object->ref),
'confirm_clone', $formquestionclone,
'yes',
'action-clone', 350, 600);
3075$parameters = array(
'formConfirm' => $formconfirm,
'object' =>
$object);
3076$reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
3077if (empty($reshook)) {
3078 $formconfirm .= $hookmanager->resPrint;
3079} elseif ($reshook > 0) {
3080 $formconfirm = $hookmanager->resPrint;
3089if ($action !=
'create' && $action !=
'edit') {
3090 $cloneProductUrl = $_SERVER[
"PHP_SELF"].
'?action=clone&token='.
newToken();
3091 $cloneButtonId =
'action-clone-no-ajax';
3093 print
"\n".
'<div class="tabsAction">'.
"\n";
3095 $parameters = array();
3096 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
3097 if (empty($reshook)) {
3098 if ($usercancreate) {
3099 if (!isset($hookmanager->resArray[
'no_button_edit']) || $hookmanager->resArray[
'no_button_edit'] != 1) {
3104 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=presend&mode=init&token=' .
newToken() .
'#formmailbeforetitle');
3106 if (!isset($hookmanager->resArray[
'no_button_copy']) || $hookmanager->resArray[
'no_button_copy'] != 1) {
3107 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3108 $cloneProductUrl =
'';
3109 $cloneButtonId =
'action-clone';
3111 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneProductUrl, $cloneButtonId, $usercancreate);
3116 if ($usercandelete) {
3117 if (empty($object_is_used)) {
3118 if (!isset($hookmanager->resArray[
'no_button_delete']) || $hookmanager->resArray[
'no_button_delete'] != 1) {
3119 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3120 print
dolGetButtonAction($langs->trans(
'Delete'),
'',
'delete',
'#',
'action-delete',
true);
3126 print
dolGetButtonAction($langs->trans(
"ProductIsUsed"), $langs->trans(
'Delete'),
'delete',
'#',
'',
false);
3129 print
'<a class="butActionDelete" href="card.php?action=merge&id='.$object->id.
'" title="'.
dol_escape_htmltag($langs->trans(
"MergeProducts")).
'">'.$langs->trans(
'Merge').
'</a>'.
"\n";
3132 print
dolGetButtonAction($langs->trans(
"NotEnoughPermissions"), $langs->trans(
'Delete'),
'delete',
'#',
'',
false);
3150 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'creer')) {
3151 $propal =
new Propal($db);
3153 $langs->load(
"propal");
3155 $otherprop = $propal->liste_array(2, 1, 0);
3157 if (is_array($otherprop) && count($otherprop)) {
3158 $html .=
'<tr><td style="width: 200px;">';
3159 $html .= $langs->trans(
"AddToDraftProposals").
'</td><td>';
3160 $html .= $form->selectarray(
"propalid", $otherprop, 0, 1);
3161 $html .=
'</td></tr>';
3163 $html .=
'<tr><td style="width: 200px;">';
3164 $html .= $langs->trans(
"AddToDraftProposals").
'</td><td>';
3165 $html .= $langs->trans(
"NoDraftProposals");
3166 $html .=
'</td></tr>';
3171 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'creer')) {
3174 $langs->load(
"orders");
3176 $othercom = $commande->liste_array(2, 1,
null);
3177 if (is_array($othercom) && count($othercom)) {
3178 $html .=
'<tr><td style="width: 200px;">';
3179 $html .= $langs->trans(
"AddToDraftOrders").
'</td><td>';
3180 $html .= $form->selectarray(
"commandeid", $othercom, 0, 1);
3181 $html .=
'</td></tr>';
3183 $html .=
'<tr><td style="width: 200px;">';
3184 $html .= $langs->trans(
"AddToDraftOrders").
'</td><td>';
3185 $html .= $langs->trans(
"NoDraftOrders");
3186 $html .=
'</td></tr>';
3191 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'creer')) {
3194 $langs->load(
"bills");
3196 $otherinvoice = $invoice->liste_array(2, 1,
null);
3197 if (is_array($otherinvoice) && count($otherinvoice)) {
3198 $html .=
'<tr><td style="width: 200px;">';
3199 $html .= $langs->trans(
"AddToDraftInvoices").
'</td><td>';
3200 $html .= $form->selectarray(
"factureid", $otherinvoice, 0, 1);
3201 $html .=
'</td></tr>';
3203 $html .=
'<tr><td style="width: 200px;">';
3204 $html .= $langs->trans(
"AddToDraftInvoices").
'</td><td>';
3205 $html .= $langs->trans(
"NoDraftInvoices");
3206 $html .=
'</td></tr>';
3211 if (!empty($html)) {
3212 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
3213 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3214 print
'<input type="hidden" name="action" value="addin">';
3220 $html .=
'<tr><td class="nowrap">'.$langs->trans(
"Quantity").
' ';
3221 $html .=
'<input type="text" class="flat" name="qty" size="1" value="1"></td>';
3222 $html .=
'<td class="nowrap">'.$langs->trans(
"ReductionShort").
'(%) ';
3223 $html .=
'<input type="text" class="flat" name="remise_percent" size="1" value="0">';
3224 $html .=
'</td></tr>';
3226 print
'<table class="centpercent border">';
3230 print
'<div class="center">';
3231 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
3245if (
GETPOST(
'modelselected')) {
3246 $action =
'presend';
3249if ($action !=
'create' && $action !=
'edit' && $action !=
'delete') {
3250 print
'<div class="fichecenter"><div class="fichehalfleft">';
3251 print
'<a name="builddoc"></a>';
3255 if (!empty(
$conf->product->multidir_output[
$object->entity])) {
3256 $filedir =
$conf->product->multidir_output[
$object->entity].
'/'.$objectref;
3258 $filedir =
$conf->product->dir_output.
'/'.$objectref;
3260 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3261 $genallowed = $usercanread;
3262 $delallowed = $usercancreate;
3264 print $formfile->showdocuments($modulepart,
$object->ref, $filedir, $urlsource, (
int) $genallowed, (
int) $delallowed,
'', 0, 0, 0, 28, 0,
'',
'',
'', $langs->getDefaultLang(),
'',
$object);
3265 $somethingshown = $formfile->numoffiles;
3267 print
'</div><div class="fichehalfright">';
3270 $morehtmlcenter =
'<div class="nowraponall">';
3271 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/product/messaging.php?id='.
$object->id);
3272 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/product/agenda.php?id='.
$object->id);
3273 $morehtmlcenter .=
'</div>';
3276 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3278 $somethingshown = $formactions->showactions(
$object,
'product', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3280 print
'</div></div>';
3283 $modelmail =
'product_send';
3284 $defaulttopic =
$object->label;
3285 $diroutput =
$conf->product->multidir_output[
$object->entity];
3286 $trackid =
'prod' .
$object->id;
3288 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class of dictionary type of thirdparty (used by imports)
Class to manage categories.
Class to manage customers orders.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage invoices.
const TYPE_STANDARD
Standard invoice.
Class of a generic business object.
Class ProductCombination Used to represent the relation between a product and one of its variants.
File of class to manage predefined price products or services by customer.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
static getSellOrEatByMandatoryList()
Get the array of labels of Sell by or Eat by all mandatory flags for each status.
const TYPE_SERVICE
Service.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_move($srcfile, $destfile, $newmask='0', $overwriteifexists=1, $testvirus=0, $indexdatabase=1, $moreinfo=array(), $entity=0)
Move a file into another name.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_is_dir($folder)
Test if filename is a directory.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_ucfirst($string, $encoding="UTF-8")
Convert first character of the first word of a string to upper.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_print_url($url, $target='_blank', $max=32, $withpicto=0, $morecss='')
Show Url link.
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_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
get_default_npr(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that returns whether VAT must be recoverable collected VAT (e.g.: VAT NPR in France)
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) VAT...
get_localtax($vatrate, $local, $thirdparty_buyer=null, $thirdparty_seller=null, $vatnpr=0)
Return localtax rate for a particular vat, when selling a product with vat $vatrate,...
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
measuringUnitString($unitid, $measuring_style='', $unitscale=null, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
product_prepare_head($object)
Prepare array with list of tabs.
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.