50require
'../main.inc.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/class/genericobject.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
64require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
65require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
66require_once DOL_DOCUMENT_ROOT.
'/core/modules/product/modules_product.class.php';
67require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
68require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
69require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
71 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
74 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
77 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
80 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
81 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
82 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
85 require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
89 require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
93$langs->loadLangs(array(
'products',
'other'));
95 $langs->load(
"stocks");
98 $langs->load(
"bills");
101 $langs->load(
"productbatch");
104$backtopageforcancel =
GETPOST(
'backtopageforcancel');
110$refalreadyexists = 0;
116 $security_check =
'nohtml';
118 $security_check = !
getDolGlobalString(
'MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML') ?
'alphanohtml' :
'restricthtml';
122$action = (
GETPOST(
'action',
'alpha') ?
GETPOST(
'action',
'alpha') :
'view');
123$cancel =
GETPOST(
'cancel',
'alpha');
124$backtopage =
GETPOST(
'backtopage',
'alpha');
125$dol_openinpopup =
GETPOST(
'dol_openinpopup',
'aZ09');
126$confirm =
GETPOST(
'confirm',
'alpha');
128$duration_value =
GETPOST(
'duration_value') ===
'' ? null :
GETPOSTINT(
'duration_value');
129$duration_unit =
GETPOST(
'duration_unit',
'alpha');
131$accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
132$accountancy_code_sell_intra =
GETPOST(
'accountancy_code_sell_intra',
'alpha');
133$accountancy_code_sell_export =
GETPOST(
'accountancy_code_sell_export',
'alpha');
134$accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
135$accountancy_code_buy_intra =
GETPOST(
'accountancy_code_buy_intra',
'alpha');
136$accountancy_code_buy_export =
GETPOST(
'accountancy_code_buy_export',
'alpha');
138$checkmandatory =
GETPOST(
'accountancy_code_buy_export',
'alpha');
142 $label_security_check =
'nohtml';
144 $label_security_check = !
getDolGlobalString(
'MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML') ?
'alphanohtml' :
'restricthtml';
147if (!empty($user->socid)) {
148 $socid = $user->socid;
153if (substr(
$module, 0, 16) ==
'mod_codeproduct_' && substr(
$module, -3) ==
'php') {
158 $modCodeProduct =
new $module();
167$extrafields->fetch_name_optionals_label(
$object->table_element);
169if ($id > 0 || !empty($ref)) {
170 $result =
$object->fetch($id, (
string) $ref);
176 $upload_dir =
$conf->product->multidir_output[$entity].
'/'.
get_exdir(0, 0, 0, 0, $object,
'product').dol_sanitizeFileName(
$object->ref);
178 $upload_dir =
$conf->service->multidir_output[$entity].
'/'.
get_exdir(0, 0, 0, 0, $object,
'product').dol_sanitizeFileName(
$object->ref);
183 $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";
185 $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";
190$modulepart =
'product';
195if (!empty($canvas)) {
196 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
197 $objcanvas =
new Canvas($db, $action);
198 $objcanvas->getCanvas(
'product',
'card', $canvas);
202$fieldvalue = (!empty($id) ?
$id : (!empty($ref) ? $ref :
''));
203$fieldtype = (!empty($id) ?
'rowid' :
'ref');
206$hookmanager->initHooks(array(
'productcard',
'globalcard'));
209 if (
$object->type == $object::TYPE_PRODUCT) {
212 if (
$object->type == $object::TYPE_SERVICE) {
216 restrictedArea($user,
'produit|service', 0,
'product&product',
'',
'', $fieldtype);
223$permissiontoeditextra = $usercancreate;
224if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
226 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
239if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'creer_advance')) {
243$parameters = array(
'id' => $id,
'ref' => $ref,
'objcanvas' => $objcanvas);
244$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
246 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
249if (empty($reshook)) {
250 $backurlforlist = DOL_URL_ROOT.
'/product/list.php?type='.$type;
252 if (empty($backtopage) || ($cancel && empty($id))) {
253 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
254 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
255 $backtopage = $backurlforlist;
257 $backtopage = DOL_URL_ROOT.
'/product/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
263 if (!empty($backtopageforcancel)) {
264 header(
"Location: ".$backtopageforcancel);
266 } elseif (!empty($backtopage)) {
267 header(
"Location: ".$backtopage);
273 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $usercandelete) {
275 $productOriginId =
GETPOSTINT(
'product_origin');
276 $productOrigin =
new Product($db);
278 if ($productOriginId <= 0) {
279 $langs->load(
'errors');
280 setEventMessages($langs->trans(
'ErrorProductIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginProduct')),
null,
'errors');
282 if (!$error && $productOrigin->fetch($productOriginId) < 1) {
283 setEventMessages($langs->trans(
'ErrorRecordNotFound'),
null,
'errors');
289 setEventMessages($langs->trans(
'NotEnoughPermissions'),
null,
'errors');
294 $result =
$object->mergeProduct($productOriginId);
299 setEventMessages($langs->trans(
'ProductsMergeSuccess'),
null,
'mesgs');
306 if ($action ==
'setfk_product_type' && $usercancreate) {
307 $result =
$object->setValueFrom(
'fk_product_type',
GETPOST(
'fk_product_type'),
'',
null,
'text',
'', $user,
'PRODUCT_MODIFY');
308 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
313 $upload_dir =
$conf->product->dir_output;
314 $permissiontoadd = $usercancreate;
315 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
317 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
320 if ($action ==
'setfk_barcode_type' && $usercancreate) {
321 $result =
$object->setValueFrom(
'fk_barcode_type',
GETPOST(
'fk_barcode_type'),
'',
null,
'text',
'', $user,
'PRODUCT_MODIFY');
322 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
327 if ($action ==
'setbarcode' && $usercancreate) {
331 $result =
$object->setValueFrom(
'barcode',
GETPOST(
'barcode'),
'',
null,
'text',
'', $user,
'PRODUCT_MODIFY');
332 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
335 $langs->load(
"errors");
337 $errors[] =
'ErrorBadBarCodeSyntax';
338 } elseif ($result == -2) {
339 $errors[] =
'ErrorBarCodeRequired';
340 } elseif ($result == -3) {
341 $errors[] =
'ErrorBarCodeAlreadyUsed';
343 $errors[] =
'FailedToValidateBarCode';
347 setEventMessages(
'', $errors,
'errors');
352 if ($action ==
'update_extras' && $permissiontoeditextra) {
356 $attribute_name =
GETPOST(
'attribute',
'aZ09');
359 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
365 $result =
$object->updateExtraField($attribute_name,
'PRODUCT_MODIFY');
373 $action =
'edit_extras';
378 if ($action ==
'add' && $usercancreate) {
381 if (!
GETPOST(
'label', $label_security_check)) {
382 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentities(
'Label')),
null,
'errors');
388 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentities($refLabelKey)),
null,
'errors');
393 if (!empty($duration_value) && empty($duration_unit)) {
394 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentities(
'Unit')),
null,
'errors');
398 $stockable_product = (int) ($type == 0 || ($type == 1 &&
getDolGlobalInt(
'STOCK_SUPPORTS_SERVICES')));
401 $stockable_product =
GETPOSTISSET(
'stockable_product') ? 1 : 0;
404 setEventMessages($langs->trans(
'ErrorBatchesNeedStockManagement'),
null,
'errors');
416 $object->mandatory_period = empty(
GETPOST(
"mandatoryperiod",
'alpha')) ? 0 : 1;
417 if (
$object->price_base_type ==
'TTC') {
422 if (
$object->price_base_type ==
'TTC') {
428 $tva_tx_txt =
GETPOST(
'tva_tx',
'alpha');
432 $tva_tx = preg_replace(
'/[^0-9\.].*$/',
'', $tva_tx_txt);
433 $npr = preg_match(
'/\*/', $tva_tx_txt) ? 1 : 0;
436 $localtax1_type =
'0';
437 $localtax2_type =
'0';
440 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
442 $vatratecode = $reg[1];
444 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
445 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
446 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
447 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
448 $sql .=
" AND t.code = '".$db->escape($vatratecode).
"'";
449 $sql .=
" AND t.entity IN (".getEntity(
'c_tva').
")";
450 $resql = $db->query($sql);
452 $obj = $db->fetch_object($resql);
453 $npr = $obj->recuperableonly;
454 $localtax1 = $obj->localtax1;
455 $localtax2 = $obj->localtax2;
456 $localtax1_type = $obj->localtax1_type;
457 $localtax2_type = $obj->localtax2_type;
461 $object->default_vat_code = $vatratecode;
464 $object->localtax1_tx = $localtax1;
465 $object->localtax2_tx = $localtax2;
466 $object->localtax1_type = $localtax1_type;
467 $object->localtax2_type = $localtax2_type;
480 $stdobject->element =
'product';
481 $stdobject->barcode_type =
GETPOSTINT(
'fk_barcode_type');
482 $result = $stdobject->fetchBarCode();
485 $mesg =
'Failed to get bar code type information ';
486 setEventMessages($mesg.$stdobject->error, $stdobject->errors,
'errors');
488 $object->barcode_type_code = $stdobject->barcode_type_code;
489 $object->barcode_type_coder = $stdobject->barcode_type_coder;
490 $object->barcode_type_label = $stdobject->barcode_type_label;
501 $object->duration_value = $duration_value;
502 $object->duration_unit = $duration_unit;
521 if ($finished >= 0) {
534 $object->stockable_product = $stockable_product;
536 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
537 $accountancy_code_sell_intra =
GETPOST(
'accountancy_code_sell_intra',
'alpha');
538 $accountancy_code_sell_export =
GETPOST(
'accountancy_code_sell_export',
'alpha');
539 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
540 $accountancy_code_buy_intra =
GETPOST(
'accountancy_code_buy_intra',
'alpha');
541 $accountancy_code_buy_export =
GETPOST(
'accountancy_code_buy_export',
'alpha');
543 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
544 $object->accountancy_code_sell =
'';
546 $object->accountancy_code_sell = $accountancy_code_sell;
548 if (empty($accountancy_code_sell_intra) || $accountancy_code_sell_intra ==
'-1') {
549 $object->accountancy_code_sell_intra =
'';
551 $object->accountancy_code_sell_intra = $accountancy_code_sell_intra;
553 if (empty($accountancy_code_sell_export) || $accountancy_code_sell_export ==
'-1') {
554 $object->accountancy_code_sell_export =
'';
556 $object->accountancy_code_sell_export = $accountancy_code_sell_export;
558 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
559 $object->accountancy_code_buy =
'';
561 $object->accountancy_code_buy = $accountancy_code_buy;
563 if (empty($accountancy_code_buy_intra) || $accountancy_code_buy_intra ==
'-1') {
564 $object->accountancy_code_buy_intra =
'';
566 $object->accountancy_code_buy_intra = $accountancy_code_buy_intra;
568 if (empty($accountancy_code_buy_export) || $accountancy_code_buy_export ==
'-1') {
569 $object->accountancy_code_buy_export =
'';
571 $object->accountancy_code_buy_export = $accountancy_code_buy_export;
577 for ($i = 2; $i <= $produit_multiprices_limit; $i++) {
580 $object->multiprices_base_type[
"$i"] =
GETPOST(
"multiprices_base_type_".$i);
582 $object->multiprices[
"$i"] = 0;
588 $ret = $extrafields->setOptionalsFromPost(
null, $object);
595 '@phan-var ModeleProductCode $modCodeProduct';
597 $ref = $modCodeProduct->getNextValue($object, $type);
606 $categories =
GETPOST(
'categories',
'array:int');
607 $object->setCategories($categories);
609 if (!empty($backtopage)) {
610 $backtopage = preg_replace(
'/__ID__/', (
string)
$object->id, $backtopage);
611 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
612 if (preg_match(
'/\?/', $backtopage)) {
613 $backtopage .=
'&productid='.$object->id;
616 if (!empty($dol_openinpopup)) {
618 print
'<script nonce="'.getNonce().
'">';
619 print
"window.parent.location.href = '".dol_escape_js($backtopage).
"';";
623 header(
"Location: ".$backtopage);
626 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$id);
633 if (
$object->error ==
'ErrorProductAlreadyExists') {
635 $reshook = $hookmanager->executeHooks(
'onProductAlreadyExists', $parameters, $object, $action);
637 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
642 setEventMessages($langs->trans(
$object->error),
null,
'errors');
645 setEventMessages($langs->trans(
$object->error),
null,
'errors');
654 if ($action ==
'update' && $usercancreate) {
655 if (
GETPOST(
'cancel',
'alpha')) {
692 $object->duration_value = $duration_value;
693 $object->duration_unit = $duration_unit;
711 if ($finished >= 0) {
717 $fk_default_bom =
GETPOSTINT(
'fk_default_bom');
718 if ($fk_default_bom >= 0) {
719 $object->fk_default_bom = $fk_default_bom;
727 $object->stockable_product = 1;
728 setEventMessages($langs->trans(
'ForceBatchesNeedStockManagement'),
null,
'warnings');
742 $stdobject->element =
'product';
743 $stdobject->barcode_type =
GETPOSTINT(
'fk_barcode_type');
744 $result = $stdobject->fetchBarCode();
747 $mesg =
'Failed to get bar code type information ';
748 setEventMessages($mesg.$stdobject->error, $stdobject->errors,
'errors');
750 $object->barcode_type_code = $stdobject->barcode_type_code;
751 $object->barcode_type_coder = $stdobject->barcode_type_coder;
752 $object->barcode_type_label = $stdobject->barcode_type_label;
754 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
755 $accountancy_code_sell_intra =
GETPOST(
'accountancy_code_sell_intra',
'alpha');
756 $accountancy_code_sell_export =
GETPOST(
'accountancy_code_sell_export',
'alpha');
757 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
758 $accountancy_code_buy_intra =
GETPOST(
'accountancy_code_buy_intra',
'alpha');
759 $accountancy_code_buy_export =
GETPOST(
'accountancy_code_buy_export',
'alpha');
760 $checkmandatory =
GETPOST(
'mandatoryperiod',
'alpha');
761 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
762 $object->accountancy_code_sell =
'';
764 $object->accountancy_code_sell = $accountancy_code_sell;
766 if (empty($accountancy_code_sell_intra) || $accountancy_code_sell_intra ==
'-1') {
767 $object->accountancy_code_sell_intra =
'';
769 $object->accountancy_code_sell_intra = $accountancy_code_sell_intra;
771 if (empty($accountancy_code_sell_export) || $accountancy_code_sell_export ==
'-1') {
772 $object->accountancy_code_sell_export =
'';
774 $object->accountancy_code_sell_export = $accountancy_code_sell_export;
776 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
777 $object->accountancy_code_buy =
'';
779 $object->accountancy_code_buy = $accountancy_code_buy;
781 if (empty($accountancy_code_buy_intra) || $accountancy_code_buy_intra ==
'-1') {
782 $object->accountancy_code_buy_intra =
'';
784 $object->accountancy_code_buy_intra = $accountancy_code_buy_intra;
786 if (empty($accountancy_code_buy_export) || $accountancy_code_buy_export ==
'-1') {
787 $object->accountancy_code_buy_export =
'';
789 $object->accountancy_code_buy_export = $accountancy_code_buy_export;
792 $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ;
797 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
808 $object->sell_or_eat_by_mandatory =
$object->oldcopy->sell_or_eat_by_mandatory;
814 if (!$error &&
$object->check()) {
817 $categories =
GETPOST(
'categories',
'array:int');
818 $object->setCategories($categories);
825 setEventMessages($langs->trans(
$object->error),
null,
'errors');
833 setEventMessages($langs->trans(
"ErrorProductBadRefOrLabel"),
null,
'errors');
842 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
845 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $usercancreate) {
847 setEventMessages($langs->trans(
"NoCloneOptionsSpecified"),
null,
'errors');
856 unset($clone->date_creation);
857 $clone->ref =
GETPOST(
'clone_ref',
'alphanohtml');
859 $clone->status_buy = 0;
860 $clone->barcode = -1;
862 if ($clone->check()) {
865 $clone->context[
'createfromclone'] =
'createfromclone';
866 $id = $clone->create($user);
868 if (
GETPOST(
'clone_composition')) {
869 $result = $clone->clone_associations(
$object->id, $id);
871 setEventMessages($langs->trans(
'ErrorProductClone'),
null,
'errors');
872 setEventMessages($clone->error, $clone->errors,
'errors');
877 if (!$error &&
GETPOST(
'clone_categories')) {
878 $result = $clone->cloneCategories(
$object->id, $id);
880 setEventMessages($langs->trans(
'ErrorProductClone'),
null,
'errors');
881 setEventMessages($clone->error, $clone->errors,
'errors');
886 if (!$error &&
GETPOST(
'clone_prices')) {
887 $result = $clone->clone_price(
$object->id, $id);
889 setEventMessages($langs->trans(
'ErrorProductClone'),
null,
'errors');
890 setEventMessages($clone->error, $clone->errors,
'errors');
895 if (!$error &&
GETPOST(
'clone_supplier_prices')) {
896 $result = $clone->clone_fournisseurs(
$object->id, $id);
898 setEventMessages($langs->trans(
'ErrorProductClone'),
null,
'errors');
899 setEventMessages($clone->error, $clone->errors,
'errors');
904 if (!$error &&
isModEnabled(
'bom') && $user->hasRight(
'bom',
'write')) {
907 $bomstatic =
new BOM($db);
908 $bomclone = $bomstatic->createFromClone($user,
$object->fk_default_bom);
909 if ((
int) $bomclone < 0) {
910 setEventMessages($langs->trans(
'ErrorProductClone').
' : '.$langs->trans(
'ErrorProductCloneBom'),
null,
'warnings');
912 $defbomidac =
$object->fk_default_bom;
913 $clone->fk_default_bom = $bomclone->id;
914 $clone->update($id, $user);
915 $bomclone->fk_product =
$id;
916 $bomclone->label = $langs->trans(
'BOMofRef', $clone->ref);
917 $bomclone->update($user);
918 $bomclone->validate($user);
921 if (
GETPOST(
'clone_otherboms')) {
922 $bomstatic =
new BOM($db);
923 $bomlist = $bomstatic->fetchAll(
"",
"", 0, 0,
'fk_product:=:'.(
int)
$object->id);
924 if (is_array($bomlist)) {
925 foreach ($bomlist as $bom2clone) {
926 if ($bom2clone->id != $defbomidac) {
927 $bomclone = $bomstatic->createFromClone($user, $bom2clone->id);
928 if ((
int) $bomclone < 0) {
929 setEventMessages($langs->trans(
'ErrorProductClone').
' : '.$langs->trans(
'ErrorProductCloneBom'),
null,
'warnings');
931 $bomclone->fk_product =
$id;
932 $bomclone->label = $langs->trans(
'BOMofRef', $clone->ref);
933 $bomclone->update($user);
934 $bomclone->validate($user);
942 if ($clone->error ==
'ErrorProductAlreadyExists') {
946 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
947 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
948 setEventMessages($mesg,
null,
'errors');
950 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
955 unset($clone->context[
'createfromclone']);
962 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
966 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
976 if ($action ==
'confirm_delete' && $confirm !=
'yes') {
979 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $usercandelete) {
981 $result =
$object->delete($user);
984 header(
'Location: '.DOL_URL_ROOT.
'/product/list.php?type='.
$object->type.
'&delprod='.urlencode(
$object->ref));
987 setEventMessages($langs->trans(
$object->error),
null,
'errors');
995 if (
$object->id > 0 && $action ==
'addin') {
997 $permissiontoaddline =
false;
1004 $propal =
new Propal($db);
1005 $result = $propal->fetch(
GETPOSTINT(
'propalid'));
1007 dol_print_error($db, $propal->error);
1010 $thirdpartyid = $propal->socid;
1011 $permissiontoaddline = $user->hasRight(
'propal',
'creer');
1014 $result = $commande->fetch(
GETPOSTINT(
'commandeid'));
1016 dol_print_error($db, $commande->error);
1019 $thirdpartyid = $commande->socid;
1020 $permissiontoaddline = $user->hasRight(
'commande',
'creer');
1023 $result = $facture->fetch(
GETPOSTINT(
'factureid'));
1025 dol_print_error($db, $facture->error);
1028 $thirdpartyid = $facture->socid;
1029 $permissiontoaddline = $user->hasRight(
'facture',
'creer');
1032 if ($thirdpartyid > 0) {
1034 $result = $soc->fetch($thirdpartyid);
1036 dol_print_error($db, $soc->error);
1044 if (empty($tva_tx)) {
1052 $price_base_type =
$object->price_base_type;
1056 $pu_ht =
$object->multiprices[$soc->price_level];
1057 $pu_ttc =
$object->multiprices_ttc[$soc->price_level];
1058 $price_base_type =
$object->multiprices_base_type[$soc->price_level];
1060 require_once DOL_DOCUMENT_ROOT.
'/product/class/productcustomerprice.class.php';
1064 $filter = array(
't.fk_product' => (
string)
$object->id,
't.fk_soc' => (
string) $soc->id);
1066 $result = $prodcustprice->fetchAll(
'',
'', 0, 0, $filter);
1068 if (count($prodcustprice->lines) > 0) {
1069 $date_now = (int) floor(
dol_now() / 86400) * 86400;
1070 foreach ($prodcustprice->lines as $k => $custprice_line) {
1071 if ($custprice_line->date_begin <= $date_now && (empty($custprice_line->date_end) || $date_now <= $custprice_line->date_end)) {
1072 $pu_ht =
price($custprice_line->price);
1073 $pu_ttc =
price($custprice_line->price_ttc);
1074 $price_base_type = $custprice_line->price_base_type;
1075 $tva_tx = $custprice_line->tva_tx;
1083 $tmpvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'', $tva_tx));
1084 $tmpprodvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'',
$object->tva_tx));
1088 if ($tmpvat != $tmpprodvat) {
1089 if ($price_base_type !=
'HT') {
1090 $pu_ht =
price2num($pu_ttc / (1 + ((
float) $tmpvat / 100)),
'MU');
1092 $pu_ttc =
price2num($pu_ht * (1 + ((
float) $tmpvat / 100)),
'MU');
1096 if (
GETPOSTINT(
'propalid') > 0 && $permissiontoaddline && is_object($propal)) {
1099 if (($result = $propal->defineBuyPrice($pu_ht, (
float)
price2num(
GETPOST(
'remise_percent'),
'', 2),
$object->id)) < 0) {
1100 dol_syslog($langs->trans(
'FailedToGetCostPrice'));
1101 setEventMessages($langs->trans(
'FailedToGetCostPrice'),
null,
'errors');
1103 $buyprice = $result;
1106 $result = $propal->addline(
1131 header(
"Location: ".DOL_URL_ROOT.
"/comm/propal/card.php?id=".$propal->id);
1135 setEventMessages($langs->trans(
"ErrorUnknown").
": $result",
null,
'errors');
1136 } elseif (
GETPOST(
'commandeid') > 0 && $permissiontoaddline && is_object($commande)) {
1139 if (($result = $commande->defineBuyPrice($pu_ht, (
float)
price2num(
GETPOST(
'remise_percent'),
'', 2),
$object->id)) < 0) {
1140 dol_syslog($langs->trans(
'FailedToGetCostPrice'));
1141 setEventMessages($langs->trans(
'FailedToGetCostPrice'),
null,
'errors');
1143 $buyprice = $result;
1146 $result = $commande->addline(
1173 header(
"Location: ".DOL_URL_ROOT.
"/commande/card.php?id=".urlencode((
string) ($commande->id)));
1177 setEventMessages($langs->trans(
"ErrorUnknown").
": $result",
null,
'errors');
1178 } elseif (
GETPOST(
'factureid') > 0 && $permissiontoaddline && is_object($facture)) {
1181 if (($result = $facture->defineBuyPrice($pu_ht, (
float)
price2num(
GETPOST(
'remise_percent'),
'', 2),
$object->id)) < 0) {
1182 dol_syslog($langs->trans(
'FailedToGetCostPrice'));
1183 setEventMessages($langs->trans(
'FailedToGetCostPrice'),
null,
'errors');
1185 $buyprice = $result;
1188 $result = $facture->addline(
1220 header(
"Location: ".DOL_URL_ROOT.
"/compta/facture/card.php?facid=".$facture->id);
1224 setEventMessages($langs->trans(
"ErrorUnknown").
": $result",
null,
'errors');
1228 setEventMessages($langs->trans(
"WarningSelectOneDocument"),
null,
'warnings');
1233 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
1236 $triggersendname =
'PRODUCT_SENTBYMAIL';
1238 $autocopy =
'MAIN_MAIL_AUTOCOPY_PRODUCT_TO';
1239 $trackid =
'prod'.$object->id;
1240 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
1249$form =
new Form($db);
1253$formaccounting =
null;
1257$sellOrEatByMandatoryList =
null;
1264 if ($disableSellBy) {
1265 unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_BY]);
1266 unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_AND_EAT]);
1268 if ($disableEatBy) {
1269 unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_EAT_BY]);
1270 unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_AND_EAT]);
1274$title = $langs->trans(
'ProductServiceCard');
1279 if ($action ==
'create') {
1280 $title = $langs->trans(
"NewProduct");
1282 $title = $langs->trans(
'Product').
" ".$shortlabel.
" - ".$langs->trans(
'Card');
1283 $help_url =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos|DE:Modul_Produkte';
1287 if ($action ==
'create') {
1288 $title = $langs->trans(
"NewService");
1290 $title = $langs->trans(
'Service').
" ".$shortlabel.
" - ".$langs->trans(
'Card');
1291 $help_url =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios|DE:Modul_Leistungen';
1295llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-card');
1299$modBarCodeProduct =
null;
1302 $dirbarcode = array_merge(array(
'/core/modules/barcode/'),
$conf->modules_parts[
'barcode']);
1303 foreach ($dirbarcode as $dirroot) {
1310 $modBarCodeProduct =
new $module();
1311 '@phan-var-force ModeleNumRefBarCode $modBarCodeProduct';
1315$canvasdisplayaction = $action;
1316if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
1317 $canvasdisplayaction =
'view';
1320if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
1324 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
1325 $objcanvas->display_canvas($canvasdisplayaction);
1330 if ($action ==
'create' && $usercancreate) {
1332 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1334 if (!empty(
$conf->use_javascript_ajax)) {
1335 print
'<script type="text/javascript">';
1336 print
'$(document).ready(function () {
1337 $("#selectcountry_id").change(function() {
1338 console.log("selectcountry_id change");
1339 document.formprod.action.value="create";
1340 document.formprod.submit();
1343 print
'</script>'.
"\n";
1348 if (substr(
$module, 0, 16) ==
'mod_codeproduct_' && substr(
$module, -3) ==
'php') {
1353 $modCodeProduct =
new $module();
1359 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formprod">';
1360 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1361 print
'<input type="hidden" name="action" value="add">';
1362 print
'<input type="hidden" name="type" value="'.$type.
'">'.
"\n";
1363 if (!empty($modCodeProduct->code_auto)) {
1364 print
'<input type="hidden" name="code_auto" value="1">';
1366 if (!empty($modBarCodeProduct->code_auto)) {
1367 print
'<input type="hidden" name="barcode_auto" value="1">';
1369 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1370 print
'<input type="hidden" name="dol_openinpopup" value="'.dol_escape_htmltag($dol_openinpopup).
'">';
1371 if (!empty($backtopageforcancel)) {
1372 print
'<input type="hidden" name="backtopageforcancel" value="'.dol_escape_htmltag($backtopageforcancel).
'">';
1377 $title = $langs->trans(
"NewService");
1380 $title = $langs->trans(
"NewProduct");
1387 if (
$object->country_id > 0) {
1389 $object->country_code = $tmparray[
'code'];
1390 $object->country = $tmparray[
'label'];
1396 $parameters = array();
1398 $reshook = $hookmanager->executeHooks(
'tabContentCreateProduct', $parameters, $object, $action);
1399 if (empty($reshook)) {
1400 print
'<table class="border centpercent">';
1405 if (!empty($modCodeProduct->code_auto)) {
1407 $tmpcode = $modCodeProduct->getNextValue($object, $type);
1409 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans($refLabelKey).
'</td><td><input id="ref" name="ref" class="maxwidth200" maxlength="128" value="'.
dol_escape_htmltag(
GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alphanohtml') : $tmpcode).
'">';
1410 if ($refalreadyexists) {
1411 print $langs->trans(
"RefAlreadyExists");
1417 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>';
1420 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
' ('.$langs->trans(
"Sell").
')</td><td>';
1421 $statutarray = array(
'1' => $langs->trans(
"OnSell"),
'0' => $langs->trans(
"NotOnSell"));
1422 print $form->selectarray(
'statut', $statutarray,
GETPOST(
'statut'));
1426 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
' ('.$langs->trans(
"Buy").
')</td><td>';
1427 $statutarray = array(
'1' => $langs->trans(
"ProductStatusOnBuy"),
'0' => $langs->trans(
"ProductStatusNotOnBuy"));
1428 print $form->selectarray(
'statut_buy', $statutarray,
GETPOST(
'statut_buy'));
1433 print
'<tr><td>'.$langs->trans(
"ManageLotSerial").
'</td><td>';
1434 $statutarray = array(
'0' => $langs->trans(
"ProductStatusNotOnBatch"),
'1' => $langs->trans(
"ProductStatusOnBatch"),
'2' => $langs->trans(
"ProductStatusOnSerial"));
1435 print $form->selectarray(
'status_batch', $statutarray,
GETPOSTINT(
'status_batch'));
1439 if ($status_batch !==
'0') {
1440 $langs->load(
"admin");
1441 $tooltip = $langs->trans(
"GenericMaskCodes", $langs->transnoentities(
"Batch"), $langs->transnoentities(
"Batch"));
1442 $tooltip .= $langs->trans(
"GenericMaskCodes1");
1443 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes2");
1444 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes3");
1445 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes4a", $langs->transnoentities(
"Batch"), $langs->transnoentities(
"Batch"));
1446 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes5");
1451 print
'<tr><td id="mask_option">'.$langs->trans(
"ManageLotMask").
'</td>';
1454 print
'<td id="field_mask">';
1455 print $form->textwithpicto(
'<input type="text" class="flat minwidth175" name="batch_mask" id="batch_mask_input">', $tooltip, 1,
'help');
1456 print
'<script type="text/javascript">
1457 $(document).ready(function() {
1458 $("#field_mask, #mask_option").addClass("hideobject");
1459 $("#status_batch").on("change", function () {
1460 console.log("We change batch status");
1461 var optionSelected = $("option:selected", this);
1462 var valueSelected = this.value;
1463 $("#field_mask, #mask_option").addClass("hideobject");
1467 if (this.value == 1) {
1468 $("#field_mask, #mask_option").toggleClass("hideobject");
1469 $("#batch_mask_input").val("'.$inherited_mask_lot.
'");
1475 if (this.value == 2) {
1476 $("#field_mask, #mask_option").toggleClass("hideobject");
1477 $("#batch_mask_input").val("'.$inherited_mask_sn.
'");
1490 if (!empty($sellOrEatByMandatoryList)) {
1491 print
'<tr><td>'.$langs->trans(
'BatchSellOrEatByMandatoryList', $langs->transnoentities(
'SellByDate'), $langs->transnoentities(
'EatByDate')).
'</td><td>';
1492 print $form->selectarray(
'sell_or_eat_by_mandatory', $sellOrEatByMandatoryList,
GETPOSTINT(
'sell_or_eat_by_mandatory'));
1498 if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'lire_advance')) {
1503 print
'<tr><td>'.$langs->trans(
'BarcodeType').
'</td><td>';
1505 $fk_barcode_type =
GETPOST(
'fk_barcode_type') ?
GETPOST(
'fk_barcode_type') : 0;
1510 $fk_barcode_type = 0;
1513 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbarcode.class.php';
1515 print $formbarcode->selectBarcodeType($fk_barcode_type,
'fk_barcode_type', 1);
1520 print
'<td'.((is_object($modBarCodeProduct) && $modBarCodeProduct->code_null) ?
'' :
' class="fieldrequired"').
'>'.$langs->trans(
"BarcodeValue").
'</td><td>';
1522 if (empty($tmpcode) && is_object($modBarCodeProduct) && !empty($modBarCodeProduct->code_auto)) {
1523 $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type);
1525 print img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1526 print
'<input class="maxwidth150" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).
'">';
1531 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
1532 $doleditor =
new DolEditor(
'desc',
GETPOST(
'desc',
'restricthtml'),
'', 160,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_4,
'90%');
1533 $doleditor->Create();
1538 print
'<tr><td>'.$langs->trans(
"PublicUrl").
'</td><td>';
1539 print img_picto(
'',
'globe',
'class="pictofixedwidth"');
1540 print
'<input type="text" name="url" class="quatrevingtpercent" value="'.GETPOST(
'url').
'">';
1547 print
'<tr><td><input type="hidden" id="stockable_product" name="stockable_product" value="on" /></td><td></td></tr>';
1548 $checked_stockable =
'checked';
1550 $checked_stockable = ($type == 0 ||
getDolGlobalInt(
'STOCK_SUPPORTS_SERVICES')) ?
'checked' :
'';
1551 print
'<tr><td><label for="stockable_product">' . $langs->trans(
"StockableProduct") .
'</label></td>';
1552 print
'<td><input type="checkbox" id="stockable_product" name="stockable_product" ' . $checked_stockable .
' /></td></tr>';
1555 print
'<tr class="showifstockable' . (empty($checked_stockable) ?
' hidden' :
'') .
'"><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1556 print img_picto($langs->trans(
"DefaultWarehouse"),
'stock',
'class="pictofixedwidth"');
1557 print $formproduct->selectWarehouses(
GETPOSTINT(
'fk_default_warehouse'),
'fk_default_warehouse',
'warehouseopen', 1, 0, 0,
'', 0, 0, array(),
'minwidth300 widthcentpercentminusxx maxwidth500');
1558 print
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create&token='.
newToken().
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?&action=create&type='.
GETPOSTINT(
'type')).
'">';
1559 print
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddWarehouse").
'"></span>';
1567 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"StockLimit"), $langs->trans(
"StockLimitDesc"), 1).
'</td><td>';
1568 print
'<input name="seuil_stock_alerte" class="maxwidth50" value="'.GETPOST(
'seuil_stock_alerte').
'">';
1573 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"DesiredStock"), $langs->trans(
"DesiredStockDesc"), 1).
'</td><td>';
1574 print
'<input name="desiredstock" class="maxwidth50" value="'.GETPOST(
'desiredstock').
'">';
1579 print
'<input name="seuil_stock_alerte" type="hidden" value="0">';
1580 print
'<input name="desiredstock" type="hidden" value="0">';
1584 if ($type == $object::TYPE_SERVICE &&
isModEnabled(
"workstation")) {
1586 print
'<tr><td>'.$langs->trans(
"DefaultWorkstation").
'</td><td>';
1587 print img_picto($langs->trans(
"DefaultWorkstation"),
'workstation',
'class="pictofixedwidth"');
1588 print $formproduct->selectWorkstations((
GETPOSTISSET(
'fk_default_workstation') ?
GETPOSTINT(
'fk_default_workstation') :
''),
'fk_default_workstation', 1);
1594 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td>';
1595 print img_picto(
'',
'clock',
'class="pictofixedwidth"');
1596 print
'<input name="duration_value" class="width50 valignmiddle" value="'.(GETPOSTISSET(
'duration_value') ?
GETPOST(
'duration_value') :
'').
'">';
1597 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", (
GETPOSTISSET(
'duration_unit') ?
GETPOST(
'duration_unit',
'alpha') :
'h'), 0, 1);
1600 if (
$object->duration_value > 0) {
1601 print
' ';
1603 print
'<input type="checkbox" class="marginleftonly valignmiddle" id="mandatoryperiod" name="mandatoryperiod"'.(GETPOSTISSET(
'mandatoryperiod') ?
' checked="checked"' :
'').
'>';
1604 print
'<label for="mandatoryperiod">';
1605 $htmltooltip = $langs->trans(
"mandatoryHelper");
1607 $htmltooltip .=
'<br>'.$langs->trans(
"mandatoryHelper2");
1609 print $form->textwithpicto($langs->trans(
"mandatoryperiod"), $htmltooltip, 1,
'info');
1618 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"NatureOfProductShort"), $langs->trans(
"NatureOfProductDesc")).
'</td><td>';
1619 print $formproduct->selectProductNature(
'finished', (
GETPOSTISSET(
'finished') ?
GETPOST(
'finished') : (string)
$object->finished));
1627 print
'<tr><td>'.$langs->trans(
"Weight").
'</td><td>';
1628 print img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1629 print
'<input name="weight" size="4" value="'.GETPOST(
'weight').
'">';
1630 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);
1636 print
'<tr><td>'.$langs->trans(
"Length").
' x '.$langs->trans(
"Width").
' x '.$langs->trans(
"Height").
'</td><td>';
1637 print img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1638 print
'<input name="size" class="width50" value="'.GETPOST(
'size').
'"> x ';
1639 print
'<input name="sizewidth" class="width50" value="'.GETPOST(
'sizewidth').
'"> x ';
1640 print
'<input name="sizeheight" class="width50" value="'.GETPOST(
'sizeheight').
'">';
1641 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTISSET(
'size_units') ?
GETPOST(
'size_units',
'alpha') : (
GETPOST(
'size_units',
'alpha') ?:
'0'), 0, 2);
1646 print
'<tr><td>'.$langs->trans(
"Surface").
'</td><td>';
1647 print
'<input name="surface" size="4" value="'.GETPOST(
'surface').
'">';
1648 print $formproduct->selectMeasuringUnits(
"surface_units",
"surface",
GETPOSTISSET(
'surface_units') ?
GETPOST(
'surface_units',
'alpha') : (
GETPOST(
'surface_units',
'alpha') ?:
'0'), 0, 2);
1653 print
'<tr><td>'.$langs->trans(
"Volume").
'</td><td>';
1654 print
'<input name="volume" size="4" value="'.GETPOST(
'volume').
'">';
1655 print $formproduct->selectMeasuringUnits(
"volume_units",
"volume",
GETPOSTISSET(
'volume_units') ?
GETPOST(
'volume_units',
'alpha') : (
GETPOST(
'volume_units',
'alpha') ?:
'0'), 0, 2);
1661 print
'<tr><td>'.$langs->trans(
"NetMeasure").
'</td><td>';
1662 print
'<input name="net_measure" size="4" value="'.GETPOST(
'net_measure').
'">';
1663 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);
1670 print
'<tr><td>'.$langs->trans(
'DefaultUnitToShow').
'</td>';
1678 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>';
1681 print
'<tr><td>'.$langs->trans(
"CountryOrigin").
'</td>';
1683 print img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
1684 print $form->select_country((
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth300 widthcentpercentminusx maxwidth500');
1686 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1694 print
'<td>'.$form->editfieldkey(
'RegionStateOrigin',
'state_id',
'', $object, 0).
'</td><td>';
1696 print
'<td>'.$form->editfieldkey(
'StateOrigin',
'state_id',
'', $object, 0).
'</td><td>';
1699 print img_picto(
'',
'state',
'class="pictofixedwidth"');
1700 print $formcompany->select_state(
$object->state_id,
$object->country_code);
1707 print
'<tr><td>'.$langs->trans(
"LifeTime").
'</td><td><input name="lifetime" class="maxwidth50" value="'.
GETPOST(
'lifetime').
'"></td></tr>';
1708 print
'<tr><td>'.$langs->trans(
"QCFrequency").
'</td><td><input name="qc_frequency" class="maxwidth50" value="'.
GETPOST(
'qc_frequency').
'"></td></tr>';
1712 $parameters = array(
'colspan' =>
' colspan="2"',
'cols' => 2);
1713 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1714 print $hookmanager->resPrint;
1715 if (empty($reshook)) {
1716 print
$object->showOptionals($extrafields,
'create', $parameters);
1720 print
'<tr><td class="tdtop">'.$langs->trans(
"NoteNotVisibleOnBill").
'</td><td>';
1723 $doleditor =
new DolEditor(
'note_private',
GETPOST(
'note_private',
'restricthtml'),
'', 140,
'dolibarr_details',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8,
'90%');
1724 $doleditor->Create();
1730 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1731 print $form->selectCategories(Categorie::TYPE_PRODUCT,
'categories', $object);
1743 print
'<table class="border centpercent">';
1745 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"VATRate").
'</td><td>';
1747 print $form->load_tva(
"tva_tx", $defaultva,
$mysoc,
$mysoc, 0, 0,
'',
false, 1);
1755 print
'<table class="border centpercent">';
1758 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"SellingPrice").
'</td>';
1759 print
'<td><input name="price" class="maxwidth50" value="'.(GETPOSTISSET(
'price') ?
GETPOST(
'price') :
$object->
price).
'">';
1760 print $form->selectPriceBaseType(
getDolGlobalString(
'PRODUCT_PRICE_BASE_TYPE'),
"price_base_type");
1765 print
'<tr><td>'.$langs->trans(
"MinPrice").
'</td>';
1766 print
'<td><input name="price_min" class="maxwidth50" value="'.(GETPOSTISSET(
'price_min') ?
GETPOST(
'price_min') :
$object->price_min).
'">';
1770 print
'<tr><td>'.$langs->trans(
"VATRate").
'</td><td>';
1772 print $form->load_tva(
"tva_tx", $defaultva,
$mysoc,
$mysoc, 0, 0,
'',
false, 1);
1783 print
'<!-- accountancy codes -->'.
"\n";
1784 print
'<table class="border centpercent">';
1787 if (
isModEnabled(
'accounting') && is_object($formaccounting)) {
1790 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1797 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1802 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellIntraCode").
'</td>';
1805 $accountancy_code_sell_intra = (
GETPOSTISSET(
'accountancy_code_sell_intra') ?
GETPOST(
'accountancy_code_sell_intra',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT"));
1807 $accountancy_code_sell_intra = (
GETPOSTISSET(
'accountancy_code_sell_intra') ?
GETPOST(
'accountancy_code_sell_intra',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT"));
1809 print $formaccounting->select_account($accountancy_code_sell_intra,
'accountancy_code_sell_intra', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1814 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellExportCode").
'</td>';
1817 $accountancy_code_sell_export = (
GETPOST(
'accountancy_code_sell_export') ?
GETPOST(
'accountancy_code_sell_export',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT"));
1819 $accountancy_code_sell_export = (
GETPOST(
'accountancy_code_sell_export') ?
GETPOST(
'accountancy_code_sell_export',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT"));
1821 print $formaccounting->select_account($accountancy_code_sell_export,
'accountancy_code_sell_export', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1825 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1828 $accountancy_code_buy = (
GETPOST(
'accountancy_code_buy',
'alpha') ? (
GETPOST(
'accountancy_code_buy',
'alpha')) :
getDolGlobalString(
"ACCOUNTING_PRODUCT_BUY_ACCOUNT"));
1830 $accountancy_code_buy = (
GETPOST(
'accountancy_code_buy',
'alpha') ? (
GETPOST(
'accountancy_code_buy',
'alpha')) :
getDolGlobalString(
"ACCOUNTING_SERVICE_BUY_ACCOUNT"));
1832 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1837 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyIntraCode").
'</td>';
1840 $accountancy_code_buy_intra = (
GETPOSTISSET(
'accountancy_code_buy_intra') ?
GETPOST(
'accountancy_code_buy_intra',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT"));
1842 $accountancy_code_buy_intra = (
GETPOSTISSET(
'accountancy_code_buy_intra') ?
GETPOST(
'accountancy_code_buy_intra',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT"));
1844 print $formaccounting->select_account($accountancy_code_buy_intra,
'accountancy_code_buy_intra', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1849 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyExportCode").
'</td>';
1852 $accountancy_code_buy_export = (
GETPOST(
'accountancy_code_buy_export') ?
GETPOST(
'accountancy_code_buy_export',
'alpha') :
getDolGlobalString(
"ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT"));
1854 $accountancy_code_buy_export = (
GETPOST(
'accountancy_code_buy_export') ?
GETPOST(
'accountancy_code_buy_export',
'alpha') :
getDolGlobalString(
"ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT"));
1856 print $formaccounting->select_account($accountancy_code_buy_export,
'accountancy_code_buy_export', 1, array(), 1, 1,
'minwidth150 maxwidth300',
'1');
1859 if (!empty($accountancy_code_sell)) {
1860 $object->accountancy_code_sell = $accountancy_code_sell;
1862 if (!empty($accountancy_code_sell_intra)) {
1863 $object->accountancy_code_sell_intra = $accountancy_code_sell_intra;
1865 if (!empty($accountancy_code_sell_export)) {
1866 $object->accountancy_code_sell_export = $accountancy_code_sell_export;
1868 if (!empty($accountancy_code_buy)) {
1869 $object->accountancy_code_buy = $accountancy_code_buy;
1871 if (!empty($accountancy_code_buy_intra)) {
1872 $object->accountancy_code_buy_intra = $accountancy_code_buy_intra;
1874 if (!empty($accountancy_code_buy_export)) {
1875 $object->accountancy_code_buy_export = $accountancy_code_buy_export;
1879 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1880 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
1885 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellIntraCode").
'</td>';
1886 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.
'">';
1891 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellExportCode").
'</td>';
1892 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell_export" value="'.$object->accountancy_code_sell_export.
'">';
1896 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1897 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
1902 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyIntraCode").
'</td>';
1903 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy_intra" value="'.$object->accountancy_code_buy_intra.
'">';
1908 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyExportCode").
'</td>';
1909 print
'<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy_export" value="'.$object->accountancy_code_buy_export.
'">';
1918 print
'$(document).ready(function() {
1919 $("#stockable_product").change(function() {
1920 $(".showifstockable").toggle(this.checked);
1928 print $form->buttonsSaveCancel(
"Create",
"Cancel", array(),
false,
'', $dol_openinpopup);
1932 $iskit =
$object->hasFatherOrChild(1);
1935 if ($action ==
'edit' && $usercancreate) {
1937 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1939 if (!empty(
$conf->use_javascript_ajax)) {
1940 print
'<script type="text/javascript">';
1941 print
'$(document).ready(function () {
1942 $("#selectcountry_id").change(function () {
1943 document.formprod.action.value="edit";
1944 document.formprod.submit();
1947 print
'</script>'.
"\n";
1954 $object->country_code = $tmparray[
'code'];
1955 $object->country = $tmparray[
'label'];
1958 $type = $langs->trans(
'Product');
1960 $type = $langs->trans(
'Service');
1965 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="formprod">'.
"\n";
1966 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1967 print
'<input type="hidden" name="action" value="update">';
1968 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1969 print
'<input type="hidden" name="canvas" value="'.$object->canvas.
'">';
1972 $titre = $langs->trans(
"CardProduct".
$object->type);
1974 print
dol_get_fiche_head($head,
'card', $titre, 0, $picto, 0,
'',
'', 0,
'', 0);
1977 $parameters = array();
1979 $reshook = $hookmanager->executeHooks(
'tabContentEditProduct', $parameters, $object, $action);
1981 if (empty($reshook)) {
1982 print
'<table class="border allwidth">';
1986 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>';
1988 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>';
1992 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>';
1995 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
' ('.$langs->trans(
"Sell").
')</td><td colspan="3">';
1996 print
'<select class="flat" name="statut">';
1998 print
'<option value="1" selected>'.$langs->trans(
"OnSell").
'</option>';
1999 print
'<option value="0">'.$langs->trans(
"NotOnSell").
'</option>';
2001 print
'<option value="1">'.$langs->trans(
"OnSell").
'</option>';
2002 print
'<option value="0" selected>'.$langs->trans(
"NotOnSell").
'</option>';
2008 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
' ('.$langs->trans(
"Buy").
')</td><td colspan="3">';
2009 print
'<select class="flat" name="statut_buy">';
2011 print
'<option value="1" selected>'.$langs->trans(
"ProductStatusOnBuy").
'</option>';
2012 print
'<option value="0">'.$langs->trans(
"ProductStatusNotOnBuy").
'</option>';
2014 print
'<option value="1">'.$langs->trans(
"ProductStatusOnBuy").
'</option>';
2015 print
'<option value="0" selected>'.$langs->trans(
"ProductStatusNotOnBuy").
'</option>';
2023 print
'<tr><td>'.$langs->trans(
"ManageLotSerial").
'</td><td>';
2024 $statutarray = array(
'0' => $langs->trans(
"ProductStatusNotOnBatch"),
'1' => $langs->trans(
"ProductStatusOnBatch"),
'2' => $langs->trans(
"ProductStatusOnSerial"));
2028 print
'<span id="statusBatchWarning" class="warning" style="display: none;">';
2029 print img_warning().
' '.$langs->trans(
"WarningConvertFromBatchToSerial").
'</span>';
2031 print
'<span id="statusBatchMouvToGlobal" class="warning" style="display: none;">';
2032 print img_warning().
' '.$langs->trans(
"WarningTransferBatchStockMouvToGlobal").
'</span>';
2036 print
'<script type="text/javascript">
2037 $(document).ready(function() {
2038 console.log($("#statusBatchWarning"))
2039 $("#status_batch").on("change", function() {
2040 if ($("#status_batch")[0].value == 0) {
2041 $("#statusBatchMouvToGlobal").show()
2043 $("#statusBatchMouvToGlobal").hide()
2049 if (
$object->status_batch == 1) {
2050 print
'<script type="text/javascript">
2051 $(document).ready(function() {
2052 console.log($("#statusBatchWarning"))
2053 $("#status_batch").on("change", function() {
2054 if ($("#status_batch")[0].value == 2) {
2055 $("#statusBatchWarning").show()
2057 $("#statusBatchWarning").hide()
2065 if (!empty(
$object->status_batch) || !empty(
$conf->use_javascript_ajax)) {
2066 $langs->load(
"admin");
2067 $tooltip = $langs->trans(
"GenericMaskCodes", $langs->transnoentities(
"Batch"), $langs->transnoentities(
"Batch"));
2068 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes2");
2069 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes3");
2070 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes4a", $langs->transnoentities(
"Batch"), $langs->transnoentities(
"Batch"));
2071 $tooltip .=
'<br>'.$langs->trans(
"GenericMaskCodes5");
2074 print
'<tr><td id="mask_option">'.$langs->trans(
"ManageLotMask").
'</td>';
2084 print
'<td id="field_mask">';
2085 print $form->textwithpicto(
'<input type="text" class="flat minwidth175" name="batch_mask" id="batch_mask_input" value="'.$mask.
'">', $tooltip, 1,
'help');
2087 if (!empty(
$conf->use_javascript_ajax)) {
2088 print
'<script type="text/javascript">
2089 $(document).ready(function() {
2090 $("#field_mask").parent().addClass("hideobject");
2091 var preselect = document.getElementById("status_batch");';
2093 print
'if (preselect.value == "2") {
2094 $("#field_mask").parent().removeClass("hideobject");
2098 print
'if (preselect.value == "1") {
2099 $("#field_mask").parent().removeClass("hideobject");
2102 print
'$("#status_batch").on("change", function () {
2103 var optionSelected = $("option:selected", this);
2104 var valueSelected = this.value;
2105 $("#field_mask").parent().addClass("hideobject");
2109 if (this.value == 1) {
2110 $("#field_mask").parent().removeClass("hideobject");
2111 $("#batch_mask_input").val("'.$inherited_mask_lot.
'");
2117 if (this.value == 2) {
2118 $("#field_mask").parent().removeClass("hideobject");
2119 $("#batch_mask_input").val("'.$inherited_mask_sn.
'");
2133 if (!empty($sellOrEatByMandatoryList)) {
2135 $sellOrEatByMandatorySelectedId =
GETPOSTINT(
'sell_or_eat_by_mandatory');
2137 $sellOrEatByMandatorySelectedId =
$object->sell_or_eat_by_mandatory;
2139 print
'<tr><td>'.$langs->trans(
'BatchSellOrEatByMandatoryList', $langs->transnoentities(
'SellByDate'), $langs->transnoentities(
'EatByDate')).
'</td><td>';
2140 print $form->selectarray(
'sell_or_eat_by_mandatory', $sellOrEatByMandatoryList, $sellOrEatByMandatorySelectedId);
2147 if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'lire_advance')) {
2152 print
'<tr><td>'.$langs->trans(
'BarcodeType').
'</td><td>';
2154 $fk_barcode_type =
GETPOST(
'fk_barcode_type');
2156 $fk_barcode_type =
$object->barcode_type;
2161 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbarcode.class.php';
2163 print $formbarcode->selectBarcodeType($fk_barcode_type,
'fk_barcode_type', 1);
2165 print
'<tr><td>'.$langs->trans(
"BarcodeValue").
'</td><td>';
2167 if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) {
2168 $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type);
2170 print
'<input class="maxwidth150 maxwidthonsmartphone" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).
'">';
2175 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
2178 $doleditor =
new DolEditor(
'desc',
GETPOSTISSET(
'desc') ?
GETPOST(
'desc',
'restricthtml') :
$object->
description,
'', 160,
'dolibarr_details',
'', false, true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_4,
'90%');
2179 $doleditor->Create();
2186 print
'<tr><td>'.$langs->trans(
"PublicUrl").
'</td><td>';
2187 print img_picto(
'',
'globe',
'class="pictofixedwidth"');
2188 print
'<input type="text" name="url" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'url') ?
GETPOST(
'url') :
$object->url).
'">';
2195 print
'<tr><td><input type="hidden" id="stockable_product" name="stockable_product" value="on" /></td><td></td></tr>';
2197 print
'<tr><td><label for="stockable_product">' . $langs->trans(
"StockableProduct") .
'</label></td>';
2198 $checked = empty(
$object->stockable_product) ?
"" :
"checked";
2199 print
'<td><input type="checkbox" id="stockable_product" name="stockable_product" '. $checked .
' /></td></tr>';
2203 print
'<tr class="showifstockable'.(empty(
$object->stockable_product) ?
' hidden' :
'').
'"><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2204 print img_picto($langs->trans(
"DefaultWarehouse"),
'stock',
'class="pictofixedwidth"');
2205 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');
2206 print
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?action=edit&id='.((
int)
$object->id)).
'">';
2207 print
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddWarehouse").
'"></span></a>';
2223 print
'<tr><td>'.$langs->trans(
"DefaultWorkstation").
'</td><td>';
2224 print img_picto($langs->trans(
"DefaultWorkstation"),
'workstation',
'class="pictofixedwidth"');
2225 print $formproduct->selectWorkstations(
$object->fk_default_workstation,
'fk_default_workstation', 1);
2238 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td>';
2239 print
'<input name="duration_value" class="width50" value="'.($object->duration_value ?
$object->duration_value :
'').
'"> ';
2241 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", (
$object->duration_unit ?
$object->duration_unit :
'h'), 0, 1);
2245 print
' ';
2247 print
'<input type="checkbox" class="valignmiddle" id="mandatoryperiod" name="mandatoryperiod"'.($object->mandatory_period == 1 ?
' checked="checked"' :
'').
'>';
2248 print
'<label for="mandatoryperiod">';
2249 $htmltooltip = $langs->trans(
"mandatoryHelper");
2251 $htmltooltip .=
'<br>'.$langs->trans(
"mandatoryHelper2");
2253 print $form->textwithpicto($langs->trans(
"mandatoryperiod"), $htmltooltip, 1,
'info');
2260 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"NatureOfProductShort"), $langs->trans(
"NatureOfProductDesc")).
'</td><td>';
2267 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"DefaultBOM"), $langs->trans(
"DefaultBOMDesc", $langs->transnoentitiesnoconv(
"Finished"))).
'</td><td>';
2268 $bomkey =
"Bom:bom/class/bom.class.php:0:(t.status:=:1) AND (t.fk_product:=:".((int)
$object->id).
')';
2269 print img_picto($langs->trans(
"DefaultBOM"),
'bom',
'class="pictofixedwidth"');
2270 print $form->selectForForms($bomkey,
'fk_default_bom', (
GETPOSTISSET(
'fk_default_bom') ?
GETPOST(
'fk_default_bom') :
$object->fk_default_bom), 1);
2277 print
'<tr><td>'.$langs->trans(
"Weight").
'</td><td>';
2278 print
'<input name="weight" size="5" value="'.(GETPOSTISSET(
'weight') ?
GETPOST(
'weight') :
$object->weight).
'"> ';
2279 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOSTISSET(
'weight_units') ?
GETPOST(
'weight_units') : (int)
$object->weight_units, 0, 2);
2285 print
'<tr><td>'.$langs->trans(
"Length").
' x '.$langs->trans(
"Width").
' x '.$langs->trans(
"Height").
'</td><td>';
2286 print
'<input name="size" size="5" value="'.(GETPOSTISSET(
'size') ?
GETPOST(
'size') :
$object->length).
'">x';
2287 print
'<input name="sizewidth" size="5" value="'.(GETPOSTISSET(
'sizewidth') ?
GETPOST(
'sizewidth') :
$object->width).
'">x';
2288 print
'<input name="sizeheight" size="5" value="'.(GETPOSTISSET(
'sizeheight') ?
GETPOST(
'sizeheight') :
$object->height).
'"> ';
2289 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTISSET(
'size_units') ?
GETPOST(
'size_units') : (int)
$object->length_units, 0, 2);
2294 print
'<tr><td>'.$langs->trans(
"Surface").
'</td><td>';
2295 print
'<input name="surface" size="5" value="'.(GETPOSTISSET(
'surface') ?
GETPOST(
'surface') :
$object->surface).
'"> ';
2296 print $formproduct->selectMeasuringUnits(
"surface_units",
"surface",
GETPOSTISSET(
'surface_units') ?
GETPOST(
'surface_units') : (int)
$object->surface_units, 0, 2);
2301 print
'<tr><td>'.$langs->trans(
"Volume").
'</td><td>';
2302 print
'<input name="volume" size="5" value="'.(GETPOSTISSET(
'volume') ?
GETPOST(
'volume') :
$object->volume).
'"> ';
2303 print $formproduct->selectMeasuringUnits(
"volume_units",
"volume",
GETPOSTISSET(
'volume_units') ?
GETPOST(
'volume_units') : (int)
$object->volume_units, 0, 2);
2309 print
'<tr><td>'.$langs->trans(
"NetMeasure").
'</td><td>';
2310 print
'<input name="net_measure" size="5" value="'.(GETPOSTISSET(
'net_measure') ?
GETPOST(
'net_measure') :
$object->net_measure).
'"> ';
2311 print $formproduct->selectMeasuringUnits(
"net_measure_units",
"",
GETPOSTISSET(
'net_measure_units') ?
GETPOST(
'net_measure_units') : (int)
$object->net_measure_units, 0, 0);
2317 print
'<tr><td>'.$langs->trans(
'DefaultUnitToShow').
'</td>';
2319 print $form->selectUnits(
$object->fk_unit,
'units');
2325 print
'<tr><td class="wordbreak">'.$form->textwithpicto($langs->trans(
"CustomsCode"), $langs->trans(
"CustomsCodeHelp")).
'</td>';
2326 print
'<td>' . img_picto(
'',
'fa-clipboard-check',
'class="pictofixedwidth"') .
'<input name="customcode" class="maxwidth100onsmartphone" value="'.(GETPOSTISSET(
'customcode') ?
GETPOST(
'customcode') :
$object->customcode).
'"></td></tr>';
2328 print
'<tr><td>'.$langs->trans(
"CountryOrigin").
'</td>';
2330 print img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2331 print $form->select_country((
string) (
GETPOSTISSET(
'country_id') ?
GETPOSTINT(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth100 maxwidthonsmartphone');
2333 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2341 print
'<td>'.$form->editfieldkey(
'RegionStateOrigin',
'state_id',
'', $object, 0).
'</td><td>';
2343 print
'<td>'.$form->editfieldkey(
'StateOrigin',
'state_id',
'', $object, 0).
'</td><td>';
2346 print img_picto(
'',
'state',
'class="pictofixedwidth"');
2355 print
'<tr><td>'.$langs->trans(
"LifeTime").
'</td><td><input name="lifetime" class="maxwidth100onsmartphone" value="'.
$object->lifetime.
'"></td></tr>';
2356 print
'<tr><td>'.$langs->trans(
"QCFrequency").
'</td><td><input name="qc_frequency" class="maxwidth100onsmartphone" value="'.
$object->qc_frequency.
'"></td></tr>';
2360 $parameters = array(
'colspan' =>
' colspan="2"',
'cols' => 2);
2361 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
2362 print $hookmanager->resPrint;
2363 if (empty($reshook)) {
2364 print
$object->showOptionals($extrafields,
'edit', $parameters);
2369 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
2370 print $form->selectCategories(Categorie::TYPE_PRODUCT,
'categories', $object);
2376 print
'<tr><td class="tdtop">'.$langs->trans(
"NoteNotVisibleOnBill").
'</td><td>';
2378 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 140,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_4,
'90%');
2379 $doleditor->Create();
2389 print
'<table class="border centpercent">';
2395 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2397 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');
2398 $nb = $formaccounting->nbaccounts;
2400 print
' <a href="'.DOL_URL_ROOT.
'/accountancy/admin/account.php">'.$langs->trans(
"SetupOn", $langs->trans(
"Chartofaccounts")).
'</a>';
2406 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellIntraCode").
'</td>';
2408 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');
2413 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellExportCode").
'</td>';
2415 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');
2419 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2421 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');
2426 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyIntraCode").
'</td>';
2428 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');
2433 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyExportCode").
'</td>';
2435 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');
2440 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2441 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.(GETPOSTISSET(
'accountancy_code_sell') ?
GETPOST(
'accountancy_code_sell') :
$object->accountancy_code_sell).
'">';
2446 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellIntraCode").
'</td>';
2447 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).
'">';
2452 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellExportCode").
'</td>';
2453 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).
'">';
2457 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2458 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.(GETPOSTISSET(
'accountancy_code_buy') ?
GETPOST(
'accountancy_code_buy') :
$object->accountancy_code_buy).
'">';
2463 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyIntraCode").
'</td>';
2464 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).
'">';
2469 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyExportCode").
'</td>';
2470 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).
'">';
2479 print
'$(document).ready(function() {
2480 $("#stockable_product").change(function() {
2481 $(".showifstockable").toggle(this.checked);
2490 print $form->buttonsSaveCancel();
2497 if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'lire_advance')) {
2502 $titre = $langs->trans(
"CardProduct".
$object->type);
2505 print
dol_get_fiche_head($head,
'card', $titre, -1, $picto, 0,
'',
'', 0,
'', 1);
2507 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?restore_lastsearch_values=1&type='.
$object->type.
'">'.$langs->trans(
"BackToList").
'</a>';
2508 $object->next_prev_filter =
"(te.fk_product_type:=:".((int)
$object->type).
")";
2511 if ($user->socid && !in_array(
'product', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
2515 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref');
2518 $parameters = array();
2520 $reshook = $hookmanager->executeHooks(
'tabContentViewProduct', $parameters, $object, $action);
2521 if (empty($reshook)) {
2522 print
'<div class="fichecenter">';
2523 print
'<div class="fichehalfleft">';
2525 print
'<div class="underbanner clearboth"></div>';
2526 print
'<table class="border tableforfield centpercent">';
2530 $typeformat =
'select;0:'.$langs->trans(
"Product").
',1:'.$langs->trans(
"Service");
2531 print
'<tr><td class="titlefieldmiddle">';
2532 print (!
getDolGlobalString(
'PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey(
"Type",
'fk_product_type', (
string)
$object->type, $object, (
int) $usercancreate, $typeformat) : $langs->trans(
'Type');
2534 print $form->editfieldval(
"Type",
'fk_product_type',
$object->type, $object, $usercancreate, $typeformat);
2540 print
'<tr><td class="titlefieldmiddle nowrap">';
2541 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
2542 print $langs->trans(
"BarcodeType");
2544 if (($action !=
'editbarcodetype') && $usercancreate && $createbarcode) {
2545 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>';
2547 print
'</tr></table>';
2549 if ($action ==
'editbarcodetype' || $action ==
'editbarcode') {
2550 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbarcode.class.php';
2554 $fk_barcode_type =
'';
2555 if ($action ==
'editbarcodetype' && is_object($formbarcode)) {
2556 print $formbarcode->formBarcodeType($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->barcode_type,
'fk_barcode_type');
2557 $fk_barcode_type =
$object->barcode_type;
2560 $fk_barcode_type =
$object->barcode_type;
2561 print
$object->barcode_type_label ?
$object->barcode_type_label : (
$object->barcode ?
'<div class="warning">'.$langs->trans(
"SetDefaultBarcodeType").
'<div>' :
'');
2563 print
'</td></tr>'.
"\n";
2566 print
'<tr><td class="nowrap">';
2567 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
2568 print $langs->trans(
"BarcodeValue");
2570 if (($action !=
'editbarcode') && $usercancreate && $createbarcode) {
2571 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>';
2573 print
'</tr></table>';
2574 print
'</td><td class="wordbreak">';
2575 if ($action ==
'editbarcode') {
2577 if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) {
2578 $tmpcode = $modBarCodeProduct->getNextValue($object, (
string) $fk_barcode_type);
2581 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
2582 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2583 print
'<input type="hidden" name="action" value="setbarcode">';
2584 print
'<input type="hidden" name="barcode_type_code" value="'.$object->barcode_type_code.
'">';
2585 print
'<input class="width300" class="maxwidthonsmartphone" type="text" name="barcode" value="'.$tmpcode.
'">';
2586 print
' <input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
2591 print
'</td></tr>'.
"\n";
2596 print
'<tr><td class="titlefieldmiddle">' . $form->textwithpicto($langs->trans(
"StockableProduct"), $langs->trans(
'StockableProductDescription')) .
'</td>';
2599 print
'<input type="checkbox" readonly disabled> <span class="opacitymedium">' . $langs->trans(
"NotSupportedOnKits").
'</span>';
2601 print
'<input type="checkbox" readonly disabled '.($object->stockable_product == 1 ?
'checked' :
'').
'>';
2605 if (
$object->isStockManaged() && !$iskit) {
2607 $warehouse->fetch(
$object->fk_default_warehouse);
2609 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2610 print(!empty($warehouse->id) ? $warehouse->getNomUrl(1) :
'');
2618 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"ManageLotSerial").
'</td><td>';
2619 if (
$object->status_batch == 0) {
2620 print
'<span class="opacitymedium">'.yn(0).
'</span>';
2622 print
$object->getLibStatut(0, 2);
2627 print
'<tr><td>'.$langs->trans(
"ManageLotMask").
'</td><td>';
2633 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'BatchSellOrEatByMandatoryList', $langs->transnoentities(
'SellByDate'), $langs->transnoentities(
'EatByDate')).
'</td><td>';
2634 if (
$object->sell_or_eat_by_mandatory == $object::SELL_OR_EAT_BY_MANDATORY_ID_NONE) {
2635 print
'<span class="opacitymedium">'.yn(0).
'</span>';
2637 print
$object->getSellOrEatByMandatoryLabel();
2644 $collapse = !empty($_COOKIE[
'DOLUSER_COLLAPSE_product_separator_accounting']);
2646 print
'<tr id="trseparatoraccounting" class="trseparator trseparatoraccounting">';
2647 print
'<td class="titlefieldmiddle firstcol"><span class="cursorpointer far fa-'.($collapse ?
'plus' :
'minus').
'-square"></span> <strong>'.$langs->trans(
"AccountancyCodes").
'</strong></td>';
2648 print
'<td class="secondcol">';
2649 $nbOfAccountingCodes = 0;
2650 $nbOfAccountingCodes += (
isModEnabled(
'accounting') && !empty(
$object->accountancy_code_sell)) ? 1 : 0;
2651 $nbOfAccountingCodes += (
isModEnabled(
'accounting') && !empty(
$object->accountancy_code_sell_intra)) ? 1 : 0;
2652 $nbOfAccountingCodes += (
isModEnabled(
'accounting') && !empty(
$object->accountancy_code_sell_export)) ? 1 : 0;
2653 $nbOfAccountingCodes += (
isModEnabled(
'accounting') && !empty(
$object->accountancy_code_buy)) ? 1 : 0;
2654 $nbOfAccountingCodes += (
isModEnabled(
'accounting') && !empty(
$object->accountancy_code_buy_intra)) ? 1 : 0;
2655 $nbOfAccountingCodes += (
isModEnabled(
'accounting') && !empty(
$object->accountancy_code_buy_export)) ? 1 : 0;
2656 print
'<span class="badge badge-secondary'.($collapse ?
'' :
' hidden').
'">'.$nbOfAccountingCodes.
'</span>';
2659 print
'<!-- Add js script to manage the collapse/uncollapse of separator accounting -->
2660 <script nonce="'.getNonce().
'" type="text/javascript">
2661 jQuery(document).ready(function(){
2662 console.log("Inject js for collapsing of separatoraccounting - keep visible and set cookie");
2663 /* document.cookie = "DOLUSER_COLLAPSE_product_separator_accounting=1; path='.DOL_URL_ROOT.
'/product/card.php"; */
2664 jQuery("#trseparatoraccounting").click(function(){
2665 console.log("We click on collapse/uncollapse to hide/show .tr_collapseaccounting");
2666 jQuery(".tr_collapseaccounting").toggle(100, function(){
2667 if (jQuery(".tr_collapseaccounting").first().is(":hidden")) {
2668 jQuery("#trseparatoraccounting td.firstcol span").addClass("fa-plus-square").removeClass("fa-minus-square");
2669 jQuery("#trseparatoraccounting td.secondcol span").removeClass("hidden");
2670 document.cookie = "DOLUSER_COLLAPSE_product_separator_accounting=1; path='.DOL_URL_ROOT.
'/product/card.php"
2672 jQuery("#trseparatoraccounting td.firstcol span").addClass("fa-minus-square").removeClass("fa-plus-square");
2673 jQuery("#trseparatoraccounting td.secondcol span").addClass("hidden");
2674 document.cookie = "DOLUSER_COLLAPSE_product_separator_accounting=0; path='.DOL_URL_ROOT.
'/product/card.php"
2682 print
'<tr class="tr_collapseaccounting'.($collapse ?
' hidden' :
'').
'"><td class="nowrap">';
2683 print $langs->trans(
"ProductAccountancySellCode");
2686 if (!empty(
$object->accountancy_code_sell)) {
2688 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
2690 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
2693 print dolPrintHTML(
$object->accountancy_code_sell);
2699 print
'<tr class="tr_collapseaccounting'.($collapse ?
' hidden' :
'').
'"><td class="nowrap">';
2700 print $langs->trans(
"ProductAccountancySellIntraCode");
2703 if (!empty(
$object->accountancy_code_sell_intra)) {
2705 $accountingaccount2->fetch(0,
$object->accountancy_code_sell_intra, 1);
2707 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
2710 print dolPrintHTML(
$object->accountancy_code_sell_intra);
2716 print
'<tr class="tr_collapseaccounting'.($collapse ?
' hidden' :
'').
'"><td class="nowrap">';
2717 print $langs->trans(
"ProductAccountancySellExportCode");
2720 if (!empty(
$object->accountancy_code_sell_export)) {
2722 $accountingaccount3->fetch(0,
$object->accountancy_code_sell_export, 1);
2724 print $accountingaccount3->getNomUrl(0, 1, 1,
'', 1);
2727 print dolPrintHTML(
$object->accountancy_code_sell_export);
2732 print
'<tr class="tr_collapseaccounting'.($collapse ?
' hidden' :
'').
'"><td class="nowrap">';
2733 print $langs->trans(
"ProductAccountancyBuyCode");
2736 if (!empty(
$object->accountancy_code_buy)) {
2738 $accountingaccount4->fetch(0,
$object->accountancy_code_buy, 1);
2740 print $accountingaccount4->getNomUrl(0, 1, 1,
'', 1);
2743 print dolPrintHTML(
$object->accountancy_code_buy);
2749 print
'<tr class="tr_collapseaccounting'.($collapse ?
' hidden' :
'').
'"><td class="nowrap">';
2750 print $langs->trans(
"ProductAccountancyBuyIntraCode");
2753 if (!empty(
$object->accountancy_code_buy_intra)) {
2755 $accountingaccount5->fetch(0,
$object->accountancy_code_buy_intra, 1);
2757 print $accountingaccount5->getNomUrl(0, 1, 1,
'', 1);
2760 print dolPrintHTML(
$object->accountancy_code_buy_intra);
2766 print
'<tr class="tr_collapseaccounting'.($collapse ?
' hidden' :
'').
'"><td class="nowrap">';
2767 print $langs->trans(
"ProductAccountancyBuyExportCode");
2770 if (!empty(
$object->accountancy_code_buy_export)) {
2772 $accountingaccount6->fetch(0,
$object->accountancy_code_buy_export, 1);
2774 print $accountingaccount6->getNomUrl(0, 1, 1,
'', 1);
2777 print dolPrintHTML(
$object->accountancy_code_buy_export);
2783 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
2784 print
'<td class="wordbreakimp wrapimp"><div class="longmessagecut">'.(dol_textishtml(
$object->description) ?
$object->description :
dol_nl2br(
$object->description, 1,
true)).
'</div></td></tr>';
2788 print
'<tr><td>'.$langs->trans(
"PublicUrl").
'</td><td>';
2795 $res = $workstation->fetch(
$object->fk_default_workstation);
2797 print
'<tr><td>'.$langs->trans(
"DefaultWorkstation").
'</td><td>';
2798 print(!empty($workstation->id) ? $workstation->getNomUrl(1) :
'');
2806 if ($combination->fetchByFkProductChild(
$object->id) > 0) {
2807 $prodstatic =
new Product($db);
2808 $prodstatic->fetch($combination->fk_product_parent);
2811 print
'<tr><td>'.$langs->trans(
"ParentProduct").
'</td><td>';
2812 print $prodstatic->getNomUrl(1);
2820 print
'<div class="fichehalfright">';
2821 print
'<div class="underbanner clearboth"></div>';
2823 print
'<table class="border tableforfield centpercent">';
2827 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
2828 print $form->showCategories(
$object->id, Categorie::TYPE_PRODUCT, 1);
2834 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
2835 $measuringUnits =
new CUnits($db);
2838 if (
$object->duration_value > 1) {
2841 $result = $measuringUnits->fetchAll(
'',
'scale', 0, 0, [
't.active' => 1,
't.unit_type' =>
'time']);
2842 if ($result !== -1) {
2843 foreach ($measuringUnits->records as $record) {
2844 $durations[$record->short_label] =
dol_ucfirst((
string) $record->label) . $plural;
2847 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Duration").
'</td><td>';
2848 if (
$object->duration_value) {
2849 print
$object->duration_value;
2850 print(!empty(
$object->duration_unit) && isset($durations[
$object->duration_unit]) ?
" ".$langs->trans($durations[
$object->duration_unit]).
" " :
'');
2854 $htmltooltip = $langs->trans(
"mandatoryHelper");
2856 $htmltooltip .=
'<br>'.$langs->trans(
"mandatoryHelper2");
2858 if (
$object->duration_value > 0) {
2859 print
' ';
2861 print
'<input type="checkbox" class="valignmiddle" name="mandatoryperiod"'.($object->mandatory_period == 1 ?
' checked="checked"' :
'').
' disabled>';
2862 print $form->textwithpicto($langs->trans(
"mandatoryperiod"), $htmltooltip, 1,
'info');
2868 print
'<tr><td class="titlefieldmiddle">'.$form->textwithpicto($langs->trans(
"NatureOfProductShort"), $langs->trans(
"NatureOfProductDesc")).
'</td><td>';
2869 print
$object->getLibFinished();
2875 print
'<tr><td class="titlefieldmiddle">'.$form->textwithpicto($langs->trans(
"DefaultBOM"), $langs->trans(
"DefaultBOMDesc", $langs->transnoentitiesnoconv(
"Finished"))).
'</td><td>';
2876 if (
$object->fk_default_bom) {
2877 $bom_static =
new BOM($db);
2878 $bom_static->fetch(
$object->fk_default_bom);
2879 print $bom_static->getNomUrl(1);
2887 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Weight").
'</td><td>';
2893 print
"</td></tr>\n";
2898 print
'<tr><td>'.$langs->trans(
"Length").
' x '.$langs->trans(
"Width").
' x '.$langs->trans(
"Height").
'</td><td>';
2902 print
" x ".$object->width;
2905 print
" x ".$object->height;
2907 print
' '.measuringUnitString(0,
"size",
$object->length_units);
2911 print
"</td></tr>\n";
2916 print(
getDolGlobalString(
'PRODUCT_DISABLE_SURFACE') ?
'' : $langs->trans(
"Surface"));
2918 print (
getDolGlobalString(
'PRODUCT_DISABLE_VOLUME') ?
'' : $langs->trans(
"Volume")).
'</td><td>';
2926 print
"</td></tr>\n";
2931 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"NetMeasure").
'</td><td>';
2932 if (
$object->net_measure !=
'') {
2943 $unit =
$object->getLabelOfUnit(
'long', $langs);
2945 print
'<tr><td>'.$langs->trans(
'DefaultUnitToShow').
'</td><td>';
2952 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CustomsCode"), $langs->trans(
"CustomsCodeHelp")).
'</td><td>'.dolPrintHTML(
$object->customcode).
'</td></tr>';
2955 print
'<tr><td>'.$langs->trans(
"Origin").
'</td><td>'.
getCountry(
$object->country_id,
'', $db);
2956 if (!empty(
$object->state_id)) {
2957 print
' - '.getState(
$object->state_id,
'0', $db);
2964 print
'<tr><td>'.$langs->trans(
"LifeTime").
'</td><td>'.
$object->lifetime.
'</td></tr>';
2965 print
'<tr><td>'.$langs->trans(
"QCFrequency").
'</td><td>'.
$object->qc_frequency.
'</td></tr>';
2969 $parameters = array();
2970 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2974 print
'<!-- show Note --> '.
"\n";
2976 print
'<!-- End show Note --> '.
"\n";
2983 print
'<div class="clearboth"></div>';
2988 } elseif ($action !=
'create') {
2994if (!empty($modCodeProduct->code_auto)) {
2996 $tmpcode = $modCodeProduct->getNextValue($object,
$object->type);
3002if (($action ==
'delete' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3003 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3004 $formconfirm = $form->formconfirm(
"card.php?id=".
$object->id, $langs->trans(
"DeleteProduct"), $langs->trans(
"ConfirmDeleteProduct"),
"confirm_delete",
'', 0,
"action-delete");
3006if ($action ==
'merge') {
3007 $formquestion = array(
3009 'name' =>
'product_origin',
3010 'label' => $langs->trans(
'MergeOriginProduct'),
3012 'value' => $form->select_produits(0,
'product_origin',
'', 0, 0, 1, 2,
'', 1, array(), 0, 1, 0,
'minwidth200', 0,
'',
null, 1),
3015 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"MergeProducts"), $langs->trans(
"ConfirmMergeProducts"),
"confirm_merge", $formquestion,
'no', 1, 250);
3019if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3020 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3022 $formquestionclone = array(
3023 'text' => $langs->trans(
"ConfirmClone"),
3024 0 => array(
'type' =>
'text',
'name' =>
'clone_ref',
'label' => $langs->trans(
"NewRefForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->ref : $tmpcode,
'morecss' =>
'width150'),
3025 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_content',
'label' => $langs->trans(
"CloneContentProduct"),
'value' => 1),
3026 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 1),
3029 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_prices',
'label' => $langs->trans(
"ClonePricesProduct").
' ('.$langs->trans(
"MultiPrices").
')',
'value' => 0);
3032 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_prices',
'label' => $langs->trans(
"ClonePricesProduct").
' ('.$langs->trans(
"CustomerPerPrices").
')',
'value' => 0);
3035 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_prices',
'label' => $langs->trans(
"ClonePricesProduct").
' ('.$langs->trans(
"MultiPricesAndCustomerPerPrices").
')',
'value' => 0);
3037 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_supplier_prices',
'label' => $langs->trans(
"ClonePricesProduct").
' ('.$langs->trans(
"SupplierPrices").
')',
'value' => 0);
3039 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_composition',
'label' => $langs->trans(
'CloneCompositionProduct'),
'value' => 1);
3041 if (
isModEnabled(
'bom') && $user->hasRight(
'bom',
'write')) {
3042 if (
$object->fk_default_bom > 0) {
3043 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_defbom',
'label' => $langs->trans(
"CloneDefBomProduct"),
'value' =>
getDolGlobalInt(
'BOM_CLONE_DEFBOM'));
3045 $bomstatic =
new BOM($db);
3046 $bomlist = $bomstatic->fetchAll(
"",
"", 0, 0,
'fk_product:=:'.(
int)
$object->id);
3047 if (is_array($bomlist) && count($bomlist) > 0) {
3048 $formquestionclone[] = array(
'type' =>
'checkbox',
'name' =>
'clone_otherboms',
'label' => $langs->trans(
"CloneOtherBomsProduct"),
'value' => 0);
3051 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneProduct',
$object->ref),
'confirm_clone', $formquestionclone,
'yes',
'action-clone', 0, 600);
3055$parameters = array(
'formConfirm' => $formconfirm,
'object' => $object);
3056$reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
3057if (empty($reshook)) {
3058 $formconfirm .= $hookmanager->resPrint;
3059} elseif ($reshook > 0) {
3060 $formconfirm = $hookmanager->resPrint;
3069if ($action !=
'create' && $action !=
'edit') {
3070 $cloneProductUrl =
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'clone'],
true);
3071 $cloneButtonId =
'action-clone-no-ajax';
3073 print
"\n".
'<div class="tabsAction">'.
"\n";
3075 $parameters = array();
3076 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
3077 if (empty($reshook)) {
3078 if ($usercancreate) {
3079 if (!isset($hookmanager->resArray[
'no_button_edit']) || $hookmanager->resArray[
'no_button_edit'] != 1) {
3080 print dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'edit',
'id' =>
$object->id],
true),
'', $usercancreate);
3084 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle');
3086 if (!isset($hookmanager->resArray[
'no_button_copy']) || $hookmanager->resArray[
'no_button_copy'] != 1) {
3087 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3088 $cloneButtonId =
'action-clone';
3090 print dolGetButtonAction($langs->trans(
'ToClone'), $langs->trans(
'ToClone'),
'clone', $cloneProductUrl, $cloneButtonId, $usercancreate, array(
'attr' => array(
'class' =>
'reposition')));
3095 if ($usercandelete) {
3097 print dolGetButtonAction($langs->trans(
'MergeProducts'), $langs->trans(
'Merge'),
'default',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'merge',
'id' =>
$object->id],
true),
'',
true, array(
'attr' => array(
'classOverride' =>
'butAction butActionDanger'))).
"\n";
3099 if (empty($object_is_used)) {
3100 if (!isset($hookmanager->resArray[
'no_button_delete']) || $hookmanager->resArray[
'no_button_delete'] != 1) {
3101 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3102 print dolGetButtonAction($langs->trans(
'Delete'), $langs->trans(
'Delete'),
'delete',
'#',
'action-delete',
true, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
3104 print dolGetButtonAction($langs->trans(
'Delete'), $langs->trans(
'Delete'),
'delete',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'delete',
'id' =>
$object->id],
true),
'',
true, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
3108 print dolGetButtonAction($langs->trans(
"ProductIsUsed"), $langs->trans(
'Delete'),
'delete',
'#',
'',
false);
3111 print dolGetButtonAction($langs->trans(
"NotEnoughPermissions"), $langs->trans(
'Delete'),
'delete',
'#',
'',
false);
3129 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'creer')) {
3130 $propal =
new Propal($db);
3132 $langs->load(
"propal");
3134 $otherprop = $propal->liste_array(2, 1, 0);
3136 if (is_array($otherprop) && count($otherprop)) {
3137 $html .=
'<tr><td style="width: 200px;">';
3138 $html .= $langs->trans(
"AddToDraftProposals").
'</td><td>';
3139 $html .= $form->selectarray(
"propalid", $otherprop, 0, 1);
3140 $html .=
'</td></tr>';
3142 $html .=
'<tr><td style="width: 200px;">';
3143 $html .= $langs->trans(
"AddToDraftProposals").
'</td><td>';
3144 $html .= $langs->trans(
"NoDraftProposals");
3145 $html .=
'</td></tr>';
3150 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'creer')) {
3153 $langs->load(
"orders");
3155 $othercom = $commande->liste_array(2, 1,
null);
3156 if (is_array($othercom) && count($othercom)) {
3157 $html .=
'<tr><td style="width: 200px;">';
3158 $html .= $langs->trans(
"AddToDraftOrders").
'</td><td>';
3159 $html .= $form->selectarray(
"commandeid", $othercom, 0, 1);
3160 $html .=
'</td></tr>';
3162 $html .=
'<tr><td style="width: 200px;">';
3163 $html .= $langs->trans(
"AddToDraftOrders").
'</td><td>';
3164 $html .= $langs->trans(
"NoDraftOrders");
3165 $html .=
'</td></tr>';
3170 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'creer')) {
3173 $langs->load(
"bills");
3175 $otherinvoice = $invoice->liste_array(2, 1,
null);
3176 if (is_array($otherinvoice) && count($otherinvoice)) {
3177 $html .=
'<tr><td style="width: 200px;">';
3178 $html .= $langs->trans(
"AddToDraftInvoices").
'</td><td>';
3179 $html .= $form->selectarray(
"factureid", $otherinvoice, 0, 1);
3180 $html .=
'</td></tr>';
3182 $html .=
'<tr><td style="width: 200px;">';
3183 $html .= $langs->trans(
"AddToDraftInvoices").
'</td><td>';
3184 $html .= $langs->trans(
"NoDraftInvoices");
3185 $html .=
'</td></tr>';
3190 if (!empty($html)) {
3191 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
3192 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3193 print
'<input type="hidden" name="action" value="addin">';
3199 $html .=
'<tr><td class="nowrap">'.$langs->trans(
"Quantity").
' ';
3200 $html .=
'<input type="text" class="flat" name="qty" size="1" value="1"></td>';
3201 $html .=
'<td class="nowrap">'.$langs->trans(
"ReductionShort").
'(%) ';
3202 $html .=
'<input type="text" class="flat" name="remise_percent" size="1" value="0">';
3203 $html .=
'</td></tr>';
3205 print
'<table class="centpercent border">';
3209 print
'<div class="center">';
3210 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
3224if (
GETPOST(
'modelselected')) {
3225 $action =
'presend';
3228if ($action !=
'create' && $action !=
'edit' && $action !=
'delete') {
3229 print
'<div class="fichecenter"><div class="fichehalfleft">';
3230 print
'<a name="builddoc"></a>';
3234 if (!empty(
$conf->product->multidir_output[
$object->entity ??
$conf->entity])) {
3235 $filedir =
$conf->product->multidir_output[
$object->entity ??
$conf->entity].
'/'.$objectref;
3237 $filedir =
$conf->product->dir_output.
'/'.$objectref;
3239 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3240 $genallowed = $usercanread;
3241 $delallowed = $usercancreate;
3243 print $formfile->showdocuments($modulepart,
$object->ref, $filedir, $urlsource, (
int) $genallowed, (
int) $delallowed,
'', 0, 0, 0, 28, 0,
'',
'',
'', $langs->getDefaultLang(),
'', $object);
3244 $somethingshown = $formfile->numoffiles;
3246 print
'</div><div class="fichehalfright">';
3249 $morehtmlcenter =
'<div class="nowraponall">';
3250 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/product/messaging.php?id='.
$object->id);
3251 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/product/agenda.php?id='.
$object->id);
3252 $morehtmlcenter .=
'</div>';
3255 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3257 $somethingshown = $formactions->showactions($object,
'product', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3259 print
'</div></div>';
3262 $modelmail =
'product_send';
3263 $defaulttopic =
$object->label;
3265 $trackid =
'prod' .
$object->id;
3267 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='', $placeholder='')
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage accounting accounts.
Class of dictionary type of thirdparty (used by imports)
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...)
if(! $sortfield) if(! $sortorder) $module
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_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dol_ucfirst($string, $encoding="UTF-8")
Convert first character of the first word of a string to upper.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
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_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
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_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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 rate, 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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_set_focus($selector, $nooutput=0)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
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, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.