diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php
new file mode 100644
index 00000000000..06c59338e58
--- /dev/null
+++ b/htdocs/admin/mrp.php
@@ -0,0 +1,522 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/admin/mrp.php
+ * \ingroup mrp
+ * \brief Setup page of module MRP
+ */
+
+require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
+require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array('admin', 'errors', 'mrp', 'other'));
+
+if (! $user->admin) accessforbidden();
+
+$action = GETPOST('action', 'alpha');
+$value = GETPOST('value', 'alpha');
+$label = GETPOST('label', 'alpha');
+$scandir = GETPOST('scan_dir', 'alpha');
+$type = 'mrp';
+
+
+/*
+ * Actions
+ */
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+
+if ($action == 'updateMask')
+{
+ $maskconstmrp=GETPOST('maskconstMo', 'alpha');
+ $maskmrp=GETPOST('maskMo', 'alpha');
+
+ if ($maskconstmrp) $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity);
+
+ if (! $res > 0) $error++;
+
+ if (! $error)
+ {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
+elseif ($action == 'specimen')
+{
+ $modele=GETPOST('module', 'alpha');
+
+ $mo = new MO($db);
+ $mrp->initAsSpecimen();
+
+ // Search template files
+ $file=''; $classname=''; $filefound=0;
+ $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
+ foreach($dirmodels as $reldir)
+ {
+ $file=dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0);
+ if (file_exists($file))
+ {
+ $filefound=1;
+ $classname = "pdf_".$modele;
+ break;
+ }
+ }
+
+ if ($filefound)
+ {
+ require_once $file;
+
+ $module = new $classname($db);
+
+ if ($module->write_file($mrp, $langs) > 0)
+ {
+ header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf");
+ return;
+ }
+ else
+ {
+ setEventMessages($module->error, null, 'errors');
+ dol_syslog($module->error, LOG_ERR);
+ }
+ }
+ else
+ {
+ setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
+ dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
+ }
+}
+
+// Activate a model
+elseif ($action == 'set')
+{
+ $ret = addDocumentModel($value, $type, $label, $scandir);
+}
+
+elseif ($action == 'del')
+{
+ $ret = delDocumentModel($value, $type);
+ if ($ret > 0)
+ {
+ if ($conf->global->MRP_MO_ADDON_PDF == "$value") dolibarr_del_const($db, 'MRP_MO_ADDON_PDF', $conf->entity);
+ }
+}
+
+// Set default model
+elseif ($action == 'setdoc')
+{
+ if (dolibarr_set_const($db, "MRP_MO_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
+ {
+ // The constant that was read before the new set
+ // We therefore requires a variable to have a coherent view
+ $conf->global->MRP_MO_ADDON_PDF = $value;
+ }
+
+ // On active le modele
+ $ret = delDocumentModel($value, $type);
+ if ($ret > 0)
+ {
+ $ret = addDocumentModel($value, $type, $label, $scandir);
+ }
+}
+
+elseif ($action == 'setmod')
+{
+ // TODO Check if numbering module chosen can be activated
+ // by calling method canBeActivated
+
+ dolibarr_set_const($db, "MRP_MO_ADDON", $value, 'chaine', 0, '', $conf->entity);
+}
+
+elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK')
+{
+ $draft = GETPOST("MRP_MO_DRAFT_WATERMARK");
+ $res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
+
+ if (! $res > 0) $error++;
+
+ if (! $error)
+ {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
+elseif ($action == 'set_MRP_MO_FREE_TEXT')
+{
+ $freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string
+
+ $res = dolibarr_set_const($db, "MRP_MO_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
+
+ if (! $res > 0) $error++;
+
+ if (! $error)
+ {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
+
+/*
+ * View
+ */
+
+$form=new Form($db);
+
+$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
+
+llxHeader("", $langs->trans("MrpSetupPage"));
+
+$linkback=''.$langs->trans("BackToModuleList").' ';
+print load_fiche_titre($langs->trans("MrpSetupPage"), $linkback, 'title_setup');
+
+$head = mrpAdminPrepareHead();
+
+dol_fiche_head($head, 'settings', $langs->trans("MOs"), -1, 'mrp');
+
+/*
+ * MOs Numbering model
+ */
+
+print load_fiche_titre($langs->trans("MOsNumberingModules"), '', '');
+
+print '
';
+print '';
+print ''.$langs->trans("Name").' ';
+print ''.$langs->trans("Description").' ';
+print ''.$langs->trans("Example").' ';
+print ''.$langs->trans("Status").' ';
+print ''.$langs->trans("ShortInfo").' ';
+print ' '."\n";
+
+clearstatcache();
+
+foreach ($dirmodels as $reldir)
+{
+ $dir = dol_buildpath($reldir."core/modules/mrp/");
+
+ if (is_dir($dir))
+ {
+ $handle = opendir($dir);
+ if (is_resource($handle))
+ {
+ while (($file = readdir($handle))!==false)
+ {
+ if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file)-3, 3) == 'php')
+ {
+ $file = substr($file, 0, dol_strlen($file)-4);
+
+ require_once $dir.$file.'.php';
+
+ $module = new $file($db);
+
+ // Show modules according to features level
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
+
+ if ($module->isEnabled())
+ {
+ print ''.$module->name." \n";
+ print $module->info();
+ print ' ';
+
+ // Show example of numbering model
+ print '';
+ $tmp=$module->getExample();
+ if (preg_match('/^Error/', $tmp)) print ''.$langs->trans($tmp).'
';
+ elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
+ else print $tmp;
+ print ' '."\n";
+
+ print '';
+ if ($conf->global->MRP_MO_ADDON == $file)
+ {
+ print img_picto($langs->trans("Activated"), 'switch_on');
+ }
+ else
+ {
+ print '';
+ print img_picto($langs->trans("Disabled"), 'switch_off');
+ print ' ';
+ }
+ print ' ';
+
+ $mrp=new MO($db);
+ $mrp->initAsSpecimen();
+
+ // Info
+ $htmltooltip='';
+ $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
+ $mrp->type=0;
+ $nextval=$module->getNextValue($mysoc, $mrp);
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
+ $htmltooltip.=''.$langs->trans("NextValue").': ';
+ if ($nextval) {
+ if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
+ $htmltooltip.=$nextval.' ';
+ } else {
+ $htmltooltip.=$langs->trans($module->error).' ';
+ }
+ }
+
+ print '';
+ print $form->textwithpicto('', $htmltooltip, 1, 0);
+ print ' ';
+
+ print " \n";
+ }
+ }
+ }
+ closedir($handle);
+ }
+ }
+}
+print "
\n";
+
+
+/*
+ * Document templates generators
+ */
+
+print load_fiche_titre($langs->trans("MOsModelModule"), '', '');
+
+// Load array def with activated templates
+$def = array();
+$sql = "SELECT nom";
+$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
+$sql.= " WHERE type = '".$type."'";
+$sql.= " AND entity = ".$conf->entity;
+$resql=$db->query($sql);
+if ($resql)
+{
+ $i = 0;
+ $num_rows=$db->num_rows($resql);
+ while ($i < $num_rows)
+ {
+ $array = $db->fetch_array($resql);
+ array_push($def, $array[0]);
+ $i++;
+ }
+}
+else
+{
+ dol_print_error($db);
+}
+
+
+print "\n";
+print "\n";
+print ''.$langs->trans("Name").' ';
+print ''.$langs->trans("Description").' ';
+print ''.$langs->trans("Status")." \n";
+print ''.$langs->trans("Default")." \n";
+print ''.$langs->trans("ShortInfo").' ';
+print ''.$langs->trans("Preview").' ';
+print " \n";
+
+clearstatcache();
+
+foreach ($dirmodels as $reldir)
+{
+ foreach (array('','/doc') as $valdir)
+ {
+ $dir = dol_buildpath($reldir."core/modules/mrp".$valdir);
+
+ if (is_dir($dir))
+ {
+ $handle=opendir($dir);
+ if (is_resource($handle))
+ {
+ while (($file = readdir($handle))!==false)
+ {
+ $filelist[]=$file;
+ }
+ closedir($handle);
+ arsort($filelist);
+
+ foreach($filelist as $file)
+ {
+ if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
+ {
+ if (file_exists($dir.'/'.$file))
+ {
+ $name = substr($file, 4, dol_strlen($file) -16);
+ $classname = substr($file, 0, dol_strlen($file) -12);
+
+ require_once $dir.'/'.$file;
+ $module = new $classname($db);
+
+ $modulequalified=1;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
+
+ if ($modulequalified)
+ {
+ $var = !$var;
+ print '';
+ print (empty($module->name)?$name:$module->name);
+ print " \n";
+ if (method_exists($module, 'info')) print $module->info($langs);
+ else print $module->description;
+ print ' ';
+
+ // Active
+ if (in_array($name, $def))
+ {
+ print ''."\n";
+ print '';
+ print img_picto($langs->trans("Enabled"), 'switch_on');
+ print ' ';
+ print ' ';
+ }
+ else
+ {
+ print ''."\n";
+ print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').' ';
+ print " ";
+ }
+
+ // Default
+ print '';
+ if ($conf->global->MRP_MO_ADDON_PDF == $name)
+ {
+ print img_picto($langs->trans("Default"), 'on');
+ }
+ else
+ {
+ print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').' ';
+ }
+ print ' ';
+
+ // Info
+ $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+ $htmltooltip.=' '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
+ if ($module->type == 'pdf')
+ {
+ $htmltooltip.=' '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
+ }
+ $htmltooltip.=''.$langs->trans("FeaturesSupported").': ';
+ $htmltooltip.=' '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
+ $htmltooltip.=' '.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
+
+
+ print '';
+ print $form->textwithpicto('', $htmltooltip, 1, 0);
+ print ' ';
+
+ // Preview
+ print '';
+ if ($module->type == 'pdf')
+ {
+ print ''.img_object($langs->trans("Preview"), 'bill').' ';
+ }
+ else
+ {
+ print img_object($langs->trans("PreviewNotAvailable"), 'generic');
+ }
+ print ' ';
+
+ print " \n";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+print '
';
+print " ";
+
+/*
+ * Other options
+ */
+
+print load_fiche_titre($langs->trans("OtherOptions"), '', '');
+print '';
+print '';
+print ''.$langs->trans("Parameter").' ';
+print ''.$langs->trans("Value").' ';
+print " \n";
+print " \n";
+
+$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
+$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
+$htmltext = ''.$langs->trans("AvailableVariables").': ';
+foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
+$htmltext.=' ';
+
+print '';
+
+//Use draft Watermark
+
+print "";
+print ' ';
+print " ";
+print '';
+print $form->textwithpicto($langs->trans("WatermarkOnDraftMOs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
+print ' ';
+print ' ';
+print ' ';
+print ' ';
+print " \n";
+print ' ';
+
+print '
';
+print ' ';
+
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php
index 0343fecf69d..5ea6ee66dd9 100644
--- a/htdocs/admin/website.php
+++ b/htdocs/admin/website.php
@@ -421,7 +421,7 @@ $h++;
dol_fiche_head($head, 'website', '', -1);
-print $langs->trans("WebsiteSetupDesc").' ';
+print ''.$langs->trans("WebsiteSetupDesc").' ';
print " \n";
diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php
index 471fb4f2cce..40d53bff787 100644
--- a/htdocs/bom/class/api_boms.class.php
+++ b/htdocs/bom/class/api_boms.class.php
@@ -260,7 +260,7 @@ class Boms extends DolibarrApi
throw new RestException(500, 'Error when deleting BOM : '.$this->bom->error);
}
- return array(
+ return array(
'success' => array(
'code' => 200,
'message' => 'BOM deleted'
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 9ad3ef80dde..569b57ca552 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -1735,7 +1735,7 @@ function sort_events_by_date($a, $b)
}
// If both events have the same start time, longest first
-
+
if(! is_numeric($b->datef))
{
// when event B have no end timestamp, event B should sort be before event A (All day events on top)
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index 6b767bc3949..dce1c13bc40 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -322,7 +322,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
-if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']=' '.$langs->trans("Delete");
+//if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']=' '.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@@ -336,13 +336,9 @@ print ' ';
print ' ';
print ' ';
-$newcardbutton='';
-//if ($user->rights->monmodule->creer)
- //{
-$newcardbutton=''.$langs->trans('New').' ';
-$newcardbutton.= ' ';
-$newcardbutton.= ' ';
-//}
+$permforcashfence = 1;
+
+$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cash-register', 0, $newcardbutton, '', $limit);
@@ -389,12 +385,18 @@ print '';
foreach($object->fields as $key => $val)
{
- $cssforfield='';
- if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
- if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
- if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
- if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
- if (! empty($arrayfields['t.'.$key]['checked'])) print ' ';
+ $cssforfield=(empty($val['css'])?'':$val['css']);
+ if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
+ elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
+ elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
+ elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right';
+ if (! empty($arrayfields['t.'.$key]['checked']))
+ {
+ print '';
+ if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
+ else print ' ';
+ print ' ';
+ }
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@@ -416,15 +418,15 @@ print ''."\n";
print '';
foreach($object->fields as $key => $val)
{
- $cssforfield='';
- if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
- if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
- if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
- if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
- if (! empty($arrayfields['t.'.$key]['checked']))
- {
- print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
- }
+ $cssforfield=(empty($val['css'])?'':$val['css']);
+ if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
+ elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
+ elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
+ elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right';
+ if (! empty($arrayfields['t.'.$key]['checked']))
+ {
+ print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
+ }
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@@ -467,25 +469,21 @@ while ($i < min($num, $limit))
print ' ';
foreach($object->fields as $key => $val)
{
- $cssforfield='';
- if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
- elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
+ $cssforfield=(empty($val['css'])?'':$val['css']);
+ if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
+ elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
- if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
- elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
+ if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
+ elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
- if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
+ if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked']))
{
- print '';
- print $object->showOutputField($val, $key, $obj->$key, '');
+ print ' ';
+ if ($key == 'status') print $object->getLibStatut(5);
+ elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
+ else print $object->showOutputField($val, $key, $obj->$key, '');
print ' ';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
index 87db81bf98d..354b50365ca 100644
--- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php
+++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
@@ -311,47 +311,20 @@ class CashControl extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- if (empty($this->labelstatus))
+ if (empty($this->labelstatus) || empty($this->labelstatusshort))
{
global $langs;
//$langs->load("mymodule");
$this->labelstatus[0] = $langs->trans('Draft');
$this->labelstatus[1] = $langs->trans('Closed');
+ $this->labelstatusshort[0] = $langs->trans('Draft');
+ $this->labelstatusshort[1] = $langs->trans('Closed');
}
- if ($mode == 0)
- {
- return $this->labelstatus[$status];
- }
- elseif ($mode == 1)
- {
- return $this->labelstatus[$status];
- }
- elseif ($mode == 2)
- {
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- }
- elseif ($mode == 3)
- {
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle');
- }
- elseif ($mode == 4)
- {
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- }
- elseif ($mode == 5)
- {
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle');
- }
- elseif ($mode == 6)
- {
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle');
- }
+ $statusType = 'status0';
+ if ($status == self::STATUS_VALIDATED) $statusType = 'status6';
+
+ return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php
index 25d92fad92a..da5ad40002b 100644
--- a/htdocs/compta/facture/class/api_invoices.class.php
+++ b/htdocs/compta/facture/class/api_invoices.class.php
@@ -565,7 +565,7 @@ class Invoices extends DolibarrApi
throw new RestException(500);
}
- return array(
+ return array(
'success' => array(
'code' => 200,
'message' => 'Invoice deleted'
diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index def454f2ca5..6cc91072a34 100644
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -204,7 +204,7 @@ if ($action == 'create')
print ' '.$langs->trans("Ref").' '.$chid.' ';
print ''.$langs->trans("Type")." ".$charge->type_libelle." \n";
print ''.$langs->trans("Period")." ".dol_print_date($charge->periode, 'day')." \n";
- print ''.$langs->trans("Label").' '.$charge->lib." \n";
+ print ''.$langs->trans("Label").' '.$charge->label." \n";
/*print ''.$langs->trans("DateDue")." ".dol_print_date($charge->date_ech,'day')." \n";
print ''.$langs->trans("Amount")." ".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).' ';*/
diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index 7399a7098c6..e2bf729a396 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -242,12 +242,23 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
{
$object->paye = 0;
$object->id = $object->ref = null;
- $object->lib = $langs->trans("CopyOf").' '.$object->lib;
- if (GETPOST('clone_for_next_month') != '')
- {
- $object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm');
+ if (GETPOST('clone_label', 'alphanohtml')) {
+ $object->label = GETPOST('clone_label', 'alphanohtml');
+ }
+ else {
+ $object->label = $langs->trans("CopyOf").' '.$object->label;
+ }
+
+ if (GETPOST('clone_for_next_month', 'int')) {
$object->periode = dol_time_plus_duree($object->periode, 1, 'm');
+ $object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm');
+ }
+ else {
+ $newdateperiod = dol_mktime(0, 0, 0, GETPOST('clone_periodmonth', 'int'), GETPOST('clone_periodday', 'int'), GETPOST('clone_periodyear', 'int'));
+ $newdateech = dol_mktime(0, 0, 0, GETPOST('clone_date_echmonth', 'int'), GETPOST('clone_date_echday', 'int'), GETPOST('clone_date_echyear', 'int'));
+ if ($newdateperiod) $object->periode = $newdateperiod;
+ if ($newdateech) $object->date_ech = $newdateech;
}
if ($object->check())
@@ -414,12 +425,20 @@ if ($id > 0)
// Clone confirmation
if ($action === 'clone')
{
- $formclone=array(
- array('type' => 'checkbox', 'name' => 'clone_for_next_month','label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1),
-
+ $formquestion=array(
+ array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label),
);
+ if (! empty($conf->global->TAX_ADD_CLON_FOR_NEXT_MONTH_CHECKBOX))
+ {
+ $formquestion[]=array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1);
+ }
+ else
+ {
+ $formquestion[]=array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
+ $formquestion[]=array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("DateDue"), 'value' => -1);
+ }
- print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formclone, 'yes');
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
// Confirmation de la suppression de la charge
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index c5a882283c7..bbffbebe0c9 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -55,7 +55,7 @@ class ChargeSociales extends CommonObject
protected $table_ref_field = 'ref';
public $date_ech;
- public $lib;
+ public $label;
public $type;
public $type_libelle;
public $amount;
@@ -65,6 +65,11 @@ class ChargeSociales extends CommonObject
public $date_modification;
public $date_validation;
+ /**
+ * @deprecated Use label instead
+ */
+ public $lib;
+
/**
* @var int account ID
*/
@@ -106,7 +111,7 @@ class ChargeSociales extends CommonObject
public function fetch($id, $ref = '')
{
$sql = "SELECT cs.rowid, cs.date_ech";
- $sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
+ $sql.= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
$sql.= ", cs.fk_account, cs.fk_mode_reglement";
$sql.= ", c.libelle";
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
@@ -128,7 +133,8 @@ class ChargeSociales extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->date_ech = $this->db->jdate($obj->date_ech);
- $this->lib = $obj->lib;
+ $this->lib = $obj->label;
+ $this->label = $obj->label;
$this->type = $obj->fk_type;
$this->type_libelle = $obj->libelle;
$this->fk_account = $obj->fk_account;
@@ -203,7 +209,7 @@ class ChargeSociales extends CommonObject
$sql.= " VALUES (".$this->type;
$sql.= ", ".($this->fk_account>0 ? $this->fk_account:'NULL');
$sql.= ", ".($this->mode_reglement_id>0 ? $this->mode_reglement_id:"NULL");
- $sql.= ", '".$this->db->escape($this->lib)."'";
+ $sql.= ", '".$this->db->escape($this->label?$this->label:$this->lib)."'";
$sql.= ", '".$this->db->idate($this->date_ech)."'";
$sql.= ", '".$this->db->idate($this->periode)."'";
$sql.= ", '".price2num($newamount)."'";
@@ -323,7 +329,7 @@ class ChargeSociales extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
- $sql.= " SET libelle='".$this->db->escape($this->lib)."'";
+ $sql.= " SET libelle='".$this->db->escape($this->label?$this->label:$this->lib)."'";
$sql.= ", date_ech='".$this->db->idate($this->date_ech)."'";
$sql.= ", periode='".$this->db->idate($this->periode)."'";
$sql.= ", amount='".price2num($this->amount, 'MT')."'";
@@ -543,13 +549,13 @@ class ChargeSociales extends CommonObject
}
- if (empty($this->ref)) $this->ref=$this->lib;
+ if (empty($this->ref)) $this->ref=$this->label;
$label = ''.$langs->trans("ShowSocialContribution").' ';
if (! empty($this->ref))
$label .= ''.$langs->trans('Ref') . ': ' . $this->ref;
- if (! empty($this->lib))
- $label .= ''.$langs->trans('Label') . ': ' . $this->lib;
+ if (! empty($this->label))
+ $label .= ''.$langs->trans('Label') . ': ' . $this->label;
if (! empty($this->type_libelle))
$label .= ''.$langs->trans('Type') . ': ' . $this->type_libelle;
@@ -677,12 +683,12 @@ class ChargeSociales extends CommonObject
$this->ref = 'SPECIMEN';
$this->specimen=1;
$this->paye = 0;
- $this->date = time();
+ $this->date = dol_now();
$this->date_ech=$this->date+3600*24*30;
$this->periode=$this->date+3600*24*30;
$this->amount=100;
- $this->lib = 0;
+ $this->label = 'Social contribution label';
$this->type = 1;
- $this->type_libelle = 'Social contribution label';
+ $this->type_libelle = 'Type of social contribution';
}
}
diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php
index a646d6556ba..ed3569cc3e4 100644
--- a/htdocs/core/boxes/box_ficheinter.php
+++ b/htdocs/core/boxes/box_ficheinter.php
@@ -138,7 +138,7 @@ class box_ficheinter extends ModeleBoxes
$this->info_box_contents[$i][] = array(
'td' => 'class="nowrap right"',
- 'text' => $ficheinterstatic->getLibStatut(6),
+ 'text' => $ficheinterstatic->getLibStatut(3),
'asis' => 1,
);
diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php
index e285cc34289..1039ea74385 100644
--- a/htdocs/core/boxes/box_task.php
+++ b/htdocs/core/boxes/box_task.php
@@ -119,25 +119,25 @@ class box_task extends ModeleBoxes
// list the summary of the orders
if ($user->rights->projet->lire) {
$boxcontent.= '
'."\n";
- $boxcontent.= ''."\n";
+ $boxcontent.= '
'."\n";
$boxcontent.= '
boxcode.'">'."\n";
$boxcontent.= ' '."\n";
$selectArray = array('all' => $langs->trans("NoFilter"), 'im_task_contact' => $langs->trans("WhichIamLinkedTo"), 'im_project_contact' => $langs->trans("WhichIamLinkedToProject"));
$boxcontent.= $form->selectArray($cookie_name, $selectArray, $filterValue);
- $boxcontent.= ''.$langs->trans("Change").' ';
+ $boxcontent.= ''.$langs->trans("Refresh").' ';
$boxcontent.= ' '."\n";
$boxcontent.= ''."\n";
$boxcontent.= '';
// set cookie by js
$boxcontent.='';
$this->info_box_contents[0][] = array(
- 'tr'=>'class="nohover"',
+ 'tr'=>'class="nohover showiffilter'.$this->boxcode.' hideobject"',
'td' => 'class="nohover"',
'textnoformat' => $boxcontent,
);
@@ -188,7 +188,7 @@ class box_task extends ModeleBoxes
$label = $projectstatic->getNomUrl(1).' '.$taskstatic->getNomUrl(1).' '.dol_htmlentities($taskstatic->label);
- $boxcontent = getTaskProgressView($taskstatic, $label, true, false, true);
+ $boxcontent = getTaskProgressView($taskstatic, $label, true, false, false);
$this->info_box_contents[$i][] = array(
'td' => '',
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 7f1c2cbee50..72c1e589233 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4070,13 +4070,13 @@ class Form
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ...
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0'
- * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
- * @param int $height Force height of box
+ * @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
+ * @param int $height Force height of box (0 = auto)
* @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
* @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a
section.
* @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
*/
- public function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 210, $width = 500, $disableformtag = 0)
+ public function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 0, $width = 500, $disableformtag = 0)
{
global $langs,$conf;
global $useglobalvars;
@@ -4090,6 +4090,14 @@ class Form
$newselectedchoice=empty($selectedchoice)?"no":$selectedchoice;
if ($conf->browser->layout == 'phone') $width='95%';
+ // Set height automatically if not defined
+ if (empty($height)) {
+ $height = 210;
+ if (is_array($formquestion) && count($formquestion) > 2) {
+ $height += ((count($formquestion) - 2) * 24);
+ }
+ }
+
if (is_array($formquestion) && ! empty($formquestion))
{
// First add hidden fields and value
@@ -4105,7 +4113,7 @@ class Form
}
// Now add questions
- $more.=''."\n";
+ $more.=''."\n";
if (! empty($formquestion['text'])) $more.='
'.$formquestion['text'].' '."\n";
foreach ($formquestion as $key => $input)
{
@@ -4117,52 +4125,52 @@ class Form
if ($input['type'] == 'text')
{
- $more.='
'.$input['label'].' '."\n";
+ $more.='
'."\n";
}
elseif ($input['type'] == 'password')
{
- $more.='
'.$input['label'].' '."\n";
+ $more.='
'."\n";
}
elseif ($input['type'] == 'select')
{
- $more.='
';
- if (! empty($input['label'])) $more.=$input['label'].' ';
+ $more.='';
+ if (! empty($input['label'])) $more.=$input['label'].'
';
$more.=$this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss);
- $more.='
'."\n";
+ $more.='
'."\n";
}
elseif ($input['type'] == 'checkbox')
{
- $more.='';
- $more.=''.$input['label'].' ';
+ $more.='';
+ $more.='
'.$input['label'].'
';
$more.='
';
- $more.=' '."\n";
+ $more.=' />';
+ $more.=''."\n";
}
elseif ($input['type'] == 'radio')
{
$i=0;
foreach($input['values'] as $selkey => $selval)
{
- $more.='';
- if ($i==0) $more.=''.$input['label'].' ';
- else $more.=' ';
- $more.=' ';
+ if ($i==0) $more.=''.$input['label'].'
';
+ else $more.='
';
+ $more.=' ';
$more.=$selval;
- $more.='
'."\n";
+ $more.=''."\n";
$i++;
}
}
elseif ($input['type'] == 'date')
{
- $more.=''.$input['label'].' ';
- $more.='';
+ $more.=''.$input['label'].'
';
+ $more.='
';
$more.=$this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, 0);
- $more.='
'."\n";
+ $more.=''."\n";
$formquestion[] = array('name'=>$input['name'].'day');
$formquestion[] = array('name'=>$input['name'].'month');
$formquestion[] = array('name'=>$input['name'].'year');
@@ -4171,21 +4179,21 @@ class Form
}
elseif ($input['type'] == 'other')
{
- $more.='';
- if (! empty($input['label'])) $more.=$input['label'].' ';
+ $more.='';
+ if (! empty($input['label'])) $more.=$input['label'].'
';
$more.=$input['value'];
- $more.='
'."\n";
+ $more.=''."\n";
}
elseif ($input['type'] == 'onecolumn')
{
- $more.='';
+ $more.='';
$more.=$input['value'];
- $more.='
'."\n";
+ $more.=''."\n";
}
}
}
- $more.='
'."\n";
+ $more.=' '."\n";
}
// JQUI method dialog is broken with jmobile, we use standard HTML.
diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php
index 6fc00605d77..12ec3e7f5ad 100644
--- a/htdocs/core/class/html.formwebsite.class.php
+++ b/htdocs/core/class/html.formwebsite.class.php
@@ -47,7 +47,7 @@ class FormWebsite
/**
- * Return HTML select list of export models
+ * Return HTML select list of websites
*
* @param string $selected Id modele pre-selectionne
* @param string $htmlname Name of HTML select
@@ -99,7 +99,7 @@ class FormWebsite
/**
- * Return a HTML select list of a dictionary
+ * Return a HTML select list of type of containers from the dictionary
*
* @param string $htmlname Name of select zone
* @param string $selected Selected value
@@ -162,7 +162,7 @@ class FormWebsite
/**
- * Return a HTML select list of type of containers
+ * Return a HTML select list of samples of containers content
*
* @param string $htmlname Name of select zone
* @param string $selected Selected value
@@ -217,4 +217,72 @@ class FormWebsite
return $out;
}
+
+
+ /**
+ * Return a HTML select list of containers of a website.
+ * Note: $website->lines must have been loaded.
+ *
+ * @param Website $website Object Website
+ * @param string $htmlname Name of select zone
+ * @param int $pageid Preselected container ID
+ * @param int $showempty Show empty record
+ * @param string $action Action on page that use this select list
+ * @return string HTML select component with list of type of containers
+ */
+ public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '')
+ {
+ global $langs;
+
+ $atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
+
+ $out='';
+ if ($atleastonepage && $action != 'editsource')
+ {
+ $out.='';
+ }
+ else
+ {
+ $out.='';
+ }
+
+ if ($showempty || ! $atleastonepage) $out.=' ';
+
+ if ($atleastonepage)
+ {
+ if (empty($pageid) && $action != 'createcontainer') // Page id is not defined, we try to take one
+ {
+ $firstpageid=0;$homepageid=0;
+ foreach($website->lines as $key => $valpage)
+ {
+ if (empty($firstpageid)) $firstpageid=$valpage->id;
+ if ($website->fk_default_home && $key == $website->fk_default_home) $homepageid=$valpage->id;
+ }
+ $pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
+ }
+
+ foreach($website->lines as $key => $valpage)
+ {
+ $out.=' 0 && $pageid == $key) $out.=' selected'; // To preselect a value
+ $out.='>';
+ $out.='['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).'] ';
+ $out.=$valpage->pageurl.' - '.$valpage->title;
+ if ($website->fk_default_home && $key == $website->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
+ $out.=' ';
+ }
+ }
+ $out.=' ';
+
+ if ($atleastonepage && $action != 'editsource')
+ {
+ $out.=ajax_combobox($htmlname);
+ }
+ else
+ {
+ $out.=' ';
+ $out.=ajax_combobox($htmlname);
+ }
+ return $out;
+ }
}
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 07d51105ca8..711e65edaaa 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -1851,7 +1851,7 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
{
try {
- $ret = $image->writeImages($fileoutput, true);
+ $ret = $image->writeImages($fileoutput, true);
}
catch(Exception $e)
{
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index ca6a4a93e4e..4d4a20f3a5c 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3028,7 +3028,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
- 'address', 'bank', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h', 'bookmark', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note',
+ 'address', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
+ 'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
@@ -3058,12 +3059,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$morecss .= ($morecss ? ' ' : '').('picto'.$pictowithouttext);
} elseif ($pictowithouttext == 'switch_off') {
$facolor = '#999';
- $fasize = '2em';
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
}
elseif ($pictowithouttext == 'switch_on') {
$facolor = '#227722';
- $fasize = '2em';
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
}
elseif ($pictowithouttext == 'off') {
diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
index 3c371c39491..38358222282 100644
--- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
+++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
@@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
/**
* Class to build documents using ODF templates generator
*/
-class doc_generic_bom_odt extends ModelePDFBOMs
+class doc_generic_bom_odt extends ModelePDFBoms
{
/**
* Issuer
@@ -479,7 +479,7 @@ class doc_generic_bom_odt extends ModelePDFBOMs
}
else {
try {
- $odfHandler->saveToDisk($file);
+ $odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
diff --git a/htdocs/core/modules/bom/modules_bom.php b/htdocs/core/modules/bom/modules_bom.php
index 45bca8a38b3..f8f29fec2e6 100644
--- a/htdocs/core/modules/bom/modules_bom.php
+++ b/htdocs/core/modules/bom/modules_bom.php
@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
/**
* Parent class for boms models
*/
-abstract class ModelePDFBom extends CommonDocGenerator
+abstract class ModelePDFBoms extends CommonDocGenerator
{
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php
index 1700f15afd7..47daf430873 100644
--- a/htdocs/core/modules/modBom.class.php
+++ b/htdocs/core/modules/modBom.class.php
@@ -189,7 +189,7 @@ class modBom extends DolibarrModules
// Boxes/Widgets
// Add here list of php file(s) stored in bom/core/boxes that contains class to show a widget.
$this->boxes = array(
- 0=>array('file'=>'box_boms.php','note'=>'','enabledbydefaulton'=>'Home')
+ 0=>array('file' => 'box_boms.php', 'note' => '', 'enabledbydefaulton' => 'Home')
);
@@ -203,7 +203,7 @@ class modBom extends DolibarrModules
// );
- // Permissions
+ // Permissions provided by this module
$this->rights = array(); // Permission array used by this module
$r=0;
@@ -228,7 +228,7 @@ class modBom extends DolibarrModules
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2)
- // Main menu entries
+ // Main menu entries to add
$this->menu = array(); // List of menus to add
$r=0;
@@ -323,9 +323,8 @@ class modBom extends DolibarrModules
if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default')
// Create extrafields
- include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields = new ExtraFields($this->db);
-
+ //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+ //$extrafields = new ExtraFields($this->db);
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->bom->enabled');
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->bom->enabled');
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->bom->enabled');
@@ -357,8 +356,8 @@ class modBom extends DolibarrModules
}
$sql = array(
- "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('alpha')."' AND type = 'bom' AND entity = ".$conf->entity,
- "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('alpha')."', 'bom', ".$conf->entity.")"
+ "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'bom' AND entity = ".$conf->entity,
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'bom', ".$conf->entity.")"
);
return $this->_init($sql, $options);
diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php
index 53f778d063f..bc85111ebd2 100644
--- a/htdocs/core/modules/modMrp.class.php
+++ b/htdocs/core/modules/modMrp.class.php
@@ -58,7 +58,7 @@ class modMrp extends DolibarrModules
// Module label (no space allowed), used if translation string 'ModuleMrpName' not found (Mrp is name of module).
$this->name = preg_replace('/^mod/i', '', get_class($this));
// Module description, used if translation string 'ModuleMrpDesc' not found (Mrp is name of module).
- $this->description = "MRPDescription";
+ $this->description = "Module to Manage Manufacturing Orders (MO)";
// Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "Module to Manage Manufacturing Orders (MO)";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
@@ -113,7 +113,7 @@ class modMrp extends DolibarrModules
// Example: this->dirs = array("/mrp/temp","/mrp/subdir");
$this->dirs = array("/mrp/temp");
// Config pages. Put here list of php page, stored into mrp/admin directory, to use to setup module.
- $this->config_page_url = array("setup.php@mrp");
+ $this->config_page_url = array("mrp.php");
// Dependencies
// A condition to hide module
$this->hidden = false;
@@ -135,7 +135,9 @@ class modMrp extends DolibarrModules
// 2 => array('MRP_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
// );
$this->const = array(
- // 1 => array('MRP_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
+ 1=>array('MRP_MO_ADDON_PDF', 'chaine', 'alpha', 'Name of PDF model of MO', 0),
+ 2=>array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0),
+ 3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/mrps', '', 0)
);
// Some keys to add into the overwriting translation tables
@@ -312,6 +314,8 @@ class modMrp extends DolibarrModules
*/
public function init($options = '')
{
+ global $conf, $langs;
+
$result=$this->_load_tables('/mrp/sql/');
if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
@@ -324,7 +328,34 @@ class modMrp extends DolibarrModules
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
+ // Permissions
+ $this->remove($options);
+
$sql = array();
+
+ // ODT template
+ $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mrps/template_mo.odt';
+ $dirodt=DOL_DATA_ROOT.'/doctemplates/mrps';
+ $dest=$dirodt.'/template_mo.odt';
+
+ if (file_exists($src) && ! file_exists($dest))
+ {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ dol_mkdir($dirodt);
+ $result=dol_copy($src, $dest, 0, 0);
+ if ($result < 0)
+ {
+ $langs->load("errors");
+ $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
+ return 0;
+ }
+ }
+
+ $sql = array(
+ "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'mo' AND entity = ".$conf->entity,
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'mo', ".$conf->entity.")"
+ );
+
return $this->_init($sql, $options);
}
diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php
index 30d90b8a0c6..cfa45cb6a4b 100644
--- a/htdocs/core/modules/modStripe.class.php
+++ b/htdocs/core/modules/modStripe.class.php
@@ -150,7 +150,7 @@ class modStripe extends DolibarrModules
'target' => '',
'user' => 0
);
- $this->menu[$r] = array(
+ $this->menu[$r] = array(
'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
'type' => 'left',
'titre' => 'StripePayoutList',
diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
index 6d85bfd3553..0447694465f 100644
--- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
+++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
@@ -27,7 +27,7 @@
* \brief File of class to build ODT documents for MOs
*/
-require_once DOL_DOCUMENT_ROOT.'/core/modules/bom/modules_bom.php';
+require_once DOL_DOCUMENT_ROOT.'/core/modules/mrp/modules_mrp.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
/**
* Class to build documents using ODF templates generator
*/
-class doc_generic_mo_odt extends ModelePDFMOs
+class doc_generic_mo_odt extends ModelePDFMos
{
/**
* Issuer
@@ -486,7 +486,7 @@ class doc_generic_mo_odt extends ModelePDFMOs
}
else {
try {
- $odfHandler->saveToDisk($file);
+ $odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
diff --git a/htdocs/core/modules/mrp/mod_mrp_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php
similarity index 93%
rename from htdocs/core/modules/mrp/mod_mrp_advanced.php
rename to htdocs/core/modules/mrp/mod_mo_advanced.php
index 1c24b4010ba..42c506194f3 100644
--- a/htdocs/core/modules/mrp/mod_mrp_advanced.php
+++ b/htdocs/core/modules/mrp/mod_mo_advanced.php
@@ -21,7 +21,7 @@
*/
/**
- * \file htdocs/core/modules/mrp/mod_mrp_advanced.php
+ * \file htdocs/core/modules/mrp/mod_mo_advanced.php
* \ingroup mrp
* \brief File containing class for numbering model of MOs advanced
*/
@@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/mrp/modules_mrp.php';
/**
- * Class to manage customer Bom numbering rules advanced
+ * Class to manage MO numbering rules advanced
*/
-class mod_mrp_advanced extends ModeleNumRefMos
+class mod_mo_advanced extends ModeleNumRefMos
{
/**
* Dolibarr version of the loaded document
@@ -68,7 +68,7 @@ class mod_mrp_advanced extends ModeleNumRefMos
$texte.= '';
$texte.= ' ';
$texte.= ' ';
- $texte.= ' ';
+ $texte.= ' ';
$texte.= '';
$tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo"));
@@ -79,7 +79,7 @@ class mod_mrp_advanced extends ModeleNumRefMos
// Parametrage du prefix
$texte.= ''.$langs->trans("Mask").': ';
- $texte.= ''.$form->textwithpicto(' ', $tooltip, 1, 1).' ';
+ $texte.= ''.$form->textwithpicto(' ', $tooltip, 1, 1).' ';
$texte.= ' ';
@@ -129,7 +129,7 @@ class mod_mrp_advanced extends ModeleNumRefMos
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
// We get cursor rule
- $mask=$conf->global->MRP_ADVANCED_MASK;
+ $mask=$conf->global->MRP_MO_ADVANCED_MASK;
if (! $mask)
{
diff --git a/htdocs/core/modules/mrp/mod_mrp_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php
similarity index 90%
rename from htdocs/core/modules/mrp/mod_mrp_standard.php
rename to htdocs/core/modules/mrp/mod_mo_standard.php
index 24f1b0a1f69..6d392a6b74c 100644
--- a/htdocs/core/modules/mrp/mod_mrp_standard.php
+++ b/htdocs/core/modules/mrp/mod_mo_standard.php
@@ -18,16 +18,16 @@
*/
/**
- * \file htdocs/core/modules/mrp/mod_mrp_standard.php
+ * \file htdocs/core/modules/mrp/mod_mo_standard.php
* \ingroup mrp
* \brief File of class to manage MO numbering rules standard
*/
require_once DOL_DOCUMENT_ROOT .'/core/modules/mrp/modules_mrp.php';
/**
- * Class to manage customer order numbering rules standard
+ * Class to manage MO numbering rules standard
*/
-class mod_mrp_standard extends ModeleNumRefMos
+class mod_mo_standard extends ModeleNumRefMos
{
/**
* Dolibarr version of the loaded document
@@ -85,7 +85,7 @@ class mod_mrp_standard extends ModeleNumRefMos
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
- $sql.= " FROM ".MAIN_DB_PREFIX."bom";
+ $sql.= " FROM ".MAIN_DB_PREFIX."mrp_mo";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity;
@@ -119,7 +119,7 @@ class mod_mrp_standard extends ModeleNumRefMos
// D'abord on recupere la valeur max
$posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
- $sql.= " FROM ".MAIN_DB_PREFIX."bom_bom";
+ $sql.= " FROM ".MAIN_DB_PREFIX."mrp_mo";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity;
@@ -132,7 +132,7 @@ class mod_mrp_standard extends ModeleNumRefMos
}
else
{
- dol_syslog("mod_mrp_standard::getNextValue", LOG_DEBUG);
+ dol_syslog("mod_mo_standard::getNextValue", LOG_DEBUG);
return -1;
}
@@ -143,7 +143,7 @@ class mod_mrp_standard extends ModeleNumRefMos
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
else $num = sprintf("%04s", $max+1);
- dol_syslog("mod_mrp_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
+ dol_syslog("mod_mo_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
}
diff --git a/htdocs/don/card.php b/htdocs/don/card.php
index 54d4e392f61..b804f3c7a46 100644
--- a/htdocs/don/card.php
+++ b/htdocs/don/card.php
@@ -741,7 +741,7 @@ if (! empty($id) && $action != 'edit')
{
$num = $db->num_rows($resql);
$i = 0; $total = 0;
- print '';
+ print '';
print '';
print ''.$langs->trans("RefPayment").' ';
print ''.$langs->trans("Date").' ';
diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php
index 43bdcead36f..b24213d5c70 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -123,10 +123,11 @@ class Don extends CommonObject
*/
public $labelstatutshort;
- /**
- * Draft
- */
+
const STATUS_DRAFT = 0;
+ const STATUS_VALIDATED = 1;
+ const STATUS_PAID = 2;
+ const STATUS_CANCELED = -1;
/**
@@ -155,11 +156,11 @@ class Don extends CommonObject
/**
* Return the label of a given status
*
- * @param int $statut Id statut
+ * @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
if (empty($this->labelstatut) || empty($this->labelstatutshort))
@@ -176,49 +177,11 @@ class Don extends CommonObject
$this->labelstatutshort[2]=$langs->trans("DonationStatusPaidShort");
}
- if ($mode == 0)
- {
- return $this->labelstatut[$statut];
- }
- elseif ($mode == 1)
- {
- return $this->labelstatutshort[$statut];
- }
- elseif ($mode == 2)
- {
- if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5').' '.$this->labelstatutshort[$statut];
- elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0').' '.$this->labelstatutshort[$statut];
- elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatutshort[$statut];
- elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatutshort[$statut];
- }
- elseif ($mode == 3)
- {
- if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5');
- elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0');
- elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1');
- elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6');
- }
- elseif ($mode == 4)
- {
- if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5').' '.$this->labelstatut[$statut];
- elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0').' '.$this->labelstatut[$statut];
- elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
- elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
- }
- elseif ($mode == 5)
- {
- if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut5');
- elseif ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut0');
- elseif ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
- elseif ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
- }
- elseif ($mode == 6)
- {
- if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut5');
- elseif ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut0');
- elseif ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
- elseif ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
- }
+ $statusType = 'status'.$status;
+ if ($status == self::STATUS_CANCELED) $statusType = 'status5';
+ if ($status == self::STATUS_PAID) $statusType = 'status6';
+
+ return dolGetStatus($this->labelstatut[$status], $this->labelstatutshort[$status], '', $statusType, $mode);
}
diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php
index 71895a7d2c3..612ea5a553b 100644
--- a/htdocs/don/payment/payment.php
+++ b/htdocs/don/payment/payment.php
@@ -240,7 +240,7 @@ if (GETPOST('action', 'aZ09') == 'create')
/*
* List of payments on donation
*/
-
+
$num = 1;
$i = 0;
diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php
index c09c62a4714..2ab90bcd73b 100644
--- a/htdocs/fourn/class/api_supplier_orders.class.php
+++ b/htdocs/fourn/class/api_supplier_orders.class.php
@@ -273,7 +273,7 @@ class SupplierOrders extends DolibarrApi
throw new RestException(500);
}
- return array(
+ return array(
'success' => array(
'code' => 200,
'message' => 'Supplier order deleted'
diff --git a/htdocs/install/doctemplates/boms/template_bom.odt b/htdocs/install/doctemplates/boms/template_bom.odt
index 344fcfa391a..9eea32e4197 100644
Binary files a/htdocs/install/doctemplates/boms/template_bom.odt and b/htdocs/install/doctemplates/boms/template_bom.odt differ
diff --git a/htdocs/install/doctemplates/mrps/template_mo.odt b/htdocs/install/doctemplates/mrps/template_mo.odt
new file mode 100644
index 00000000000..7545fe73a34
Binary files /dev/null and b/htdocs/install/doctemplates/mrps/template_mo.odt differ
diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql
index 064db3be207..d599f1b40ed 100644
--- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql
+++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql
@@ -49,6 +49,8 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
-- For v11
+ALTER TABLE llx_don ADD COLUMN fk_user_modif integer;
+
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_origin_line (fk_origin_line);
ALTER TABLE llx_rights_def ADD COLUMN module_position INTEGER NOT NULL DEFAULT 0;
diff --git a/htdocs/install/mysql/tables/llx_don.sql b/htdocs/install/mysql/tables/llx_don.sql
index ee17fdd1e67..f03e82d6143 100644
--- a/htdocs/install/mysql/tables/llx_don.sql
+++ b/htdocs/install/mysql/tables/llx_don.sql
@@ -47,6 +47,7 @@ create table llx_don
fk_projet integer NULL, -- Donation is given for a project ?
datec datetime, -- Create date
fk_user_author integer NOT NULL,
+ fk_user_modif integer,
date_valid datetime, -- date de validation
fk_user_valid integer NULL,
note_private text,
diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang
index 6bf86dac102..bc71a65f72a 100644
--- a/htdocs/langs/en_US/mrp.lang
+++ b/htdocs/langs/en_US/mrp.lang
@@ -2,7 +2,7 @@ Mrp=Manufacturing Orders
MO=Manufacturing Order
MRPDescription=Module to manage Manufacturing Orders (MO).
MRPArea=MRP Area
-MrpSetupPage=Setup of module MO
+MrpSetupPage=Setup of module MRP
MenuBOM=Bills of material
LatestBOMModified=Latest %s Bills of materials modified
LatestMOModified=Latest %s Manufacturing Orders modified
@@ -14,14 +14,21 @@ ListOfManufacturingOrders=List of Manufacturing Orders
NewBOM=New bill of material
ProductBOMHelp=Product to create with this BOM
BOMsNumberingModules=BOM numbering templates
-BOMsModelModule=BOMS document templates
+BOMsModelModule=BOM document templates
+MOsNumberingModules=MO numbering templates
+MOsModelModule=MO document templates
FreeLegalTextOnBOMs=Free text on document of BOM
WatermarkOnDraftBOMs=Watermark on draft BOM
-ConfirmCloneBillOfMaterials=Are you sure you want to clone this bill of material ?
+FreeLegalTextOnMOs=Free text on document of MO
+WatermarkOnDraftMOs=Watermark on draft MO
+ConfirmCloneBillOfMaterials=Are you sure you want to clone the bill of material %s ?
+ConfirmCloneMo=Are you sure you want to clone the Manufacturing Order %s ?
ManufacturingEfficiency=Manufacturing efficiency
ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production
DeleteBillOfMaterials=Delete Bill Of Materials
+DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Material?
+ConfirmDeleteMo=Are you sure you want to delete this Bill Of Material?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang
index be758c04890..62ce5a23531 100644
--- a/htdocs/langs/en_US/website.lang
+++ b/htdocs/langs/en_US/website.lang
@@ -117,4 +117,5 @@ ImportSite=Import site
EditInLineOnOff=Mode 'Edit inline' is %s
ShowSubContainersOnOff=Mode to execute 'dynamic content' is %s
GlobalCSSorJS=Global CSS/JS/Header file of web site
-BackToHomePage=Back to home page...
\ No newline at end of file
+BackToHomePage=Back to home page...
+TranslationLinks=Translation links
\ No newline at end of file
diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php
index bc3b6c4050c..2cfcd269b62 100644
--- a/htdocs/modulebuilder/template/class/api_mymodule.class.php
+++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php
@@ -271,7 +271,7 @@ class MyModuleApi extends DolibarrApi
throw new RestException(500, 'Error when deleting MyObject : '.$this->myobject->error);
}
- return array(
+ return array(
'success' => array(
'code' => 200,
'message' => 'MyObject deleted'
diff --git a/htdocs/modulebuilder/template/core/modules/myobject/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/myobject/doc/doc_generic_myobject_odt.modules.php
index bffc0d5c470..822d6110c4b 100644
--- a/htdocs/modulebuilder/template/core/modules/myobject/doc/doc_generic_myobject_odt.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/myobject/doc/doc_generic_myobject_odt.modules.php
@@ -486,7 +486,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
}
else {
try {
- $odfHandler->saveToDisk($file);
+ $odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
diff --git a/htdocs/mrp/admin/setup.php b/htdocs/mrp/admin/setup.php
deleted file mode 100644
index 8d7df29b383..00000000000
--- a/htdocs/mrp/admin/setup.php
+++ /dev/null
@@ -1,151 +0,0 @@
-
- * Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-/**
- * \file mrp/admin/setup.php
- * \ingroup mrp
- * \brief Mrp setup page.
- */
-
-// Load Dolibarr environment
-$res=0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
-while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
-if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
-if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
-// Try main.inc.php using relative path
-if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
-if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
-if (! $res) die("Include of main fails");
-
-global $langs, $user;
-
-// Libraries
-require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
-require_once '../lib/mrp.lib.php';
-//require_once "../class/myclass.class.php";
-
-// Translations
-$langs->loadLangs(array("admin", "mrp"));
-
-// Access control
-if (! $user->admin) accessforbidden();
-
-// Parameters
-$action = GETPOST('action', 'alpha');
-$backtopage = GETPOST('backtopage', 'alpha');
-
-$arrayofparameters=array(
- 'MRP_MYPARAM1'=>array('css'=>'minwidth200','enabled'=>1),
- 'MRP_MYPARAM2'=>array('css'=>'minwidth500','enabled'=>1)
-);
-
-
-
-/*
- * Actions
- */
-
-if ((float) DOL_VERSION >= 6)
-{
- include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
-}
-
-
-
-/*
- * View
- */
-
-$page_name = "MrpSetup";
-llxHeader('', $langs->trans($page_name));
-
-// Subheader
-$linkback = ''.$langs->trans("BackToModuleList").' ';
-
-print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mrp');
-
-// Configuration header
-$head = mrpAdminPrepareHead();
-dol_fiche_head($head, 'settings', '', -1, "mrp");
-
-// Setup page goes here
-echo ''.$langs->trans("MrpSetupPage").' ';
-
-
-if ($action == 'edit')
-{
- print '';
- print ' ';
- print ' ';
-
- print '';
-
- print '';
- print ' ';
- print '
';
-
- print ' ';
- print ' ';
-}
-else
-{
- if (! empty($arrayofparameters))
- {
- print '';
- print ''.$langs->trans("Parameter").' '.$langs->trans("Value").' ';
-
- foreach($arrayofparameters as $key => $val)
- {
- print '';
- $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
- print $form->textwithpicto($langs->trans($key), $tooltiphelp);
- print ' ' . $conf->global->$key . ' ';
- }
-
- print '
';
-
- print '';
- }
- else
- {
- print ' '.$langs->trans("NothingToSetup");
- }
-}
-
-
-// Page end
-dol_fiche_end();
-
-llxFooter();
-$db->close();
diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index 0525f71ab5f..71a743eb071 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -94,8 +94,10 @@ class Mo extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,),
- 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
+ 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",),
+ 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",),
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce",),
+ 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>52),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
@@ -105,12 +107,10 @@ class Mo extends CommonObject
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
- 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",),
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
- 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
- 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '-1'=>'Canceled')),
+ 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '-1'=>'Canceled')),
);
public $rowid;
public $ref;
diff --git a/htdocs/mrp/lib/mrp.lib.php b/htdocs/mrp/lib/mrp.lib.php
index 7ee1fcd04c7..4fdfa25342e 100644
--- a/htdocs/mrp/lib/mrp.lib.php
+++ b/htdocs/mrp/lib/mrp.lib.php
@@ -35,7 +35,7 @@ function mrpAdminPrepareHead()
$h = 0;
$head = array();
- $head[$h][0] = dol_buildpath("/mrp/admin/setup.php", 1);
+ $head[$h][0] = dol_buildpath("/admin/mrp.php", 1);
$head[$h][1] = $langs->trans("Settings");
$head[$h][2] = 'settings';
$h++;
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 2ba78b32945..bf2b3a0e410 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -4380,10 +4380,10 @@ class Product extends CommonObject
/**
* Return label of a given status
*
- * @param int $status Statut
- * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
- * @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
- * @return string Label of status
+ * @param int $status Statut
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
+ * @return string Label of status
*/
public function LibStatut($status, $mode = 0, $type = 0)
{
@@ -4420,42 +4420,41 @@ class Product extends CommonObject
$statuttrans=empty($status)?'status5':'status4';
- if($status == 0){
+ if ($status == 0) {
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
- if($type==0){
+ if($type==0) {
$labelstatut = $langs->trans('ProductStatusNotOnSellShort');
$labelstatutShort = $langs->trans('ProductStatusNotOnSell');
}
- elseif($type == 1){
+ elseif($type == 1) {
$labelstatut = $langs->trans('ProductStatusNotOnBuyShort');
$labelstatutShort = $langs->trans('ProductStatusNotOnBuy');
}
- elseif($type == 2){
+ elseif($type == 2) {
$labelstatut = $langs->trans('ProductStatusNotOnBatch');
$labelstatutShort = $langs->trans('ProductStatusNotOnBatchShort');
}
}
- elseif($status == 1){
+ elseif ($status == 1) {
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
- if($type==0){
+ if ($type==0) {
$labelstatut = $langs->trans('ProductStatusOnSellShort');
$labelstatutShort = $langs->trans('ProductStatusOnSell');
}
- elseif($type == 1){
+ elseif ($type == 1) {
$labelstatut = $langs->trans('ProductStatusOnBuyShort');
$labelstatutShort = $langs->trans('ProductStatusOnBuy');
}
- elseif($type == 2){
+ elseif ($type == 2) {
$labelstatut = $langs->trans('ProductStatusOnBatch');
$labelstatutShort = $langs->trans('ProductStatusOnBatchShort');
}
}
- if($mode>6){
+ if ($mode > 6) {
return dolGetStatus($langs->trans('Unknown'), '', '', 'status0', 0);
- }
- else{
+ } else {
return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode);
}
}
diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index a92d2cd071a..477dcc20b0c 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -360,10 +360,10 @@ if ($result)
print '';
}
print '';
- print $product_static->LibStatut($objp->tosell, 3, 0);
+ print $product_static->LibStatut($objp->tosell, 5, 0);
print " ";
print '';
- print $product_static->LibStatut($objp->tobuy, 3, 1);
+ print $product_static->LibStatut($objp->tobuy, 5, 1);
print " ";
print " \n";
$i++;
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index 067c371bf67..4a3d08f6602 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -1725,6 +1725,7 @@ if ($action != 'dopayment')
{
// If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of stripe
print ' ';
+ print ' ';
print ' ';
print ''.$langs->trans("CreditOrDebitCard").' ';
print '
';
@@ -1858,12 +1859,12 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment
$service = 'StripeLive';
$servicestatus = 1;
-
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))
{
$service = 'StripeTest';
$servicestatus = 0;
}
+
$stripe = new Stripe($db);
$stripeacc = $stripe->getStripeAccount($service);
$stripecu = null;
@@ -1871,7 +1872,10 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment
if (! empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION))
{
- $paymentintent=$stripe->getPaymentIntent($amount, $currency, $tag, 'Stripe payment: '.$fulltag.(is_object($object)?' ref='.$object->ref:''), $object, $stripecu, $stripeacc, $servicestatus);
+ $noidempotency_key = (GETPOSTISSET('noidempotency') ? GETPOST('noidempotency', 'int') : 0); // By default noidempotency is unset, so we must use a different tag/ref for each payment. If set, we can pay several times the same tag/ref.
+ $paymentintent=$stripe->getPaymentIntent($amount, $currency, $tag, 'Stripe payment: '.$fulltag.(is_object($object)?' ref='.$object->ref:''), $object, $stripecu, $stripeacc, $servicestatus, 0, 'automatic', false, null, 0, $noidempotency_key);
+ // The paymentintnent has status 'requires_payment_method' (even if paymentintent was already payed)
+ //var_dump($paymentintent);
if ($stripe->error) setEventMessages($stripe->error, null, 'errors');
}
}
diff --git a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php
index 11100c79d75..3f1740d395c 100644
--- a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php
+++ b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php
@@ -23,7 +23,6 @@ if (empty($conf) || ! is_object($conf))
exit;
}
-
$contact = $GLOBALS['objcanvas']->control->object;
?>
@@ -78,7 +77,7 @@ $contact = $GLOBALS['objcanvas']->control->object;
control->tpl['ismodifiable_customercode']) { ?>
- control->tpl['customercode']; ?>
+ control->tpl['customercode']; ?>
@@ -99,7 +98,7 @@ $contact = $GLOBALS['objcanvas']->control->object;
control->tpl['ismodifiable_suppliercode']) { ?>
- control->tpl['suppliercode']; ?>
+ control->tpl['suppliercode']; ?>
diff --git a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php
index 6f3628d93b7..976b00962d8 100644
--- a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php
+++ b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php
@@ -75,7 +75,7 @@ if (empty($conf) || ! is_object($conf))
control->tpl['ismodifiable_customercode']) { ?>
- control->tpl['customercode']; ?>
+ control->tpl['customercode']; ?>
@@ -96,7 +96,7 @@ if (empty($conf) || ! is_object($conf))
control->tpl['ismodifiable_suppliercode']) { ?>
- control->tpl['suppliercode']; ?>
+ control->tpl['suppliercode']; ?>
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index b20f80f5439..fe8c78c7aa2 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2258,8 +2258,8 @@ class Societe extends CommonObject
/**
* Return label of status (activity, closed)
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Libelle
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function getLibStatut($mode = 0)
{
diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php
index 5bd493fdeba..b2962478b17 100644
--- a/htdocs/societe/index.php
+++ b/htdocs/societe/index.php
@@ -316,7 +316,7 @@ if ($result)
print dol_print_date($thirdparty_static->datem, 'day');
print "";
print '';
- print $thirdparty_static->getLibStatut(3);
+ print $thirdparty_static->getLibStatut(5);
print " ";
print "\n";
$i++;
diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php
index 021a9fac1f9..c30e3169ee5 100644
--- a/htdocs/stripe/class/stripe.class.php
+++ b/htdocs/stripe/class/stripe.class.php
@@ -318,9 +318,10 @@ class Stripe extends CommonObject
* @param boolean $confirmnow false=default, true=try to confirm immediatly after create (if conditions are ok)
* @param string $payment_method 'pm_....' (if known)
* @param string $off_session If we use an already known payment method to pay off line.
+ * @param string $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found and failed to create
*/
- public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0)
+ public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 0)
{
global $conf;
@@ -352,9 +353,10 @@ class Stripe extends CommonObject
if (is_object($object))
{
// Warning. If a payment was tried and failed, a payment intent was created.
- // But if we change someting on object to pay (amount or other), reusing same payment intent is not allowed.
- // Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay),
- // that's why i comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old that will not be used)
+ // But if we change someting on object to pay (amount or other that does not change the idempotency key), reusing same payment intent is not allowed.
+ // Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay), Stripe will
+ // automatically return the existing payment intent if idempotency is provided when we try to create the new one.
+ // That's why we can comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used)
/*
$sql = "SELECT pi.ext_payment_id, pi.entity, pi.fk_facture, pi.sourcetype, pi.ext_payment_site";
$sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi";
@@ -445,14 +447,15 @@ class Stripe extends CommonObject
global $stripearrayofkeysbyenv;
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']);
- // Note: If all data for payment intent are same than a previous on, even if we use 'create', Stripe will return ID of the old existing payment intent.
- if (empty($key)) { // If the Stripe connect account not set, we use common API usage
- $paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("idempotency_key" => "$description"));
- //$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array());
- } else {
- $paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("idempotency_key" => "$description", "stripe_account" => $key));
- //$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("stripe_account" => $key));
+ $arrayofoptions = array();
+ if (empty($noidempotency_key)) {
+ $arrayofoptions["idempotency_key"] = $description;
}
+ // Note: If all data for payment intent are same than a previous on, even if we use 'create', Stripe will return ID of the old existing payment intent.
+ if (! empty($key)) { // If the Stripe connect account not set, we use common API usage
+ $arrayofoptions["stripe_account"] = $key;
+ }
+ $paymentintent = \Stripe\PaymentIntent::create($dataforintent, $arrayofoptions);
// Store the payment intent
if (is_object($object))
diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php
index 0030bdb5535..84766f8e206 100644
--- a/htdocs/stripe/config.php
+++ b/htdocs/stripe/config.php
@@ -28,7 +28,7 @@
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/lib/Stripe.php';
-global $stripe;
+//global $stripe;
global $conf;
global $stripearrayofkeysbyenv;
@@ -55,4 +55,4 @@ else
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
\Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
-\Stripe\Stripe::setApiVersion("2019-05-16"); // force version API
+\Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION)?"2019-05-16":$conf->global->STRIPE_FORCE_VERSION); // force version API
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 28029def9ff..c3bbc92af9c 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -488,6 +488,9 @@ textarea.centpercent {
.backgroundblank {
background-color: #fff;
}
+.nobackground, .nobackground tr {
+ background: unset !important;
+}
.checkboxattachfilelabel {
font-size: 0.85em;
opacity: 0.7;
@@ -517,6 +520,8 @@ body[class*="colorblind-"] .text-success{
color: rgb() !important;
}
+.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
+.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
/* Themes for badges */
@@ -2529,6 +2534,9 @@ span.tabspan {
margin: 0px !important;
padding: 0px !important;
}
+.noborderspacing {
+ border-spacing: 0;
+}
tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd
{
border: 0px;
@@ -2753,6 +2761,7 @@ table.listwithfilterbefore {
.tagtable, .table-border { display: table; }
.tagtr, .table-border-row { display: table-row; }
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
+.confirmquestions .tagtr .tagtd:not(:first-child) { padding-left: 10px; }
/* Pagination */
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 04ae5d298c4..320a03c2775 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -691,6 +691,9 @@ textarea.centpercent {
.backgroundblank {
background-color: #fff;
}
+.nobackground, .nobackground tr {
+ background: unset !important;
+}
.checkboxattachfilelabel {
font-size: 0.85em;
opacity: 0.7;
@@ -720,6 +723,9 @@ body[class*="colorblind-"] .text-success{
color: rgb() !important;
}
+.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
+.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
+
/* Themes for badges */
@@ -2620,7 +2626,6 @@ span.tabspan {
margin-top: px;
}
-
.paddingrightonly {
border-collapse: collapse;
border: 0px;
@@ -2633,6 +2638,9 @@ span.tabspan {
margin: 0px !important;
padding: 0px !important;
}
+.noborderspacing {
+ border-spacing: 0;
+}
tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd
{
border: 0px;
@@ -2838,6 +2846,8 @@ table.listwithfilterbefore {
.tagtable, .table-border { display: table; }
.tagtr, .table-border-row { display: table-row; }
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
+.confirmquestions .tagtr .tagtd:not(:first-child) { padding-left: 10px; }
+
/* Pagination */
div.refidpadding {
diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php
index 4289fab99dc..c95b092cf2e 100644
--- a/htdocs/ticket/class/api_tickets.class.php
+++ b/htdocs/ticket/class/api_tickets.class.php
@@ -435,7 +435,7 @@ class Tickets extends DolibarrApi
throw new RestException(500);
}
- return array(
+ return array(
'success' => array(
'code' => 200,
'message' => 'Ticket deleted'
diff --git a/htdocs/ticket/css/styles.css.php b/htdocs/ticket/css/styles.css.php
index 1d0626d190b..906d50602a1 100644
--- a/htdocs/ticket/css/styles.css.php
+++ b/htdocs/ticket/css/styles.css.php
@@ -31,7 +31,7 @@ if (! defined('NOLOGIN')) define('NOLOGIN', 1); // File must be
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
-session_cache_limiter(false);
+session_cache_limiter('public');
require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index db919c9bf0a..6e7d2540d32 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -201,6 +201,12 @@ class User extends CommonObject
'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
);
+
+ const STATUS_DISABLED = 0;
+ const STATUS_ENABLED = 1;
+
+
+
/**
* Constructor of the class
*
@@ -2478,48 +2484,31 @@ class User extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un statut donne
+ * Return label of a status of user (active, inactive)
*
- * @param int $statut Id statut
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
- $langs->load('users');
- if ($mode == 0)
+ if (empty($this->labelstatus) || empty($this->labelstatusshort))
{
- if ($statut == 1) return $langs->trans('Enabled');
- elseif ($statut == 0) return $langs->trans('Disabled');
- }
- elseif ($mode == 1)
- {
- if ($statut == 1) return $langs->trans('Enabled');
- elseif ($statut == 0) return $langs->trans('Disabled');
- }
- elseif ($mode == 2)
- {
- if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
- elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
- }
- elseif ($mode == 3)
- {
- if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
- elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
- }
- elseif ($mode == 4)
- {
- if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
- elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
- }
- elseif ($mode == 5)
- {
- if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
- elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
+ global $langs;
+ //$langs->load("mymodule");
+ $this->labelstatus[self::STATUS_ENABLED] = $langs->trans('Enabled');
+ $this->labelstatus[self::STATUS_DISABLED] = $langs->trans('Disabled');
+ $this->labelstatusshort[self::STATUS_ENABLED] = $langs->trans('Enabled');
+ $this->labelstatusshort[self::STATUS_DISABLED] = $langs->trans('Disabled');
}
+
+ $statusType = 'status5';
+ if ($status == self::STATUS_ENABLED) $statusType = 'status4';
+
+ return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
}
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index 3b334871c06..668f05fa6c2 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -677,7 +677,7 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['u.statut']['checked']))
{
$userstatic->statut=$obj->statut;
- print ''.$userstatic->getLibStatut(3).' ';
+ print ''.$userstatic->getLibStatut(5).' ';
if (! $i) $totalarray['nbfield']++;
}
// Action column
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index bd54b93438f..ac99001bf4b 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -92,6 +92,17 @@ class Website extends CommonObject
*/
public $virtualhost;
+ /**
+ * List of containers
+ *
+ * @var array
+ */
+ public $lines;
+
+
+ const STATUS_DRAFT = 0;
+ const STATUS_VALIDATED = 1;
+
/**
* Constructor
@@ -229,10 +240,10 @@ class Website extends CommonObject
$sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
- if (null !== $ref) {
+ if (! empty($ref)) {
$sql .= " AND t.ref = '" . $this->db->escape($ref) . "'";
} else {
- $sql .= ' AND t.rowid = ' . $id;
+ $sql .= ' AND t.rowid = ' . (int) $id;
}
$resql = $this->db->query($sql);
@@ -691,8 +702,8 @@ class Website extends CommonObject
$companylink = '';
$label = '' . $langs->trans("WebSite") . ' ';
- $label.= '