diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 01a33e550a2..e369a1a7217 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1255,10 +1255,6 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
- /*
- * Send mail
- */
-
// Actions to send emails
$actiontypecode='AC_COM';
$trigger_name='ORDER_SENTBYMAIL';
@@ -2589,7 +2585,6 @@ if ($action == 'create' && $user->rights->commande->creer)
print ' '; // ancre
// Documents
$comref = dol_sanitizeFileName($object->ref);
- $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref . '/' . $comref . '.pdf';
$filedir = $conf->commande->dir_output . '/' . $comref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 35edc1178dc..939d8300661 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3406,7 +3406,7 @@ class Form
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
}
- if ($type == Categorie::TYPE_BANK_LINE)
+ if ($type === Categorie::TYPE_BANK_LINE)
{
// TODO Move this into common category feature
$categids=array();
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index a7a9221babc..2af32bf9be6 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -775,9 +775,7 @@ class FormFile
foreach($link_list as $file)
{
- $var=!$var;
-
- $out.= "
';
print '';
print ' '; // ancre pour retourner sur la ligne
@@ -1490,21 +1490,21 @@ else if ($id > 0 || ! empty($ref))
// Add new line
if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS))
{
- if (! $num) print '';
+ if (! $num)
+ {
+ print '';
- print '';
- print '';
- print ' '; // ancre
- print $langs->trans('Description').' ';
- print ''.$langs->trans('Date').' ';
- print ''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').' ';
-
- print ' ';
- print " \n";
-
- $var=true;
-
- print '\n";
+ print ' ';
+ print '';
+ print ' '; // ancre
+ print $langs->trans('Description').' ';
+ print ''.$langs->trans('Date').' ';
+ print ''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').' ';
+ print ' ';
+ print " \n";
+ }
+
+ print ''."\n";
print '';
// editeur wysiwyg
if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
@@ -1533,7 +1533,7 @@ else if ($id > 0 || ! empty($ref))
}
print ' ';
- print ' ';
+ print ' ';
print ' ';
//Line extrafield
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 72ec89c55d3..48ced509c47 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -272,6 +272,8 @@ SizeUnits=Size unit
DeleteProductBuyPrice=Delete buying price
ConfirmDeleteProductBuyPrice=Are you sure you want to delete this buying price?
SubProduct=Sub product
+ProductSheet=Product sheet
+ServiceSheet=Service sheet
#Attributes
VariantAttributes=Variant attributes
diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php
index c879ab54059..d0294dd3a70 100644
--- a/htdocs/product/admin/product.php
+++ b/htdocs/product/admin/product.php
@@ -33,6 +33,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
$langs->load("admin");
@@ -66,6 +67,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_
dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity);
}
+$error = 0;
/*
@@ -118,10 +120,12 @@ if ($action == 'setModuleOptions')
if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0)
{
$res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
}
if ($action == 'other' && GETPOST('value_PRODUIT_MULTIPRICES_LIMIT') > 0)
{
$res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", GETPOST('value_PRODUIT_MULTIPRICES_LIMIT'),'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
}
if ($action == 'other')
{
@@ -154,28 +158,19 @@ if ($action == 'other')
}
}
-}
-if ($action == 'other')
-{
+
$value = GETPOST('activate_sousproduits','alpha');
$res = dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $value,'chaine',0,'',$conf->entity);
-}
-if ($action == 'other')
-{
+
$value = GETPOST('activate_viewProdDescInForm','alpha');
$res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $value,'chaine',0,'',$conf->entity);
-}
-if ($action == 'other')
-{
+
$value = GETPOST('activate_viewProdTextsInThirdpartyLanguage','alpha');
$res = dolibarr_set_const($db, "PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE", $value,'chaine',0,'',$conf->entity);
-}
-if ($action == 'other') {
+
$value = GETPOST('activate_mergePropalProductCard','alpha');
$res = dolibarr_set_const($db, "PRODUIT_PDF_MERGE_PROPAL", $value,'chaine',0,'',$conf->entity);
-}
-if ($action == 'other')
-{
+
$value = GETPOST('activate_usesearchtoselectproduct','alpha');
$res = dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $value,'chaine',0,'',$conf->entity);
}
@@ -184,8 +179,8 @@ if ($action == 'specimen') // For products
{
$modele= GETPOST('module','alpha');
- $inter = new Fichinter($db);
- $inter->initAsSpecimen();
+ $product = new Product($db);
+ $product->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
@@ -207,9 +202,9 @@ if ($action == 'specimen') // For products
$module = new $classname($db);
- if ($module->write_file($inter,$langs) > 0)
+ if ($module->write_file($product, $langs, '') > 0)
{
- header("Location: ".DOL_URL_ROOT."/document.php?modulepart=products&file=SPECIMEN.pdf");
+ header("Location: ".DOL_URL_ROOT."/document.php?modulepart=product&file=SPECIMEN.pdf");
return;
}
else
@@ -265,24 +260,19 @@ if ($action == 'set')
$value = GETPOST('value');
if (GETPOST('value','alpha')) $res = dolibarr_set_const($db, $const, $value,'chaine',0,'',$conf->entity);
else $res = dolibarr_del_const($db, $const,$conf->entity);
+ if (! $res > 0) $error++;
}
-/*else if ($action == 'useecotaxe')
-{
- $ecotaxe = GETPOST("activate_useecotaxe");
- $res = dolibarr_set_const($db, "PRODUIT_USE_ECOTAXE", $ecotaxe,'chaine',0,'',$conf->entity);
-}*/
if ($action == 'other')
{
$value = GETPOST('activate_units', 'alpha');
$res = dolibarr_set_const($db, "PRODUCT_USE_UNITS", $value, 'chaine', 0, '', $conf->entity);
+ if (! $res > 0) $error++;
}
if ($action)
{
- if (! $res > 0) $error++;
-
- if (! $error)
+ if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
@@ -317,13 +307,11 @@ $linkback=''.$langs->trans("BackToM
print load_fiche_titre($title,$linkback,'title_setup');
$head = product_admin_prepare_head();
-dol_fiche_head($head, 'general', $tab, 0, 'product');
+dol_fiche_head($head, 'general', $tab, -1, 'product');
$form=new Form($db);
-/*
- * Module to manage product / services code
- */
+// Module to manage product / services code
$dirproduct=array('/core/modules/product/');
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
@@ -403,7 +391,7 @@ foreach ($dirproduct as $dirroot)
}
print '
';
-// Defini tableau def des modeles
+// Module to build doc
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
@@ -426,6 +414,10 @@ else
dol_print_error($db);
}
+print ' ';
+
+print load_fiche_titre($langs->trans("ProductDocumentTemplates"), '', '');
+
print '';
print '';
print ''.$langs->trans("Name").' ';
diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php
index ca5944c421f..304b0d68333 100644
--- a/htdocs/product/admin/product_extrafields.php
+++ b/htdocs/product/admin/product_extrafields.php
@@ -84,7 +84,7 @@ print load_fiche_titre($title,$linkback,'title_setup');
$head = product_admin_prepare_head();
-dol_fiche_head($head, 'attributes', $textobject, 0, 'product');
+dol_fiche_head($head, 'attributes', $textobject, -1, 'product');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 7797e6802d4..536bcece10f 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -140,32 +140,13 @@ if (empty($reshook))
exit;
}
- /*
- * Build doc
- */
- else if ($action == 'builddoc' && $user->rights->produit->creer)
- {
- // Save last template used to generate document
- if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
- // Define output language
- $outputlangs = $langs;
- $newlang='';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
- $ret = $object->fetch($id); // Reload to get new records
- $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
- if ($result <= 0)
- {
- setEventMessages($object->error, $object->errors, 'errors');
- $action='';
- }
- }
-
+ // Actions to build doc
+ $upload_dir = $conf->produit->dir_output;
+ $permissioncreate = $user->rights->produit->creer;
+ include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
+
+ include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
+
// Barcode type
if ($action == 'setfk_barcode_type' && $createbarcode)
{
@@ -197,20 +178,6 @@ if (empty($reshook))
setEventMessages($errors, null, 'errors');
}
}
-
- // Remove file in doc form
- if ($action == 'remove_file' && $user->rights->produit->creer) {
- if ($object->id > 0) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- $langs->load("other");
- $upload_dir = $conf->product->dir_output;
- $file = $upload_dir . '/' . GETPOST('file');
- $ret = dol_delete_file($file, 0, 0, 0, $object);
- if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
- else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
- }
- }
// Add a product or service
if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer))
@@ -1841,51 +1808,48 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
- if ($action == '' || $action == 'view')
- {
- if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) ||
- ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer))
- {
- if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print '';
+ if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) ||
+ ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer))
+ {
+ if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print '';
- if (! isset($object->no_button_copy) || $object->no_button_copy <> 1)
- {
- if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
- {
- print ''.$langs->trans('ToClone').'
'."\n";
- }
- else
- {
- print '';
- }
- }
- }
- $object_is_used = $object->isObjectUsed($object->id);
-
- if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer)
- || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer))
- {
- if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
- {
- if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
- {
- print ''.$langs->trans('Delete').'
'."\n";
- }
- else
- {
- print '';
- }
- }
- else
+ if (! isset($object->no_button_copy) || $object->no_button_copy <> 1)
+ {
+ if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
+ {
+ print ''.$langs->trans('ToClone').'
'."\n";
+ }
+ else
{
- print '';
- }
- }
- else
+ print '';
+ }
+ }
+ }
+ $object_is_used = $object->isObjectUsed($object->id);
+
+ if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer)
+ || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer))
+ {
+ if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
+ {
+ if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
+ {
+ print ''.$langs->trans('Delete').'
'."\n";
+ }
+ else
+ {
+ print '';
+ }
+ }
+ else
{
- print '';
- }
- }
+ print '';
+ }
+ }
+ else
+ {
+ print '';
+ }
}
print "\n\n";
@@ -1908,12 +1872,10 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action =
$langs->load("propal");
- $var=true;
$otherprop = $propal->liste_array(2,1,0);
if (is_array($otherprop) && count($otherprop))
{
- $var=!$var;
$html .= ' ';
$html .= $langs->trans("AddToDraftProposals").' ';
$html .= $form->selectarray("propalid", $otherprop, 0, 1);
@@ -1935,11 +1897,9 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action =
$langs->load("orders");
- $var=true;
$othercom = $commande->liste_array(2, 1, null);
if (is_array($othercom) && count($othercom))
{
- $var=!$var;
$html .= ' ';
$html .= $langs->trans("AddToDraftOrders").' ';
$html .= $form->selectarray("commandeid", $othercom, 0, 1);
@@ -1961,11 +1921,9 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action =
$langs->load("bills");
- $var=true;
$otherinvoice = $invoice->liste_array(2, 1, null);
if (is_array($otherinvoice) && count($otherinvoice))
{
- $var=!$var;
$html .= ' ';
$html .= $langs->trans("AddToDraftInvoices").' ';
$html .= $form->selectarray("factureid", $otherinvoice, 0, 1);
@@ -2021,14 +1979,14 @@ if ($action != 'edit' && $action != 'delete')
print '';
print '
'; // ancre
- $filedir=$upload_dir;
-
+ // Documents
+ $objectref = dol_sanitizeFileName($object->ref);
+ $relativepath = $comref . '/' . $objectref . '.pdf';
+ $filedir = $conf->produit->dir_output . '/' . $objectref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$user->rights->produit->creer;
$delallowed=$user->rights->produit->supprimer;
- $var=true;
-
print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles;
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 0ee5c8f26ed..e25ad186369 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -4363,6 +4363,7 @@ class Product extends CommonObject
$now=dol_now();
// Initialize parameters
+ $this->specimen=1;
$this->id=0;
$this->ref = 'PRODUCT_SPEC';
$this->label = 'PRODUCT SPECIMEN';
diff --git a/htdocs/theme/eldy/img/statut3.png b/htdocs/theme/eldy/img/statut3.png
index bf4f7b8e854..158c640bb60 100644
Binary files a/htdocs/theme/eldy/img/statut3.png and b/htdocs/theme/eldy/img/statut3.png differ
diff --git a/htdocs/theme/eldy/img/statut4.png b/htdocs/theme/eldy/img/statut4.png
index 7a680ad2b2d..d0df7e40aef 100644
Binary files a/htdocs/theme/eldy/img/statut4.png and b/htdocs/theme/eldy/img/statut4.png differ