';
/*
- * Last modified members
+ * Latest modified members
*/
$max=5;
@@ -342,7 +342,7 @@ if ($resql)
print '
';
print '';
$i++;
}
diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php
index fafa69b8b3f..99326241485 100644
--- a/htdocs/adherents/ldap.php
+++ b/htdocs/adherents/ldap.php
@@ -37,9 +37,9 @@ $action = GETPOST('action', 'aZ09');
// Protection
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$object = new Adherent($db);
diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php
index d954484c839..b2f302fea45 100644
--- a/htdocs/adherents/stats/byproperties.php
+++ b/htdocs/adherents/stats/byproperties.php
@@ -33,10 +33,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):'';
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php
index afc2e2b5218..3c469e658e5 100644
--- a/htdocs/adherents/stats/geo.php
+++ b/htdocs/adherents/stats/geo.php
@@ -34,10 +34,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):'';
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index 2f2c6f33920..d89a8a4a8c0 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -35,10 +35,10 @@ $userid=GETPOST('userid', 'int'); if ($userid < 0) $userid=0;
$socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0;
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php
index ac9a269bf29..5a4f84868e1 100644
--- a/htdocs/adherents/type_translation.php
+++ b/htdocs/adherents/type_translation.php
@@ -41,7 +41,7 @@ $cancel=GETPOST('cancel', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
// Security check
$result=restrictedArea($user, 'adherent', $id, 'adherent_type');
diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php
index 57031a9822f..a209a5f5590 100644
--- a/htdocs/admin/barcode.php
+++ b/htdocs/admin/barcode.php
@@ -208,7 +208,7 @@ print '
';
print "\n";
-$sql = "SELECT rowid, code as encoding, libelle, coder, example";
+$sql = "SELECT rowid, code as encoding, libelle as label, coder, example";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code";
@@ -225,7 +225,7 @@ if ($resql)
$obj = $db->fetch_object($resql);
print '
';
- print $obj->libelle;
+ print $obj->label;
print " \n";
print $langs->trans('BarcodeDesc'.$obj->encoding);
//print "L'EAN se compose de 8 caracteres, 7 chiffres plus une cle de controle. ";
diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php
index 26ea1b12a29..43f3fe0584a 100644
--- a/htdocs/admin/bom.php
+++ b/htdocs/admin/bom.php
@@ -183,16 +183,6 @@ elseif ($action == 'set_BOM_FREE_TEXT')
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
-} elseif ($action=="setshippableiconinlist") {
- // Activate Set Shippable Icon In List
- $setshippableiconinlist = GETPOST('value', 'int');
- $res = dolibarr_set_const($db, "SHIPPABLE_BOM_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
- if (! $res > 0) $error++;
- if (! $error) {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- } else {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
}
@@ -314,244 +304,217 @@ foreach ($dirmodels as $reldir)
print " \n";
-if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
+/*
+ * Document templates generators
+ */
+
+print load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
+
+// 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)
{
- /*
- * Document templates generators
- */
+ $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 load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
- // 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)
+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)
{
- $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);
- }
+ $dir = dol_buildpath($reldir."core/modules/bom".$valdir);
-
- 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)
+ if (is_dir($dir))
{
- $dir = dol_buildpath($reldir."core/modules/bom".$valdir);
-
- if (is_dir($dir))
+ $handle=opendir($dir);
+ if (is_resource($handle))
{
- $handle=opendir($dir);
- if (is_resource($handle))
+ while (($file = readdir($handle))!==false)
{
- 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))
{
- $filelist[]=$file;
- }
- closedir($handle);
- arsort($filelist);
+ if (file_exists($dir.'/'.$file))
+ {
+ $name = substr($file, 4, dol_strlen($file) -16);
+ $classname = substr($file, 0, dol_strlen($file) -12);
- 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);
- 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;
- $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 ' ';
- 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 " ";
+ }
- // 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->BOM_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 ' ';
- // Default
- print '';
- if ($conf->global->BOM_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("Logo").': '.yn($module->option_logo, 1, 1);
- $htmltooltip.=' '.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
- $htmltooltip.=' '.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
- $htmltooltip.=' '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
- //$htmltooltip.=' '.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
- //$htmltooltip.=' '.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
- $htmltooltip.=' '.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
+ // 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("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
- print '';
- print $form->textwithpicto('', $htmltooltip, 1, 0);
- print ' ';
+ 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 ' ';
+ // 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 "\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("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
- print ' ';
- print ' ';
- print ' ';
- print ' ';
- print " \n";
- print ' ';
-
- print '
';
- print ' ';
}
+print '
';
+print " ";
+
/*
- * Notifications
+ * Other options
*/
-/*
-print load_fiche_titre($langs->trans("Notifications"), '', '');
+
+print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '';
print '';
print ''.$langs->trans("Parameter").' ';
-print ' ';
-print ' ';
+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 '';
+print ' ';
+print ' ';
print '';
-print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").' ';
+print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
+$variablename='BOM_FREE_TEXT';
+if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
+{
+ print ''.$conf->global->$variablename.' ';
+}
+else
+{
+ include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+ $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
+ print $doleditor->Create();
+}
print ' ';
+print ' ';
print " \n";
+print ' ';
+
+//Use draft Watermark
+
+print "";
+print ' ';
+print " ";
+print '';
+print $form->textwithpicto($langs->trans("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
+print ' ';
+print ' ';
+print ' ';
+print ' ';
+print " \n";
+print ' ';
print '
';
-*/
+print ' ';
+
// End of page
llxFooter();
diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index daa0c896809..04accc01bbf 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -75,8 +75,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
@@ -260,7 +260,7 @@ if ($action == 'create') {
dol_fiche_head(array(), '');
- print ''."\n";
+ print ''."\n";
//unset($fields[]);
@@ -296,7 +296,7 @@ if (($id || $ref) && $action == 'edit')
dol_fiche_head();
- print '' . "\n";
+ print '' . "\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
@@ -448,7 +448,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '';
print '
';
print '
';
- print '
'."\n";
+ print ''."\n";
// Common attributes
//$keyforbreak='fieldkeytoswithonsecondcolumn';
diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index 09ba5f7224f..e8b2e280a7f 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -78,9 +78,9 @@ if (! $sortorder) $sortorder="ASC";
// Security check
$socid=0;
-if ($user->societe_id > 0) // Protection if external user
+if ($user->socid > 0) // Protection if external user
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'emailcollector', $id, '');
diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php
index 58f107dfdf5..eb432b0dc72 100644
--- a/htdocs/admin/mails_senderprofile_list.php
+++ b/htdocs/admin/mails_senderprofile_list.php
@@ -71,9 +71,9 @@ if (! $sortorder) $sortorder="ASC";
// Protection if external user
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
@@ -393,7 +393,7 @@ print ''."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
-foreach ($extrafields->attribute_computed as $key => $val)
+foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}
diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php
index c39cc385313..531e53ac459 100644
--- a/htdocs/admin/modulehelp.php
+++ b/htdocs/admin/modulehelp.php
@@ -129,7 +129,7 @@ foreach ($modulesdir as $dir)
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0;
// We discard modules according to property disabled
- if (! empty($objMod->hidden)) $modulequalified=0;
+ //if (! empty($objMod->hidden)) $modulequalified=0;
if ($modulequalified > 0)
{
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 '';
+print ' ';
+print ' ';
+print '';
+print $form->textwithpicto($langs->trans("FreeLegalTextOnMOs"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
+$variablename='MRP_MO_FREE_TEXT';
+if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
+{
+ print ''.$conf->global->$variablename.' ';
+}
+else
+{
+ include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+ $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
+ print $doleditor->Create();
+}
+print ' ';
+print ' ';
+print " \n";
+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/notification.php b/htdocs/admin/notification.php
index 6d1a5c57cf6..52de58b80b8 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -236,7 +236,7 @@ foreach($listofnotifiedevents as $notifiedevent)
$s=' '; // Do not use type="email" here, we must be able to enter a list of email with , separator.
$arrayemail=explode(',', $value);
$showwarning=0;
- foreach($arrayemail as $key=>$valuedet)
+ foreach($arrayemail as $keydet => $valuedet)
{
$valuedet=trim($valuedet);
if (! empty($valuedet) && ! isValidEmail($valuedet, 1)) $showwarning++;
diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php
index 9bbe81993c4..c0d08f4b505 100644
--- a/htdocs/admin/tools/listevents.php
+++ b/htdocs/admin/tools/listevents.php
@@ -35,10 +35,10 @@ $action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
// Load translation files required by the page
diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php
index 1fedf9e40de..06bed7a3f3a 100644
--- a/htdocs/admin/tools/listsessions.php
+++ b/htdocs/admin/tools/listsessions.php
@@ -35,10 +35,10 @@ $action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$sortfield = GETPOST("sortfield", 'alpha');
diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php
index 4d234e266e8..52ef490ceae 100644
--- a/htdocs/admin/translation.php
+++ b/htdocs/admin/translation.php
@@ -458,7 +458,7 @@ if ($mode == 'searchkey')
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
$title = $langs->trans("TranslationKeySearch");
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')';
- print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
+ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit);
print ' ';
print ' ';
@@ -466,7 +466,7 @@ if ($mode == 'searchkey')
print '';
print '
';
print '';
- print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder).'';
+ print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
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/api/class/api.class.php b/htdocs/api/class/api.class.php
index 074216dee3e..f4c9076fbd9 100644
--- a/htdocs/api/class/api.class.php
+++ b/htdocs/api/class/api.class.php
@@ -102,6 +102,7 @@ class DolibarrApi
unset($object->isextrafieldmanaged);
unset($object->ismultientitymanaged);
unset($object->restrictiononfksoc);
+ unset($object->table_rowid);
// Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses
unset($object->linkedObjects);
@@ -127,13 +128,14 @@ class DolibarrApi
unset($object->timespent_withhour);
unset($object->timespent_fk_user);
unset($object->timespent_note);
+ unset($object->fk_delivery_address);
unset($object->statuts);
unset($object->statuts_short);
unset($object->statuts_logo);
unset($object->statuts_long);
- unset($object->labelstatut);
- unset($object->labelstatut_short);
+ unset($object->labelStatus);
+ unset($object->labelStatusShort);
unset($object->element);
unset($object->fk_element);
@@ -146,6 +148,11 @@ class DolibarrApi
unset($object->skip_update_total);
unset($object->context);
+ unset($object->next_prev_filter);
+
+ if ($object->table_element != 'ticket') {
+ unset($object->comments);
+ }
// Remove the $oldcopy property because it is not supported by the JSON
// encoder. The following error is generated when trying to serialize
diff --git a/htdocs/api/index.php b/htdocs/api/index.php
index 2a734b9336d..7a9ef9ad24d 100644
--- a/htdocs/api/index.php
+++ b/htdocs/api/index.php
@@ -55,6 +55,12 @@ require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+$url = $_SERVER['PHP_SELF'];
+// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
+if (! empty($conf->global->MAIN_NGINX_FIX))
+{
+ $url = (isset($_SERVER['SCRIPT_URI']) && $_SERVER["SCRIPT_URI"] !== null) ? $_SERVER["SCRIPT_URI"] : $_SERVER['PHP_SELF'];
+}
// Enable and test if module Api is enabled
if (empty($conf->global->MAIN_MODULE_API))
@@ -67,7 +73,7 @@ if (empty($conf->global->MAIN_MODULE_API))
}
// Test if explorer is not disabled
-if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($conf->global->API_EXPLORER_DISABLED))
+if (preg_match('/api\/index\.php\/explorer/', $url) && ! empty($conf->global->API_EXPLORER_DISABLED))
{
$langs->load("admin");
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
@@ -91,7 +97,7 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
$reg=array();
-preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
+preg_match('/index\.php\/([^\/]+)(.*)$/', $url, $reg);
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index 7c2f1b42f32..7d49d253755 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -60,8 +60,8 @@ foreach($object->fields as $key => $val)
if (empty($action) && empty($id) && empty($ref)) $action='view';
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);
// Load object
diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php
index 04c195c08ff..0e34cd9b989 100644
--- a/htdocs/asset/class/asset.class.php
+++ b/htdocs/asset/class/asset.class.php
@@ -128,7 +128,13 @@ class Asset extends CommonObject
public $note_public;
public $note_private;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $tms;
/**
diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php
index d1fa8c1e04b..976b8974f5a 100644
--- a/htdocs/asset/document.php
+++ b/htdocs/asset/document.php
@@ -40,8 +40,8 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);
// Get parameters
diff --git a/htdocs/asset/info.php b/htdocs/asset/info.php
index f3758ebca8e..f3c385831a1 100644
--- a/htdocs/asset/info.php
+++ b/htdocs/asset/info.php
@@ -34,7 +34,7 @@ $ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'asset', $id, '');
$object = new Asset($db);
diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php
index bd2d19bbc87..8ea4f46c89d 100644
--- a/htdocs/asset/list.php
+++ b/htdocs/asset/list.php
@@ -72,9 +72,9 @@ if (! $sortorder) $sortorder="ASC";
// Protection if external user
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'asset', $id,'');
@@ -407,7 +407,7 @@ print ' '."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
-foreach ($extrafields->attribute_computed as $key => $val)
+foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}
diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php
index 0c03619d31c..dce1daaa3ca 100644
--- a/htdocs/asset/note.php
+++ b/htdocs/asset/note.php
@@ -46,8 +46,8 @@ $hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_module
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);
// Load object
diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index 906040a6bd9..4981c05afd7 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -100,7 +100,12 @@ class BlockedLog
*/
public $fk_user = 0;
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $date_modification;
public $date_object = 0;
diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php
index 87fb55a6541..c38d0a82a69 100644
--- a/htdocs/bom/bom_agenda.php
+++ b/htdocs/bom/bom_agenda.php
@@ -53,8 +53,8 @@ else
$search_agenda_label=GETPOST('search_agenda_label');
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 6186e809543..231679f7b3a 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -70,8 +70,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
@@ -662,14 +662,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' '; // ancre
// Documents
- /*$objref = dol_sanitizeFileName($object->ref);
- $relativepath = $comref . '/' . $comref . '.pdf';
+ $objref = dol_sanitizeFileName($object->ref);
+ $relativepath = $objref . '/' . $objref . '.pdf';
$filedir = $conf->bom->dir_output . '/' . $objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->bom->create; // If you can create/edit, you can remove a file on card
- print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
- */
+ $delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
+ print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
@@ -693,17 +692,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
//Select mail models is same action as presend
- /*
- if (GETPOST('modelselected')) $action = 'presend';
+ if (GETPOST('modelselected')) $action = 'presend';
- // Presend form
- $modelmail='inventory';
- $defaulttopic='InformationMessage';
- $diroutput = $conf->product->dir_output.'/inventory';
- $trackid = 'stockinv'.$object->id;
+ // Presend form
+ $modelmail='bom';
+ $defaulttopic='InformationMessage';
+ $diroutput = $conf->bom->dir_output;
+ $trackid = 'bom'.$object->id;
- include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
- */
+ include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
}
// End of page
diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php
index 826222af8b0..f0dac37a5a0 100644
--- a/htdocs/bom/bom_document.php
+++ b/htdocs/bom/bom_document.php
@@ -41,8 +41,8 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);
// Get parameters
diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php
index 6e192a06545..0775c2cc370 100644
--- a/htdocs/bom/bom_list.php
+++ b/htdocs/bom/bom_list.php
@@ -73,9 +73,9 @@ if (! $sortorder) $sortorder="ASC";
// Security check
$socid=0;
-if ($user->societe_id > 0) // Protection if external user
+if ($user->socid > 0) // Protection if external user
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'bom', $id, '');
diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php
index 481d8f1d799..e733b96d12b 100644
--- a/htdocs/bom/bom_note.php
+++ b/htdocs/bom/bom_note.php
@@ -47,8 +47,8 @@ $hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->h
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);
// Load object
diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php
index 471fb4f2cce..6b629fd2852 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'
@@ -281,12 +281,53 @@ class Boms extends DolibarrApi
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
- /*unset($object->note);
- unset($object->address);
+ unset($object->rowid);
+ unset($object->canvas);
+
+ unset($object->name);
+ unset($object->lastname);
+ unset($object->firstname);
+ unset($object->civility_id);
+ unset($object->statut);
+ unset($object->state);
+ unset($object->state_id);
+ unset($object->state_code);
+ unset($object->region);
+ unset($object->region_code);
+ unset($object->country);
+ unset($object->country_id);
+ unset($object->country_code);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
- unset($object->barcode_type_coder);*/
+ unset($object->barcode_type_coder);
+ unset($object->total_ht);
+ unset($object->total_tva);
+ unset($object->total_localtax1);
+ unset($object->total_localtax2);
+ unset($object->total_ttc);
+ unset($object->fk_account);
+ unset($object->comments);
+ unset($object->note);
+ unset($object->mode_reglement_id);
+ unset($object->cond_reglement_id);
+ unset($object->cond_reglement);
+ unset($object->shipping_method_id);
+ unset($object->fk_incoterms);
+ unset($object->label_incoterms);
+ unset($object->location_incoterms);
+
+ // If object has lines, remove $db property
+ if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
+ $nboflines = count($object->lines);
+ for ($i=0; $i < $nboflines; $i++)
+ {
+ $this->_cleanObjectDatas($object->lines[$i]);
+
+ unset($object->lines[$i]->lines);
+ unset($object->lines[$i]->note);
+ }
+ }
return $object;
}
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 444caa2a4da..4a623c3f36d 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -112,7 +112,13 @@ class BOM extends CommonObject
public $description;
public $note_public;
public $note_private;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $tms;
public $fk_user_creat;
public $fk_user_modif;
@@ -809,19 +815,19 @@ class BOM extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- if (empty($this->labelstatus))
+ if (empty($this->labelStatus))
{
global $langs;
//$langs->load("mrp");
- $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
- $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
- $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
+ $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
+ $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
}
$statusType = 'status'.$status;
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
- return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode);
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index d60b3251f0d..f184f1b433f 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -779,9 +779,9 @@ class Categorie extends CommonObject
$sql .= " AND c.fk_categorie = ".$this->id;
$sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid";
// Protection for external users
- if (($type == 'customer' || $type == 'supplier') && $user->societe_id > 0)
+ if (($type == 'customer' || $type == 'supplier') && $user->socid > 0)
{
- $sql.= " AND o.rowid = ".$user->societe_id;
+ $sql.= " AND o.rowid = ".$user->socid;
}
if ($limit > 0 || $offset > 0) $sql .= $this->db->plimit($limit + 1, $offset);
$sql .= $this->db->order($sortfield, $sortorder);
@@ -1018,11 +1018,11 @@ class Categorie extends CommonObject
* fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id
*
- * @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
+ * @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member', ...)
* @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
* $markafterid can be an :
* - int (id of category)
- * - string (categories ids seprated by comma)
+ * - string (categories ids separated by comma)
* - array (list of categories ids)
* @param int $include [=0] Removed or 1=Keep only
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php
index 6def65666a0..754b846576d 100644
--- a/htdocs/categories/photos.php
+++ b/htdocs/categories/photos.php
@@ -136,7 +136,7 @@ if ($object->id)
}
$morehtmlref.='';
- dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
/*
* Confirmation de la suppression de photo
diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php
index 3c9c7eb64e4..1c082dfe332 100644
--- a/htdocs/categories/traduction.php
+++ b/htdocs/categories/traduction.php
@@ -207,7 +207,7 @@ foreach ($ways as $way)
}
$morehtmlref.='';
-dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
print ' ';
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index fb246b5358b..45926847df4 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -226,7 +226,7 @@ foreach ($ways as $way)
}
$morehtmlref.='';
-dol_banner_tab($object, 'label', $linkback, ($user->societe_id?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
+dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
/*
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 15a6f820647..6b75f5b4a50 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -69,9 +69,9 @@ $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fullda
// Security check
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
-if ($user->societe_id && $socid) $result = restrictedArea($user, 'societe', $socid);
+if ($user->socid && $socid) $result = restrictedArea($user, 'societe', $socid);
$error=GETPOST("error");
$donotclearsession=GETPOST('donotclearsession')?GETPOST('donotclearsession'):0;
@@ -861,11 +861,11 @@ if ($action == 'create')
if (GETPOST('datep', 'int', 1)) $datep=dol_stringtotime(GETPOST('datep', 'int', 1), 0);
print ''.$langs->trans("DateActionStart").' ';
if (GETPOST("afaire") == 1) {
- print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldayend');
+ print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldayend');
} elseif (GETPOST("afaire") == 2) {
- print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
+ print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
} else {
- print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart');
+ print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart');
}
print ' ';
@@ -1024,8 +1024,8 @@ if ($action == 'create')
$events=array();
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
//For external user force the company to user company
- if (!empty($user->societe_id)) {
- print $form->select_company($user->societe_id, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300');
+ if (!empty($user->socid)) {
+ print $form->select_company($user->socid, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300');
} else {
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300');
}
@@ -1612,7 +1612,7 @@ if ($id > 0)
$morehtmlref.='';
- dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
+ dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref);
print '';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 8432ba786a1..a07e4ceba1a 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -45,43 +45,67 @@ class ActionComm extends CommonObject
*/
public $table_element = 'actioncomm';
+ /**
+ * @var string Name of id column
+ */
public $table_rowid = 'id';
/**
- * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ * @var string Name of icon for actioncomm object. Filename of icon is object_action.png
*/
public $picto = 'action';
/**
- * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
- * @var int
+ * @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 1;
/**
- * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user, 2=Same than 1 but accept record if fksoc is empty
- * @var integer
+ * @var integer 0=Default
+ * 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
+ * 2=Same than 1 but accept record if fksoc is empty
*/
public $restrictiononfksoc = 2;
/**
- * Id of the event
- * @var int
+ * @var int Id of the event
*/
public $id;
/**
- * Id of the event. Use $id as possible
- * @var int
+ * @var int Id of the event. Use $id as possible
*/
public $ref;
- public $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set)
- public $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
+ /**
+ * @var int Id into parent table llx_c_actioncomm (used only if option to use type is set)
+ */
+ public $type_id;
+
+ /**
+ * @var string Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
+ */
+ public $type_code;
+
+ /**
+ * @var string Type label
+ */
public $type_label;
- public $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set)
- public $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set)
- public $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
+
+ /**
+ * @var string Label into parent table llx_c_actioncomm (used only if option to use type is set)
+ */
+ public $type;
+
+ /**
+ * @var string Color into parent table llx_c_actioncomm (used only if option to use type is set)
+ */
+ public $type_color;
+
+ /**
+ * @var string Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
+ */
+ public $code;
/**
* @var string Agenda event label
@@ -89,72 +113,56 @@ class ActionComm extends CommonObject
public $label;
/**
- * Date creation record (datec)
- *
- * @var integer
+ * @var integer Date creation record (datec)
*/
public $datec;
/**
- * Date end record (datef)
- *
- * @var integer
+ * @var integer Date end record (datef)
*/
public $datef;
/**
- * Duration (duree)
- *
- * @var integer
+ * @var integer Duration (duree)
*/
public $duree;
/**
- * Date modification record (tms)
- *
- * @var integer
+ * @var integer Date modification record (tms)
*/
public $datem;
/**
- * Object user that create action
- * @var User
+ * @var User Object user that create action
* @deprecated
* @see $authorid
*/
public $author;
/**
- * Object user that modified action
- * @var User
+ * @var User Object user that modified action
* @deprecated
* @see $usermodid
*/
public $usermod;
/**
- * Id user that create action
- * @var int
+ * @var int Id user that create action
*/
public $authorid;
/**
- * Id user that modified action
- * @var int
+ * @var int Id user that modified action
*/
public $usermodid;
/**
- * Date action start (datep)
- *
- * @var integer
+ * @var integer Date action start (datep)
*/
public $datep;
/**
- * Date action end (datep2)
- *
- * @var integer
+ * @var integer Date action end (datep2)
*/
public $datep2;
@@ -163,90 +171,178 @@ class ActionComm extends CommonObject
* @deprecated
*/
public $durationp = -1;
- public $fulldayevent = 0; // 1=Event on full day
/**
- * Milestone
- * @var int
+ * @var int 1=Event on full day
+ */
+ public $fulldayevent = 0;
+
+ /**
+ * @var int Milestone
* @deprecated Milestone is already event with end date = start date
*/
public $punctual = 1;
- public $percentage; // Percentage
- public $location; // Location
- public $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
- public $priority; // Small int (0 By default)
+ /**
+ * @var integer Percentage
+ */
+ public $percentage;
- public $userassigned = array(); // Array of user ids
- public $userownerid; // Id of user owner = fk_user_action into table
- public $userdoneid; // Id of user done (deprecated)
+ /**
+ * @var string Location
+ */
+ public $location;
- public $socpeopleassigned = array(); // Array of contact ids
+ /**
+ * @var int Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
+ */
+ public $transparency;
- public $otherassigned = array(); // Array of other contact emails (not user, not contact)
+ /**
+ * @var int (0 By default)
+ */
+ public $priority;
+
+ /**
+ * @var int[] Array of user ids
+ */
+ public $userassigned = array();
+
+ /**
+ * @var int Id of user owner = fk_user_action into table
+ */
+ public $userownerid;
+
+ /**
+ * @var int Id of user done (deprecated)
+ * @deprecated
+ */
+ public $userdoneid;
+
+ /**
+ * @var int[] Array of contact ids
+ */
+ public $socpeopleassigned = array();
+
+ /**
+ * @var int[] Array of other contact emails (not user, not contact)
+ */
+ public $otherassigned = array();
- /**
- * Object user of owner
- * @var User
+ /**
+ * @var User Object user of owner
* @deprecated
* @see userownerid
*/
public $usertodo;
/**
- * Object user that did action
- * @var User
+ * @var User Object user that did action
* @deprecated
* @see userdoneid
*/
public $userdone;
+ /**
+ * @var int thirdparty id linked to action
+ */
public $socid;
+
+ /**
+ * @var int socpeople id linked to action
+ */
public $contactid;
/**
- * Company linked to action (optional)
- * @var Societe|null
+ * @var Societe|null Company linked to action (optional)
* @deprecated
* @see socid
*/
public $societe;
/**
- * Contact linked to action (optional)
- * @var Contact|null
+ * @var Contact|null Contact linked to action (optional)
* @deprecated
* @see contactid
*/
public $contact;
// Properties for links to other objects
+ /**
+ * @var int Id of linked object
+ */
public $fk_element; // Id of record
- public $elementid; // Id of record alternative for API
- public $elementtype; // Type of record. This if property ->element of object linked to.
- // Ical
+ /**
+ * @var int Id of record alternative for API
+ */
+ public $elementid;
+
+ /**
+ * @var string Type of record. This if property ->element of object linked to.
+ */
+ public $elementtype;
+
+ /**
+ * @var string Ical name
+ */
public $icalname;
+
+ /**
+ * @var string Ical color
+ */
public $icalcolor;
+ /**
+ * @var array Actions
+ */
public $actions=array();
- // Fields for emails
+ /**
+ * @var string Email msgid
+ */
public $email_msgid;
+
+ /**
+ * @var string Email from
+ */
public $email_from;
+
+ /**
+ * @var string Email sender
+ */
public $email_sender;
+
+ /**
+ * @var string Email to
+ */
public $email_to;
+
+ /**
+ * @var string Email tocc
+ */
public $email_tocc;
+ /**
+ * @var string Email tobcc
+ */
public $email_tobcc;
+
+ /**
+ * @var string Email subject
+ */
public $email_subject;
+
+ /**
+ * @var string Email errors to
+ */
public $errors_to;
/**
* Constructor
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
@@ -1067,13 +1163,13 @@ class ActionComm extends CommonObject
$sql = "SELECT count(a.id) as nb";
}
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
- if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
+ if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql.= " WHERE 1 = 1";
if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100";
$sql.= " AND a.entity IN (".getEntity('agenda').")";
- if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
- if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
+ if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
+ if ($user->socid) $sql.=" AND a.fk_soc = ".$user->socid;
if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
$resql=$this->db->query($sql);
@@ -1344,7 +1440,6 @@ class ActionComm extends CommonObject
$linkstart = '';
$linkend = '';
}
- //print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto;
if ($withpicto == 2)
{
@@ -1463,7 +1558,7 @@ class ActionComm extends CommonObject
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
$sql.= " u.firstname, u.lastname, u.email,";
$sql.= " s.nom as socname,";
- $sql.= " c.id as type_id, c.code as type_code, c.libelle";
+ $sql.= " c.id as type_id, c.code as type_code, c.libelle as type_label";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
@@ -1568,7 +1663,7 @@ class ActionComm extends CommonObject
$event['location']=$obj->location;
$event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy)
$event['punctual']=$obj->punctual;
- $event['category']=$obj->libelle; // libelle type action
+ $event['category']=$obj->type_label;
$event['email']=$obj->email;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
@@ -1579,6 +1674,22 @@ class ActionComm extends CommonObject
$event['created']=$this->db->jdate($obj->datec)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
$event['modified']=$this->db->jdate($obj->datem)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
+ // TODO: find a way to call "$this->fetch_userassigned();" without override "$this" properties
+ $this->id = $obj->id;
+ $this->fetch_userassigned();
+
+ $assignedUserArray = array();
+
+ foreach($this->userassigned as $key => $value)
+ {
+ $assignedUser = new User($this->db);
+ $assignedUser->fetch($value['id']);
+
+ $assignedUserArray[$key]=$assignedUser;
+ }
+
+ $event['assignedUsers']=$assignedUserArray;
+
if ($qualified && $datestart)
{
$eventarray[]=$event;
diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php
index 652e0d80966..f3fa2cd47c1 100644
--- a/htdocs/comm/action/class/api_agendaevents.class.php
+++ b/htdocs/comm/action/class/api_agendaevents.class.php
@@ -338,6 +338,7 @@ class AgendaEvents extends DolibarrApi
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
+ unset($object->note); // alreaydy into note_private
unset($object->usermod);
unset($object->libelle);
unset($object->context);
@@ -350,6 +351,11 @@ class AgendaEvents extends DolibarrApi
unset($object->origin_id);
unset($object->ref_ext);
unset($object->statut);
+ unset($object->state_code);
+ unset($object->state_id);
+ unset($object->state);
+ unset($object->region);
+ unset($object->region_code);
unset($object->country);
unset($object->country_id);
unset($object->country_code);
@@ -378,6 +384,9 @@ class AgendaEvents extends DolibarrApi
unset($object->contact);
unset($object->societe);
+ unset($object->actions);
+ unset($object->lines);
+
return $object;
}
}
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 6f0875be879..f01f49921e7 100644
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -45,8 +45,8 @@ $confirm = GETPOST('confirm', 'alpha');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
-if ($user->societe_id > 0)
+if ($user->socid) $socid=$user->socid;
+if ($user->socid > 0)
{
unset($_GET["action"]);
$action='';
@@ -159,7 +159,7 @@ if ($object->id > 0)
}
$morehtmlref.='
';
- dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
+ dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref);
print '';
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 9ad3ef80dde..031918b194b 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -67,7 +67,7 @@ if (! $sortfield) $sortfield="a.datec";
// Security check
$socid = GETPOST("search_socid", "int")?GETPOST("search_socid", "int"):GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
@@ -614,7 +614,7 @@ if ($resql)
$event->type_label=$obj->type_label;
$event->type_color=$obj->type_color;
- $event->libelle=$obj->label;
+ $event->libelle=$obj->label; // deprecated
$event->label=$obj->label;
$event->percentage=$obj->percent;
$event->authorid=$obj->fk_user_author; // user id of creator
@@ -720,7 +720,7 @@ if ($showbirthday)
$event->datep=dol_mktime(0, 0, 0, $datearray['mon'], $datearray['mday'], $year, true); // For full day events, date are also GMT but they wont but converted during output
$event->datef=$event->datep;
$event->type_code='BIRTHDAY';
- $event->libelle=$langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname, $obj->lastname);
+ $event->label=$langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname, $obj->lastname);
$event->percentage=100;
$event->fulldayevent=1;
@@ -949,9 +949,9 @@ if (count($listofextcals))
$event->datef=$dateend+$usertime;
$event->type_code="ICALEVENT";
- if($icalevent['SUMMARY']) $event->libelle=$icalevent['SUMMARY'];
- elseif($icalevent['DESCRIPTION']) $event->libelle=dol_nl2br($icalevent['DESCRIPTION'], 1);
- else $event->libelle = $langs->trans("ExtSiteNoLabel");
+ if($icalevent['SUMMARY']) $event->label=$icalevent['SUMMARY'];
+ elseif($icalevent['DESCRIPTION']) $event->label=dol_nl2br($icalevent['DESCRIPTION'], 1);
+ else $event->label = $langs->trans("ExtSiteNoLabel");
$event->date_start_in_calendar=$event->datep;
@@ -1554,7 +1554,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
// Show title
$titletoshow = $daterange;
- $titletoshow.=($titletoshow?' ':'').$event->libelle;
+ $titletoshow.=($titletoshow?' ':'').($event->label?$event->label:$event->libelle);
if ($event->type_code == 'ICALEVENT') print $titletoshow;
else
@@ -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/comm/action/info.php b/htdocs/comm/action/info.php
index 02277fc30e8..a88ff67fd91 100644
--- a/htdocs/comm/action/info.php
+++ b/htdocs/comm/action/info.php
@@ -39,10 +39,10 @@ $langs->load("commercial");
$id = GETPOST('id', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
@@ -102,7 +102,7 @@ if (! empty($conf->projet->enabled))
}
$morehtmlref.='
';
-dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
+dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref);
print '
';
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 1b33e5da9b8..65852d053b4 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -110,7 +110,7 @@ if (! $sortfield)
// Security check
$socid = GETPOST("search_socid", 'int')?GETPOST("search_socid", 'int'):GETPOST("socid", 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
@@ -488,7 +488,7 @@ if ($resql)
if (! empty($arrayfields['a.tms']['checked'])) print ' ';
if (! empty($arrayfields['a.percent']['checked'])) {
print '';
- print $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2);
+ $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2);
print ajax_combobox('selectstatus');
print ' ';
}
diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php
index 286863c7dc6..134e239b66f 100644
--- a/htdocs/comm/action/pertype.php
+++ b/htdocs/comm/action/pertype.php
@@ -65,7 +65,7 @@ if (! $sortfield) $sortfield="a.datec";
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
@@ -616,12 +616,12 @@ $typeofevents=array();
// Load array of colors by type
$colorsbytype=array();
$labelbytype=array();
-$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm";
+$sql="SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX."c_actioncomm ORDER BY position";
$resql=$db->query($sql);
while ($obj = $db->fetch_object($resql))
{
$colorsbytype[$obj->code]=$obj->color;
- $labelbytype[$obj->code]=$obj->libelle;
+ $labelbytype[$obj->code]=$obj->label;
}
// Loop on each user to show calendar
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index ce577de78bd..3280ddc7af4 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -65,7 +65,7 @@ if (! $sortfield) $sortfield="a.datec";
// Security check
$socid = GETPOST("search_socid", "int")?GETPOST("search_socid", "int"):GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
@@ -752,12 +752,12 @@ while($currentdaytoshow<$lastdaytoshow) {
// Load array of colors by type
$colorsbytype=array();
$labelbytype=array();
- $sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm ORDER BY position";
+ $sql="SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX."c_actioncomm ORDER BY position";
$resql=$db->query($sql);
while ($obj = $db->fetch_object($resql))
{
$colorsbytype[$obj->code]=$obj->color;
- $labelbytype[$obj->code]=$obj->libelle;
+ $labelbytype[$obj->code]=$obj->label;
}
// Loop on each user to show calendar
diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php
index 8cc1774cba2..c6549c5c39a 100644
--- a/htdocs/comm/action/rapport/index.php
+++ b/htdocs/comm/action/rapport/index.php
@@ -49,7 +49,7 @@ if (! $sortfield) $sortfield="a.datep";
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', $socid, '', 'myactions');
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 57239c355b4..a0263065dee 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -59,7 +59,7 @@ if (! empty($conf->notification->enabled)) $langs->load("mails");
// Security check
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
-if ($user->societe_id > 0) $id=$user->societe_id;
+if ($user->socid > 0) $id=$user->socid;
$result = restrictedArea($user, 'societe', $id, '&societe');
$action = GETPOST('action', 'aZ09');
@@ -240,7 +240,7 @@ if ($object->id > 0)
$linkback = ''.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '';
@@ -387,7 +387,7 @@ if ($object->id > 0)
print '
';
print $langs->trans("CustomerRelativeDiscountShort");
print ' ';
- if ($user->rights->societe->creer && !$user->societe_id > 0)
+ if ($user->rights->societe->creer && !$user->socid > 0)
{
print ''.img_edit($langs->trans("Modify")).' ';
}
@@ -401,7 +401,7 @@ if ($object->id > 0)
print ' ';
print $langs->trans("CustomerAbsoluteDiscountShort");
print ' ';
- if ($user->rights->societe->creer && !$user->societe_id > 0)
+ if ($user->rights->societe->creer && !$user->socid > 0)
{
print 'id).'">'.img_edit($langs->trans("Modify")).' ';
}
@@ -1274,7 +1274,7 @@ if ($object->id > 0)
}
// Add invoice
- if ($user->societe_id == 0)
+ if ($user->socid == 0)
{
if (! empty($conf->deplacement->enabled) && $object->status==1)
{
diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php
index 10314b597e7..6c0aea2f935 100644
--- a/htdocs/comm/contact.php
+++ b/htdocs/comm/contact.php
@@ -47,7 +47,7 @@ $begin=GETPOST('begin', 'alpha');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $socid, '');
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 43af4f8f1c0..245d3874d92 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -51,10 +51,10 @@ $bid=GETPOST('bid', 'int');
// Securite acces client
$socid=GETPOST('socid', 'int');
-if (isset($user->societe_id) && $user->societe_id > 0)
+if (isset($user->socid) && $user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$max=3;
@@ -120,6 +120,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
print '';
print ' ';
+ print '';
print '
';
$i=0;
foreach($listofsearchfields as $key => $value)
@@ -132,6 +133,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
$i++;
}
print '
';
+ print '
';
print ' ';
print ' ';
}
@@ -559,10 +561,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm";
$sql.= ", s.code_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fournisseur = 1";
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
- if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY s.datec DESC";
$sql.= $db->plimit($max, 0);
diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php
index 1049431b7f2..d9fbd9a37b2 100644
--- a/htdocs/comm/mailing/advtargetemailing.php
+++ b/htdocs/comm/mailing/advtargetemailing.php
@@ -41,7 +41,7 @@ if (! empty($conf->categorie->enabled)) {
}
// Security check
-if (! $user->rights->mailing->lire || $user->societe_id > 0)
+if (! $user->rights->mailing->lire || $user->socid > 0)
accessforbidden();
// Load variable for pagination
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index c16d7237439..714a84fe95a 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->load("mails");
-if (! $user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->societe_id > 0)) accessforbidden();
+if (! $user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) accessforbidden();
$id=(GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int'));
$action=GETPOST('action', 'alpha');
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 998f4a6c202..819e0acf562 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("mails");
// Security check
-if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden();
+if (! $user->rights->mailing->lire || $user->socid > 0) accessforbidden();
// Load variable for pagination
@@ -479,14 +479,13 @@ if ($object->fetch($id) >= 0)
{
$num = $db->num_rows($resql);
- $param = "&id=".$object->id;
+ $param = "&id=".$object->id;
//if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname);
if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname);
if ($search_email) $param.= "&search_email=".urlencode($search_email);
if ($search_other) $param.= "&search_other=".urlencode($search_other);
- if ($page) $param.= "&page=".urlencode($page);
print '';
print ' ';
@@ -500,6 +499,7 @@ if ($object->fetch($id) >= 0)
$morehtmlcenter=''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition">'.$langs->trans("TargetsReset").' ';
}
$morehtmlcenter.=' id.'">'.$langs->trans("Download").' ';
+
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
print ' ';
@@ -560,6 +560,8 @@ if ($object->fetch($id) >= 0)
print ' ';
print ' ';
+ if ($page) $param.= "&page=".urlencode($page);
+
print '';
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder);
diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php
index 41f74846125..32637096910 100644
--- a/htdocs/comm/mailing/class/mailing.class.php
+++ b/htdocs/comm/mailing/class/mailing.class.php
@@ -67,7 +67,12 @@ class Mailing extends CommonObject
public $user_creat;
public $user_valid;
+ /**
+ * @var integer|string date_creation
+ */
public $date_creat;
+
+
public $date_valid;
public $extraparams=array();
@@ -618,48 +623,24 @@ class Mailing extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @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 Label
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
- $langs->load('mails');
+ $langs->load("mailing");
- if ($mode == 0 || $mode == 1)
- {
- return $langs->trans($this->statuts[$statut]);
- }
- elseif ($mode == 2)
- {
- if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
- }
- elseif ($mode == 3)
- {
- if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
- elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
- elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3');
- elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
- }
- elseif ($mode == 4)
- {
- if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
- }
- elseif ($mode == 5)
- {
- if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
- elseif ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
- elseif ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3');
- elseif ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
- }
+ $labelStatus = $langs->trans($this->statuts[$status]);
+ $labelStatusShort = $langs->trans($this->statuts[$status]);
+
+ $statusType = 'status'.$status;
+ if ($status == 2) $statusType = 'status3';
+ if ($status == 3) $statusType = 'status6';
+
+ return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}
@@ -667,58 +648,37 @@ class Mailing extends CommonObject
* Renvoi le libelle d'un statut donne
* TODO Add class mailin_target.class.php
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param string $desc Desc error
* @return string Label
*/
- public static function libStatutDest($statut, $mode = 0, $desc = '')
+ public static function libStatutDest($status, $mode = 0, $desc = '')
{
global $langs;
- $langs->load('mails');
+ $langs->load("mails");
- if ($mode == 0)
- {
- return $langs->trans('MailingStatusError');
- }
- elseif ($mode == 1)
- {
- return $langs->trans('MailingStatusSent');
- }
- elseif ($mode == 2)
- {
- if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
- elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
- elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
- elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
- }
- elseif ($mode == 3)
- {
- if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
- elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
- elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
- elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
- }
- elseif ($mode == 4)
- {
- if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
- elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
- elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
- elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
- }
- elseif ($mode == 5)
- {
- if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
- elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
- elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
- elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
- }
- elseif ($mode == 6)
- {
- if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
- elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
- elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
- elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
+ $labelStatus = array();
+ $labelStatusShort = array();
+
+ $labelStatus[-1] = $langs->trans('MailingStatusError');
+ $labelStatus[1] = $langs->trans('MailingStatusSent');
+ $labelStatus[2] = $langs->trans('MailingStatusRead');
+ $labelStatus[3] = $langs->trans('MailingStatusNotContact');
+ $labelStatusShort[-1] = $langs->trans('MailingStatusError');
+ $labelStatusShort[1] = $langs->trans('MailingStatusSent');
+ $labelStatusShort[2] = $langs->trans('MailingStatusRead');
+ $labelStatusShort[3] = $langs->trans('MailingStatusNotContact');
+
+ $statusType = 'status'.$status;
+ if ($status == -1) $statusType = 'status8';
+ if ($status == 1) $statusType = 'status6';
+ if ($status == 2) $statusType = 'status4';
+
+ $param = array();
+ if ($status == - 1) {
+ $param = array('badgeParams'=>array('attr'=>array('title'=>$desc)));
}
+ return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode, '', $param);
}
}
diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php
index e5d096dea26..701dd2d4716 100644
--- a/htdocs/comm/mailing/index.php
+++ b/htdocs/comm/mailing/index.php
@@ -60,6 +60,7 @@ print '';
// Recherche emails
print '
';
print ' ';
+ print '';
print '
';
print ''.$langs->trans("SearchAMailing").' ';
print '';
@@ -68,7 +69,7 @@ print '
\n";
+ print "
\n";
//}
@@ -160,6 +161,7 @@ $sql.= " ORDER BY m.date_creat DESC";
$sql.= " LIMIT ".$limit;
$result=$db->query($sql);
if ($result) {
+ print '
';
print '
';
print '';
print ''.$langs->trans("LastMailings", $limit).' ';
@@ -193,7 +195,7 @@ if ($result) {
{
print ' '.$langs->trans("None").' ';
}
- print "
";
+ print "
";
$db->free($result);
}
else
diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php
index 7b270e460c8..c0b01050d8f 100644
--- a/htdocs/comm/mailing/info.php
+++ b/htdocs/comm/mailing/info.php
@@ -33,7 +33,7 @@ $id=GETPOST('id');
$langs->load("mails");
// Security check
-if (! $user->rights->mailing->lire || $user->societe_id > 0)
+if (! $user->rights->mailing->lire || $user->socid > 0)
accessforbidden();
@@ -57,7 +57,16 @@ if ($object->fetch($id) >= 0)
$linkback = ''.$langs->trans("BackToList").' ';
$morehtmlright='';
- if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
+ $nbtry = $nbok = 0;
+ if ($object->statut == 2 || $object->statut == 3)
+ {
+ $nbtry = $object->countNbOfTargets('alreadysent');
+ $nbko = $object->countNbOfTargets('alreadysentko');
+
+ $morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
+ if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
+ $morehtmlright.=') ';
+ }
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php
index 429e7f3dacf..c99048a8955 100644
--- a/htdocs/comm/multiprix.php
+++ b/htdocs/comm/multiprix.php
@@ -33,9 +33,9 @@ $langs->loadLangs(array('orders', 'companies'));
$id = GETPOST('id', 'int');
$_socid = GETPOST("id", 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $_socid = $user->societe_id;
+ $_socid = $user->socid;
}
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 113d3baf503..8f28a65473c 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -86,7 +86,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co
$NBLINES = 4;
// Security check
-if (! empty($user->societe_id)) $socid = $user->societe_id;
+if (! empty($user->socid)) $socid = $user->socid;
$result = restrictedArea($user, 'propal', $id);
$object = new Propal($db);
@@ -1717,7 +1717,7 @@ if ($action == 'create')
print $doleditor->Create(1);
// Private note
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print '';
print '' . $langs->trans('NotePrivate') . ' ';
@@ -2202,11 +2202,11 @@ if ($action == 'create')
print '';
print '';
- if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmulticurrencycode' && $usercancreate) {
+ if ($object->statut == $object::STATUS_DRAFT && $action == 'editmulticurrencycode' && $usercancreate) {
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
} else {
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
@@ -2214,29 +2214,33 @@ if ($action == 'create')
print ' ';
// Multicurrency rate
- print '';
- print '';
- print '';
- print ' ';
- if ($object->statut == Propal::STATUS_DRAFT && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) {
- if($action == 'actualizemulticurrencyrate') {
- list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
- }
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
- } else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '';
+ if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
+ {
+ print ' ';
+ print '';
+ print '';
+ print ' ';
+ if ($object->statut ==$object::STATUS_DRAFT && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) {
+ if($action == 'actualizemulticurrencyrate') {
+ list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
+ }
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ print '';
+ }
}
+ print ' ';
}
- print '';
}
if ($soc->outstanding_limit)
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index a2b89dedb11..0df1af873a8 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -13,7 +13,7 @@
* Copyright (C) 2013 Florian Henry
* Copyright (C) 2014-2015 Marcos García
* Copyright (C) 2018 Nicolas ZABOURI
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2019 Frédéric France
* Copyright (C) 2018 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
@@ -95,8 +95,17 @@ class Propal extends CommonObject
*/
public $socid;
+ /**
+ * ID of the contact
+ * @var int
+ */
public $contactid;
public $author;
+
+ /**
+ * Ref from thirdparty
+ * @var string
+ */
public $ref_client;
/**
@@ -192,8 +201,8 @@ class Propal extends CommonObject
public $lines = array();
public $line;
- public $labelstatut=array();
- public $labelstatut_short=array();
+ public $labelStatus=array();
+ public $labelStatusShort=array();
public $specimen;
@@ -240,7 +249,7 @@ class Propal extends CommonObject
* @param int $socid Id third party
* @param int $propalid Id proposal
*/
- public function __construct($db, $socid = "", $propalid = 0)
+ public function __construct($db, $socid = 0, $propalid = 0)
{
global $conf,$langs;
@@ -1686,13 +1695,13 @@ class Propal extends CommonObject
$line->fk_product = $objp->fk_product;
- $line->ref = $objp->product_ref; // TODO deprecated
+ $line->ref = $objp->product_ref; // deprecated
$line->product_ref = $objp->product_ref;
- $line->libelle = $objp->product_label; // TODO deprecated
+ $line->libelle = $objp->product_label; // deprecated
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; // Description produit
$line->product_tobatch = $objp->product_tobatch;
- $line->fk_product_type = $objp->fk_product_type; // TODO deprecated
+ $line->fk_product_type = $objp->fk_product_type; // deprecated
$line->fk_unit = $objp->fk_unit;
$line->weight = $objp->weight;
$line->weight_units = $objp->weight_units;
@@ -3200,40 +3209,40 @@ class Propal extends CommonObject
/**
* Return label of a status (draft, validated, ...)
*
- * @param int $statut id statut
+ * @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
*/
- public function LibStatut($statut, $mode = 1)
+ public function LibStatut($status, $mode = 1)
{
// phpcs:enable
global $conf;
// Init/load array of translation of status
- if (empty($this->labelstatut) || empty($this->labelstatut_short))
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
$langs->load("propal");
- $this->labelstatut[0]=$langs->trans("PropalStatusDraft");
- $this->labelstatut[1]=$langs->trans("PropalStatusValidated");
- $this->labelstatut[2]=$langs->trans("PropalStatusSigned");
- $this->labelstatut[3]=$langs->trans("PropalStatusNotSigned");
- $this->labelstatut[4]=$langs->trans("PropalStatusBilled");
- $this->labelstatut_short[0]=$langs->trans("PropalStatusDraftShort");
- $this->labelstatut_short[1]=$langs->trans("PropalStatusValidatedShort");
- $this->labelstatut_short[2]=$langs->trans("PropalStatusSignedShort");
- $this->labelstatut_short[3]=$langs->trans("PropalStatusNotSignedShort");
- $this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort");
+ $this->labelStatus[0]=$langs->trans("PropalStatusDraft");
+ $this->labelStatus[1]=$langs->trans("PropalStatusValidated");
+ $this->labelStatus[2]=$langs->trans("PropalStatusSigned");
+ $this->labelStatus[3]=$langs->trans("PropalStatusNotSigned");
+ $this->labelStatus[4]=$langs->trans("PropalStatusBilled");
+ $this->labelStatusShort[0]=$langs->trans("PropalStatusDraftShort");
+ $this->labelStatusShort[1]=$langs->trans("PropalStatusValidatedShort");
+ $this->labelStatusShort[2]=$langs->trans("PropalStatusSignedShort");
+ $this->labelStatusShort[3]=$langs->trans("PropalStatusNotSignedShort");
+ $this->labelStatusShort[4]=$langs->trans("PropalStatusBilledShort");
}
$statusType='';
- if ($statut==self::STATUS_DRAFT) $statusType='status0';
- elseif ($statut==self::STATUS_VALIDATED) $statusType='status1';
- elseif ($statut==self::STATUS_SIGNED) $statusType='status3';
- elseif ($statut==self::STATUS_NOTSIGNED) $statusType='status5';
- elseif ($statut==self::STATUS_BILLED) $statusType='status6';
+ if ($status==self::STATUS_DRAFT) $statusType='status0';
+ elseif ($status==self::STATUS_VALIDATED) $statusType='status1';
+ elseif ($status==self::STATUS_SIGNED) $statusType='status3';
+ elseif ($status==self::STATUS_NOTSIGNED) $statusType='status5';
+ elseif ($status==self::STATUS_BILLED) $statusType='status6';
- return dolGetStatus($this->labelstatut[$statut], $this->labelstatut_short[$statut], '', $statusType, $mode);
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
@@ -3254,7 +3263,7 @@ class Propal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin, p.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@@ -3263,7 +3272,7 @@ class Propal extends CommonObject
$sql.= $clause." p.entity IN (".getEntity('propal').")";
if ($mode == 'opened') $sql.= " AND p.fk_statut = ".self::STATUS_VALIDATED;
if ($mode == 'signed') $sql.= " AND p.fk_statut = ".self::STATUS_SIGNED;
- if ($user->societe_id) $sql.= " AND p.fk_soc = ".$user->societe_id;
+ if ($user->socid) $sql.= " AND p.fk_soc = ".$user->socid;
$resql=$this->db->query($sql);
if ($resql)
@@ -3272,17 +3281,17 @@ class Propal extends CommonObject
$now=dol_now();
$delay_warning = 0;
- $statut = 0;
+ $status = 0;
$label = $labelShort = '';
if ($mode == 'opened') {
$delay_warning=$conf->propal->cloture->warning_delay;
- $statut = self::STATUS_VALIDATED;
+ $status = self::STATUS_VALIDATED;
$label = $langs->trans("PropalsToClose");
$labelShort = $langs->trans("ToAcceptRefuse");
}
if ($mode == 'signed') {
$delay_warning=$conf->propal->facturation->warning_delay;
- $statut = self::STATUS_SIGNED;
+ $status = self::STATUS_SIGNED;
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
$labelShort = $langs->trans("ToBill");
}
@@ -3291,8 +3300,8 @@ class Propal extends CommonObject
$response->warning_delay = $delay_warning/60/60/24;
$response->label = $label;
$response->labelShort = $labelShort;
- $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
- $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
+ $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals';
+ $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
$response->img = img_object('', "propal");
// This assignment in condition is not a bug. It allows walking the results.
@@ -3433,7 +3442,7 @@ class Propal extends CommonObject
$sql = "SELECT count(p.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php
index bd0f57bc801..0859bdb7974 100644
--- a/htdocs/comm/propal/class/propalestats.class.php
+++ b/htdocs/comm/propal/class/propalestats.class.php
@@ -112,7 +112,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
$sql.= " FROM ".$this->from;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php
index cb798e2fdd6..14f5913c4ce 100644
--- a/htdocs/comm/propal/contact.php
+++ b/htdocs/comm/propal/contact.php
@@ -41,7 +41,7 @@ $lineid=GETPOST('lineid', 'int');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'propal', $id);
$object = new Propal($db);
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index c1719ddbe45..55a21445be2 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -46,9 +46,9 @@ $ref = GETPOST('ref', 'alpha');
// Security check
$socid='';
-if (! empty($user->societe_id))
+if (! empty($user->socid))
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result = restrictedArea($user, 'propal', $id);
diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php
index a1104682904..d802548ac6b 100644
--- a/htdocs/comm/propal/index.php
+++ b/htdocs/comm/propal/index.php
@@ -38,10 +38,10 @@ $langs->loadLangs(array('propal', 'companies'));
// Security check
$socid=GETPOST('socid', 'int');
-if (isset($user->societe_id) && $user->societe_id > 0)
+if (isset($user->socid) && $user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result = restrictedArea($user, 'propal');
@@ -87,7 +87,7 @@ $sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.fk_soc = s.rowid";
$sql.= " AND p.entity IN (".getEntity('propal').")";
-if ($user->societe_id) $sql.=' AND p.fk_soc = '.$user->societe_id;
+if ($user->socid) $sql.=' AND p.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " AND p.fk_statut IN (0,1,2,3,4)";
$sql.= " GROUP BY p.fk_statut";
diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php
index 848d707f22f..1e27f187488 100644
--- a/htdocs/comm/propal/info.php
+++ b/htdocs/comm/propal/info.php
@@ -40,7 +40,7 @@ $ref=GETPOST('ref', 'alpha');
$socid=GETPOST('socid', 'int');
// Security check
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'propal', $id);
$object = new Propal($db);
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 01d4c264667..a83d7ee5161 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -112,7 +112,7 @@ if (! $sortorder) $sortorder='DESC';
$module='propal';
$dbtable='';
$objectid='';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
if (! empty($socid))
{
$objectid=$socid;
diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php
index 7c3d58f64d5..ee9d9bd9c4f 100644
--- a/htdocs/comm/propal/note.php
+++ b/htdocs/comm/propal/note.php
@@ -41,7 +41,7 @@ $ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'propale', $id, 'propal');
$object = new Propal($db);
diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php
index 1d81b553f7a..a37006d60fb 100644
--- a/htdocs/comm/propal/stats/index.php
+++ b/htdocs/comm/propal/stats/index.php
@@ -42,10 +42,10 @@ $object_status=GETPOST('object_status');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
@@ -94,7 +94,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenamenb = $dir.'/proposalsnbinyear-'.$user->id.'-'.$year.'.png';
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$user->id.'-'.$year.'.png';
@@ -134,7 +134,7 @@ if (! $mesg)
$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, 0);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenameamount = $dir.'/proposalsamountinyear-'.$user->id.'-'.$year.'.png';
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$user->id.'-'.$year.'.png';
@@ -173,7 +173,7 @@ if (! $mesg)
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
$fileurl_avg='';
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php
index cdd94c9cf6c..485771939c4 100644
--- a/htdocs/comm/prospect/index.php
+++ b/htdocs/comm/prospect/index.php
@@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
$langs->load("propal");
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
diff --git a/htdocs/comm/prospect/recap-prospect.php b/htdocs/comm/prospect/recap-prospect.php
index 192aaccbddf..07741635bcc 100644
--- a/htdocs/comm/prospect/recap-prospect.php
+++ b/htdocs/comm/prospect/recap-prospect.php
@@ -32,10 +32,10 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
// Security check
$socid = $_GET["socid"];
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php
index 0759c47c06c..9605281d6ca 100644
--- a/htdocs/comm/recap-client.php
+++ b/htdocs/comm/recap-client.php
@@ -32,10 +32,10 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
// Security check
$socid = $_GET["socid"];
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php
index a704a4be173..32c6869d576 100644
--- a/htdocs/comm/remise.php
+++ b/htdocs/comm/remise.php
@@ -33,9 +33,9 @@ $id=GETPOST("id", 'int');
$socid = GETPOST('id', 'int')?GETPOST('id', 'int'):GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$backtopage = GETPOST('backtopage', 'alpha');
@@ -116,7 +116,7 @@ if ($socid > 0)
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"), -1, 'company');
- dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom');
print '';
diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php
index 002eb7288e2..523c6ebc7b1 100644
--- a/htdocs/comm/remx.php
+++ b/htdocs/comm/remx.php
@@ -40,9 +40,9 @@ $backtopage=GETPOST('backtopage', 'alpha');
// Security check
$socid = GETPOST('id', 'int')?GETPOST('id', 'int'):GETPOST('socid', 'int');
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
@@ -252,7 +252,7 @@ if ($socid > 0)
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index e645bf3cee6..a6427dbd045 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -82,8 +82,8 @@ $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty(
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
// Security check
-if (! empty($user->societe_id))
- $socid = $user->societe_id;
+if (! empty($user->socid))
+ $socid = $user->socid;
$result = restrictedArea($user, 'commande', $id);
$object = new Commande($db);
@@ -1803,7 +1803,7 @@ if ($action == 'create' && $usercancreate)
print '';
// Note private
- if (empty($user->societe_id)) {
+ if (empty($user->socid)) {
print '
';
print '' . $langs->trans('NotePrivate') . ' ';
print '';
@@ -2057,12 +2057,8 @@ if ($action == 'create' && $usercancreate)
if ($action == 'clone') {
// Create an array for form
$formquestion = array(
- // 'text' => $langs->trans("ConfirmClone"),
- // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' =>
- // 1),
- // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value'
- // => 1),
- array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=3)')));
+ array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=3)'))
+ );
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
@@ -2291,25 +2287,28 @@ if ($action == 'create' && $usercancreate)
print ' ';
// Multicurrency rate
- print '
';
- print '';
- $editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
- print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable);
- print ' ';
- if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
- if($action == 'actualizemulticurrencyrate') {
- list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
- }
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
- } else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '';
+ if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
+ {
+ print ' ';
+ print '';
+ $editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == $object::STATUS_DRAFT;
+ print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable);
+ print ' ';
+ if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
+ if($action == 'actualizemulticurrencyrate') {
+ list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
+ }
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ print '';
+ }
}
+ print ' ';
}
- print '';
}
// Delivery delay
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 4cc922a8cbf..6e01ba2f5e2 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -53,19 +53,22 @@ class Commande extends CommonOrder
public $table_element='commande';
/**
- * @var int Name of subtable line
+ * @var string Name of subtable line
*/
public $table_element_line = 'commandedet';
+ /**
+ * @var string Name of class line
+ */
public $class_element_line = 'OrderLine';
/**
- * @var int Field with ID of parent key if this field has a parent
+ * @var string Field name with ID of parent key if this field has a parent
*/
public $fk_element = 'fk_commande';
/**
- * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ * @var string String with name of icon for commande class. Here is object_order.png
*/
public $picto = 'order';
@@ -87,13 +90,23 @@ class Commande extends CommonOrder
protected $table_ref_field = 'ref';
/**
- * Client ID
- * @var int
+ * @var int Thirparty ID
*/
public $socid;
+ /**
+ * @var string Thirparty ref of order
+ */
public $ref_client;
+
+ /**
+ * @var string Internal ref for order
+ */
public $ref_int;
+
+ /**
+ * @var int Contact ID
+ */
public $contactid;
/**
@@ -103,10 +116,9 @@ class Commande extends CommonOrder
public $statut;
/**
- * Billed
- * @var int
+ * @var int Status Billed or not
*/
- public $billed; // billed or not
+ public $billed;
/**
* @var int Draft Status of the order
@@ -115,25 +127,22 @@ class Commande extends CommonOrder
public $cond_reglement_code;
/**
- * @var int ID
+ * @var int bank account ID
*/
public $fk_account;
/**
- * It holds the label of the payment mode. Use it in case translation cannot be found.
- * @var string
+ * @var string It holds the label of the payment mode. Use it in case translation cannot be found.
*/
public $mode_reglement;
/**
- * Payment mode id
- * @var int
+ * @var int Payment mode id
*/
public $mode_reglement_id;
/**
- * Payment mode code
- * @var string
+ * @var string Payment mode code
*/
public $mode_reglement_code;
@@ -157,9 +166,13 @@ class Commande extends CommonOrder
public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...)
public $demand_reason_code;
- public $date; // Date commande
+ /**
+ * @var int Date of order
+ */
+ public $date;
/**
+ * @var int Date of order
* @deprecated
* @see $date
*/
@@ -182,7 +195,14 @@ class Commande extends CommonOrder
public $linked_objects=array();
+ /**
+ * @var int User author ID
+ */
public $user_author_id;
+
+ /**
+ * @var int User validator ID
+ */
public $user_valid;
/**
@@ -192,7 +212,7 @@ class Commande extends CommonOrder
// Multicurrency
/**
- * @var int ID
+ * @var int Currency ID
*/
public $fk_multicurrency;
@@ -202,6 +222,9 @@ class Commande extends CommonOrder
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
+ /**
+ * @var Commande clone of order object
+ */
public $oldcopy;
//! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...)
@@ -3393,7 +3416,7 @@ class Commande extends CommonOrder
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@@ -3402,7 +3425,7 @@ class Commande extends CommonOrder
$sql.= $clause." c.entity IN (".getEntity('commande').")";
//$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0";
$sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
- if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
+ if ($user->socid) $sql.=" AND c.fk_soc = ".$user->socid;
$resql=$this->db->query($sql);
if ($resql)
@@ -3469,13 +3492,13 @@ class Commande extends CommonOrder
/**
* Return label of status
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @param int $billed If invoiced
* @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 $donotshowbilled Do not show billed status after order status
* @return string Label of status
*/
- public function LibStatut($statut, $billed, $mode, $donotshowbilled = 0)
+ public function LibStatut($status, $billed, $mode, $donotshowbilled = 0)
{
// phpcs:enable
global $langs, $conf;
@@ -3483,49 +3506,49 @@ class Commande extends CommonOrder
$billedtext = '';
if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):'');
- if ($statut==self::STATUS_CANCELED){
- $labelstatut = $langs->trans('StatusOrderCanceled');
- $labelstatutShort = $langs->trans('StatusOrderCanceledShort');
+ if ($status==self::STATUS_CANCELED){
+ $labelStatus = $langs->trans('StatusOrderCanceled');
+ $labelStatusShort = $langs->trans('StatusOrderCanceledShort');
$statusType='status5';
}
- elseif ($statut==self::STATUS_DRAFT){
- $labelstatut = $langs->trans('StatusOrderDraft');
- $labelstatutShort = $langs->trans('StatusOrderDraftShort');
+ elseif ($status==self::STATUS_DRAFT){
+ $labelStatus = $langs->trans('StatusOrderDraft');
+ $labelStatusShort = $langs->trans('StatusOrderDraftShort');
$statusType='status0';
}
- elseif ($statut==self::STATUS_VALIDATED){
- $labelstatut = $langs->trans('StatusOrderValidated').$billedtext;
- $labelstatutShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
+ elseif ($status==self::STATUS_VALIDATED){
+ $labelStatus = $langs->trans('StatusOrderValidated').$billedtext;
+ $labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
$statusType='status1';
}
- elseif ($statut==self::STATUS_SHIPMENTONPROCESS){
- $labelstatut = $langs->trans('StatusOrderSentShort').$billedtext;
- $labelstatutShort = $langs->trans('StatusOrderSentShort').$billedtext;
+ elseif ($status==self::STATUS_SHIPMENTONPROCESS){
+ $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext;
+ $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext;
$statusType='status3';
}
- elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
- $labelstatut = $langs->trans('StatusOrderToBill');
- $labelstatutShort = $langs->trans('StatusOrderToBillShort');
+ elseif ($status==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
+ $labelStatus = $langs->trans('StatusOrderToBill');
+ $labelStatusShort = $langs->trans('StatusOrderToBillShort');
$statusType='status4';
}
- elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
- $labelstatut = $langs->trans('StatusOrderProcessed').$billedtext;
- $labelstatutShort = $langs->trans('StatusOrderProcessed').$billedtext;
+ elseif ($status==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
+ $labelStatus = $langs->trans('StatusOrderProcessed').$billedtext;
+ $labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext;
$statusType='status6';
}
- elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
- $labelstatut = $langs->trans('StatusOrderDelivered');
- $labelstatutShort = $langs->trans('StatusOrderDelivered');
+ elseif ($status==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
+ $labelStatus = $langs->trans('StatusOrderDelivered');
+ $labelStatusShort = $langs->trans('StatusOrderDelivered');
$statusType='status6';
}
else{
- $labelstatut = $langs->trans('Unknown');
- $labelstatutShort = '';
+ $labelStatus = $langs->trans('Unknown');
+ $labelStatusShort = '';
$statusType='';
$mode = 0;
}
- return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
+ return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}
@@ -3774,7 +3797,7 @@ class Commande extends CommonOrder
$sql = "SELECT count(co.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as co";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php
index 10276e34c0e..0311f4c49ed 100644
--- a/htdocs/commande/class/commandestats.class.php
+++ b/htdocs/commande/class/commandestats.class.php
@@ -212,7 +212,7 @@ class CommandeStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
$sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php
index 57e37f9f903..97890c9d2ef 100644
--- a/htdocs/commande/contact.php
+++ b/htdocs/commande/contact.php
@@ -40,7 +40,7 @@ $ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'commande', $id, '');
$object = new Commande($db);
diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php
index 2f275adadb9..bcb445c546c 100644
--- a/htdocs/commande/customer.php
+++ b/htdocs/commande/customer.php
@@ -33,10 +33,10 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$action=GETPOST('action', 'aZ09');
// Secrutiy check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
if (! $user->rights->facture->creer)
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index fa825086c4a..565583e1fae 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -45,9 +45,9 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref');
// Security check
-if ($user->societe_id)
+if ($user->socid)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result=restrictedArea($user, 'commande', $id, '');
diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php
index 2149c48121b..da1a4fc55df 100644
--- a/htdocs/commande/index.php
+++ b/htdocs/commande/index.php
@@ -42,10 +42,10 @@ $langs->loadLangs(array('orders', 'bills'));
// Security check
$socid=GETPOST('socid', 'int');
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
@@ -92,7 +92,7 @@ $sql.= ", ".MAIN_DB_PREFIX."commande as c";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity IN (".getEntity('societe').")";
-if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
+if ($user->socid) $sql.=' AND c.fk_soc = '.$user->socid;
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY c.fk_statut";
diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php
index 7d8e319c5ae..4ca81f77771 100644
--- a/htdocs/commande/info.php
+++ b/htdocs/commande/info.php
@@ -42,7 +42,7 @@ $id = GETPOST("id", 'int');
$ref=GETPOST('ref', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'commande', $comid, '');
$object = new Commande($db);
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 37dd5a8d570..5f9906b58dc 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -88,7 +88,7 @@ $search_project=GETPOST('search_project', 'alpha');
// Security check
$id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int'));
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'commande', $id, '');
$diroutputmassaction=$conf->commande->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id;
@@ -268,7 +268,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
-if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
@@ -769,6 +769,7 @@ if ($resql)
$total=0;
$subtotal=0;
$productstat_cache=array();
+ $getNomUrl_cache=array();
$generic_commande = new Commande($db);
$generic_product = new Product($db);
@@ -785,11 +786,14 @@ if ($resql)
$text_warning='';
$nbprod=0;
- $companystatic->id=$obj->socid;
+ $companystatic->id = $obj->socid;
$companystatic->code_client = $obj->code_client;
- $companystatic->name=$obj->name;
- $companystatic->client=$obj->client;
- $companystatic->email=$obj->email;
+ $companystatic->name = $obj->name;
+ $companystatic->client = $obj->client;
+ $companystatic->email = $obj->email;
+ if (!isset($getNomUrl_cache[$obj->socid])) {
+ $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer');
+ }
$generic_commande->id=$obj->rowid;
$generic_commande->ref=$obj->ref;
@@ -974,7 +978,7 @@ if ($resql)
if (! empty($arrayfields['s.nom']['checked']))
{
print '
';
- print $companystatic->getNomUrl(1, 'customer');
+ print $getNomUrl_cache[$obj->socid];
// If module invoices enabled and user with invoice creation permissions
if (! empty($conf->facture->enabled) && ! empty($conf->global->ORDER_BILLING_ALL_CUSTOMER))
diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php
index 2cb69bd698b..5b8fe052b06 100644
--- a/htdocs/commande/note.php
+++ b/htdocs/commande/note.php
@@ -42,7 +42,7 @@ $action=GETPOST('action', 'alpha');
// Security check
$socid=0;
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'commande', $id, '');
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index fae23fa8bcd..35756a56487 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -139,7 +139,7 @@ if (($action == 'create' || $action == 'add') && !$error)
// Security check
$fieldid = GETPOST('ref', 'alpha')?'ref':'rowid';
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
@@ -503,7 +503,7 @@ if ($action == 'create' && !$error)
print ' ';
// Private note
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print '
';
print ''.$langs->trans('NotePrivate').' ';
diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php
index 696823f4e41..bdf277bc375 100644
--- a/htdocs/commande/stats/index.php
+++ b/htdocs/commande/stats/index.php
@@ -43,10 +43,10 @@ $object_status=GETPOST('object_status');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
@@ -101,7 +101,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
@@ -144,7 +144,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
@@ -185,7 +185,7 @@ if (! $mesg)
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php
index cbecd9cbc05..f9d7e44794c 100644
--- a/htdocs/compta/accounting-files.php
+++ b/htdocs/compta/accounting-files.php
@@ -73,7 +73,7 @@ $arrayfields=array(
if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) {
accessforbidden();
}
-if ($user->societe_id > 0) {
+if ($user->socid > 0) {
accessforbidden();
}
diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php
index 7f96d9e28e7..b5839db2200 100644
--- a/htdocs/compta/bank/annuel.php
+++ b/htdocs/compta/bank/annuel.php
@@ -41,7 +41,7 @@ $ref=GETPOST('ref');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
$fieldtype = (! empty($ref) ? 'ref' :'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype);
$year_start=GETPOST('year_start');
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index 457e311d01c..773ee1e9255 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -66,12 +66,12 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
$fieldtype = (! empty($ref) ? 'ref' :'rowid');
if ($fielvalue)
{
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype);
}
else
{
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'banque');
}
@@ -1065,9 +1065,10 @@ if ($resql)
}
}
// Extra fields
- if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
+ $element = 'banktransaction';
+ if (is_array($extrafields->attributes[$element]['label']) && count($extrafields->attributes[$element]['label']))
{
- foreach($extrafields->attribute_label as $key => $val)
+ foreach($extrafields->attributes[$element]['label'] as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php
index 41275ec2a40..c9c5a0f77fe 100644
--- a/htdocs/compta/bank/budget.php
+++ b/htdocs/compta/bank/budget.php
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->loadLangs(array('banks', 'categories'));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'banque');
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 53fa268b750..57cff121010 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -1188,7 +1188,7 @@ class Account extends CommonObject
// phpcs:enable
global $conf, $langs;
- if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
+ if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe
$sql = "SELECT b.rowid, b.datev as datefin";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
@@ -1244,7 +1244,7 @@ class Account extends CommonObject
// phpcs:enable
global $user;
- if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
+ if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe
$sql = "SELECT count(b.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
@@ -1283,7 +1283,7 @@ class Account extends CommonObject
global $db, $conf, $user;
//Protection against external users
- if ($user->societe_id) {
+ if ($user->socid) {
return 0;
}
diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php
index ed94c8e4700..ca3acd59e42 100644
--- a/htdocs/compta/bank/class/paymentvarious.class.php
+++ b/htdocs/compta/bank/class/paymentvarious.class.php
@@ -523,46 +523,46 @@ class PaymentVarious extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
- * @param int $statut Id status
+ * @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
* @return string Libelle
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
if ($mode == 0)
{
- return $langs->trans($this->statuts[$statut]);
+ return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 1)
{
- return $langs->trans($this->statuts_short[$statut]);
+ return $langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 2)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
+ if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 3)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
- elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
+ if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
+ elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
}
elseif ($mode == 4)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
+ if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]);
}
elseif ($mode == 5)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
- elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
+ if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
+ elseif ($status==2 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
}
}
diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php
index 67a38e03cc6..1a250a83b10 100644
--- a/htdocs/compta/bank/document.php
+++ b/htdocs/compta/bank/document.php
@@ -46,12 +46,12 @@ if (isset($_SESSION['DolMessage'])) {
}
// Security check
-if ($user->societe_id) {
+if ($user->socid) {
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
-if ($user->societe_id)
- $socid = $user->societe_id;
+if ($user->socid)
+ $socid = $user->socid;
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php
index 4ad0fe0e261..15f6a1236d5 100644
--- a/htdocs/compta/bank/graph.php
+++ b/htdocs/compta/bank/graph.php
@@ -40,7 +40,7 @@ if (isset($_GET["account"]) || isset($_GET["ref"]))
$id = isset($_GET["account"])?$_GET["account"]:(isset($_GET["ref"])?$_GET["ref"]:'');
}
$fieldid = isset($_GET["ref"])?'ref':'rowid';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
$account=GETPOST("account");
diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php
index 389cde747af..7e96ddf31be 100644
--- a/htdocs/compta/bank/line.php
+++ b/htdocs/compta/bank/line.php
@@ -53,7 +53,7 @@ $cancel=GETPOST('cancel', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
$fieldtype = (! empty($ref) ? 'ref' :'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
if (! $user->rights->banque->lire && ! $user->rights->banque->consolidate) accessforbidden();
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index 1b06a0e222b..524e3f44cbc 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -50,7 +50,7 @@ $search_status=GETPOST('search_status')?GETPOST('search_status', 'alpha'):'opene
$optioncss = GETPOST('optioncss', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
if (! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Dictionary with list of banks accounting account allowed to manager of chart account
if (! $allowed) $result=restrictedArea($user, 'banque');
diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php
index ae01b761b1b..cb029902372 100644
--- a/htdocs/compta/bank/releve.php
+++ b/htdocs/compta/bank/releve.php
@@ -57,7 +57,7 @@ $newbankreceipt=GETPOST('newbankreceipt', 'alpha');
// Security check
$fieldid = (! empty($ref)?$ref:$id);
$fieldname = isset($ref)?'ref':'rowid';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname);
if ($user->rights->banque->consolidate && $action == 'dvnext' && ! empty($dvid))
diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php
index cec68cf2c3a..7ca62b67ab8 100644
--- a/htdocs/compta/bank/treso.php
+++ b/htdocs/compta/bank/treso.php
@@ -42,7 +42,7 @@ if (isset($_GET["account"]) || isset($_GET["ref"]))
$id = isset($_GET["account"])?$_GET["account"]:(isset($_GET["ref"])?$_GET["ref"]:'');
}
$fieldid = isset($_GET["ref"])?'ref':'rowid';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
@@ -258,7 +258,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
{
$socialcontribstatic->ref=$obj->ref;
$socialcontribstatic->id=$obj->objid;
- $socialcontribstatic->lib=$obj->type;
+ $socialcontribstatic->label=$obj->type;
$ref = $socialcontribstatic->getNomUrl(1, 24);
$totalpayment = -1*$socialcontribstatic->getSommePaiement(); // Payment already done
diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index 5cb9d3c9558..30472729d92 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -57,7 +57,7 @@ $category_transaction = GETPOST("category_transaction", 'alpha');
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'banque', '', '', '');
$object = new PaymentVarious($db);
diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php
index 21598990aba..7070946e2c7 100644
--- a/htdocs/compta/bank/various_payment/document.php
+++ b/htdocs/compta/bank/various_payment/document.php
@@ -39,7 +39,7 @@ $confirm = GETPOST('confirm', 'alpha');
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'banque', '', '', '');
// Get parameters
diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php
index 7d55703802e..7498872881d 100644
--- a/htdocs/compta/bank/various_payment/info.php
+++ b/htdocs/compta/bank/various_payment/info.php
@@ -35,7 +35,7 @@ $action=GETPOST('action', 'aZ09');
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'banque', '', '', '');
/*
diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php
index 6c15c40ecaa..cad88367aa0 100644
--- a/htdocs/compta/bank/various_payment/list.php
+++ b/htdocs/compta/bank/various_payment/list.php
@@ -35,7 +35,7 @@ $langs->loadLangs(array("compta","banks","bills","accountancy"));
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'banque', '', '', '');
$optioncss = GETPOST('optioncss', 'alpha');
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index 6b767bc3949..e0461d35368 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -90,9 +90,9 @@ if (! $sortorder) $sortorder="ASC";
// Security check
$socid=0;
-if ($user->societe_id > 0) // Protection if external user
+if ($user->socid > 0) // Protection if external user
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'monmodule', $id, '');
@@ -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..00d77987d08 100644
--- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php
+++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
@@ -87,7 +87,13 @@ class CashControl extends CommonObject
public $cheque;
public $card;
public $date_valid;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $date_modification;
const STATUS_DRAFT = 0;
@@ -311,47 +317,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->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/charges/index.php b/htdocs/compta/charges/index.php
index 01cda8871b5..5fe9853ec54 100644
--- a/htdocs/compta/charges/index.php
+++ b/htdocs/compta/charges/index.php
@@ -45,7 +45,7 @@ $hookmanager->initHooks(array('specialexpensesindex'));
$langs->loadLangs(array('compta', 'bills'));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax|salaries', '', '', 'charges|');
$mode=GETPOST("mode", 'alpha');
@@ -138,7 +138,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print " \n";
- $sql = "SELECT c.id, c.libelle as lib,";
+ $sql = "SELECT c.id, c.libelle as label,";
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
$sql.= " pct.code as payment_code,";
@@ -185,12 +185,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
// Label
print '';
$socialcontrib->id=$obj->rowid;
- $socialcontrib->ref=$obj->libelle;
- $socialcontrib->lib=$obj->libelle;
+ $socialcontrib->ref=$obj->label;
+ $socialcontrib->label=$obj->label;
print $socialcontrib->getNomUrl(1, '20');
print ' ';
// Type
- print ''.$obj->lib.' ';
+ print ''.$obj->label.' ';
// Expected to pay
print ''.price($obj->total).' ';
// Ref payment
diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php
index b7652587826..15f3504268b 100644
--- a/htdocs/compta/clients.php
+++ b/htdocs/compta/clients.php
@@ -30,10 +30,10 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$action=GETPOST('action', 'aZ09');
// Secrutiy check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
if (! $user->rights->facture->lire)
diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php
index 6a320970396..dd56e611545 100644
--- a/htdocs/compta/deplacement/card.php
+++ b/htdocs/compta/deplacement/card.php
@@ -40,7 +40,7 @@ $langs->load("trips");
// Security check
$id = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'deplacement', $id, '');
$action = GETPOST('action', 'alpha');
@@ -287,7 +287,7 @@ if ($action == 'create')
print '';
// Private note
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print '';
print ''.$langs->trans('NotePrivate').' ';
@@ -385,7 +385,7 @@ elseif ($id)
print " ";
// Private note
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print ''.$langs->trans("NotePrivate").' ';
print '';
diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php
index 1b70641a6bc..0601c62fd80 100644
--- a/htdocs/compta/deplacement/class/deplacement.class.php
+++ b/htdocs/compta/deplacement/class/deplacement.class.php
@@ -336,46 +336,46 @@ class Deplacement extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
- * @param int $statut Id status
+ * @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
* @return string Libelle
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
if ($mode == 0)
{
- return $langs->trans($this->statuts[$statut]);
+ return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 1)
{
- return $langs->trans($this->statuts_short[$statut]);
+ return $langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 2)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
+ if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 3)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
- elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
+ if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
+ elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
}
elseif ($mode == 4)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
+ if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]);
}
elseif ($mode == 5)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
- elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
+ if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
+ elseif ($status==2 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
}
}
diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php
index 3f2faa267ea..96c8013c18c 100644
--- a/htdocs/compta/deplacement/document.php
+++ b/htdocs/compta/deplacement/document.php
@@ -43,7 +43,7 @@ $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'deplacement', $id, '');
diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php
index 0208f9da89f..659744a2ba0 100644
--- a/htdocs/compta/deplacement/index.php
+++ b/htdocs/compta/deplacement/index.php
@@ -32,7 +32,7 @@ $langs->loadLangs(array('companies', 'users', 'trips'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'deplacement', '', '');
$sortfield = GETPOST("sortfield", 'alpha');
@@ -143,11 +143,11 @@ $langs->load("boxes");
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
-if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = d.fk_user";
$sql.= " AND d.entity = ".$conf->entity;
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')';
-if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND d.fk_soc = ".$socid;
$sql.= $db->order("d.tms", "DESC");
$sql.= $db->plimit($max, 0);
diff --git a/htdocs/compta/deplacement/info.php b/htdocs/compta/deplacement/info.php
index 510675265a0..28d1d8e68da 100644
--- a/htdocs/compta/deplacement/info.php
+++ b/htdocs/compta/deplacement/info.php
@@ -32,7 +32,7 @@ $langs->load("trips");
// Security check
$id = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'deplacement', $id, '');
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
index 9b5b2b7d9c9..6d5d952d104 100644
--- a/htdocs/compta/deplacement/list.php
+++ b/htdocs/compta/deplacement/list.php
@@ -36,7 +36,7 @@ $langs->loadLangs(array('companies', 'users', 'trips'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'deplacement', '', '');
$search_ref=GETPOST('search_ref', 'int');
diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php
index 54e1cd1524e..ccb2ecb60fe 100644
--- a/htdocs/compta/deplacement/stats/index.php
+++ b/htdocs/compta/deplacement/stats/index.php
@@ -38,12 +38,12 @@ $socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0;
$id = GETPOST('id', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'deplacement', $id, '');
// Other security check
@@ -162,7 +162,7 @@ if (! $mesg)
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/card-rec.php
similarity index 94%
rename from htdocs/compta/facture/fiche-rec.php
rename to htdocs/compta/facture/card-rec.php
index 79780402108..10eb2ac03c8 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -25,7 +25,7 @@
*/
/**
- * \file htdocs/compta/facture/fiche-rec.php
+ * \file htdocs/compta/facture/card-rec.php
* \ingroup facture
* \brief Page to show predefined invoice
*/
@@ -58,7 +58,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'invoice
$id=(GETPOST('facid', 'int')?GETPOST('facid', 'int'):GETPOST('id', 'int'));
$lineid=GETPOST('lineid', 'int');
$ref=GETPOST('ref', 'alpha');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$objecttype = 'facture_rec';
if ($action == "create" || $action == "add") $objecttype = '';
$result = restrictedArea($user, 'facture', $id, $objecttype);
@@ -387,6 +387,15 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
}
+ // Multicurrency Code
+ elseif ($action == 'setmulticurrencycode' && $usercancreate) {
+ $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
+ }
+
+ // Multicurrency rate
+ elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
+ $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int'));
+ }
// Delete line
if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer)
@@ -1039,7 +1048,7 @@ if ($action == 'create')
print $doleditor->Create(1);
// Private note
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print ' ';
print '';
@@ -1346,6 +1355,52 @@ else
}
print ' ';
+ // Multicurrency
+ if (! empty($conf->multicurrency->enabled))
+ {
+ // Multicurrency code
+ print '';
+ print '';
+ print '';
+ print ' ';
+ $htmlname = (($usercancreate && $action == 'editmulticurrencycode')?'multicurrency_code':'none');
+ $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);
+ print ' ';
+
+ // Multicurrency rate
+ if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
+ {
+ print '';
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
+ if($action == 'actualizemulticurrencyrate') {
+ list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
+ }
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate?'multicurrency_tx':'none'), $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ print '';
+ }
+ }
+ print ' ';
+ }
+ }
+
// Help of substitution key
$dateexample=dol_now();
if (! empty($object->frequency) && ! empty($object->date_when)) $dateexample=$object->date_when;
@@ -1701,11 +1756,11 @@ else
{
if (empty($object->suspended))
{
- print '';
+ print '';
}
else
{
- print '';
+ print '';
}
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 08fbb019fd2..fce1fb7cb25 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -130,7 +130,7 @@ $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatede
// Security check
$fieldid = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid = $user->societe_id;
+if ($user->socid) $socid = $user->socid;
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
@@ -2579,7 +2579,6 @@ $title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Card');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
-
// Mode creation
if ($action == 'create')
@@ -2600,18 +2599,19 @@ if ($action == 'create')
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
+ $regs = array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
- $element = $regs [1];
- $subelement = $regs [2];
+ $element = $reg[1];
+ $subelement = $regs[2];
}
if ($element == 'project') {
$projectid = $originid;
- if (!$cond_reglement_id) {
+ if (empty($cond_reglement_id)) {
$cond_reglement_id = $soc->cond_reglement_id;
}
- if (!$mode_reglement_id) {
+ if (empty($mode_reglement_id)) {
$mode_reglement_id = $soc->mode_reglement_id;
}
if (!$remise_percent) {
@@ -2754,7 +2754,7 @@ if ($action == 'create')
// Thirdparty
print '' . $langs->trans('Customer') . ' ';
- if ($soc->id > 0 && ! GETPOST('fac_rec', 'alpha'))
+ if ($soc->id > 0 && ! GETPOST('fac_rec', 'int'))
{
print '';
print $soc->getNomUrl(1);
@@ -2797,7 +2797,7 @@ if ($action == 'create')
$exampletemplateinvoice=new FactureRec($db);
- // Overwrite value if creation of invoice is from a predefined invoice
+ // Overwrite some values if creation of invoice is from a predefined invoice
if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0)
{
$invoice_predefined = new FactureRec($db);
@@ -2811,6 +2811,9 @@ if ($action == 'create')
$note_public = $invoice_predefined->note_public;
$note_private = $invoice_predefined->note_private;
+ if (! empty($invoice_predefined->multicurrency_code)) $currency_code = $invoice_predefined->multicurrency_code;
+ if (! empty($invoice_predefined->multicurrency_tx)) $currency_tx = $invoice_predefined->multicurrency_tx;
+
$sql = 'SELECT r.rowid, r.titre as title, r.total_ttc';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
$sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid;
@@ -2833,7 +2836,7 @@ if ($action == 'create')
if (GETPOST('fac_rec') == $objp->rowid)
{
print ' selected';
- $exampletemplateinvoice->fetch(GETPOST('fac_rec'));
+ $exampletemplateinvoice->fetch(GETPOST('fac_rec', 'int'));
}
print '>' . $objp->title . ' (' . price($objp->total_ttc) . ' ' . $langs->trans("TTC") . ')';
$i ++;
@@ -2921,12 +2924,17 @@ if ($action == 'create')
// Next situation invoice
$opt = $form->selectSituationInvoices(GETPOST('originid'), $socid);
+
print '';
$tmp='
' . $langs->trans('NoSituations') . '') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) $tmp.=' disabled';
+ if ($opt == ('
' . $langs->trans('NoSituations') . ' ') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande'))
+ $tmp.=' disabled';
$tmp.= '> ';
$text = '
'.$tmp.$langs->trans("InvoiceSituationAsk") . ' ';
- $text .= '
';
+ $text .= '' . $langs->trans('NoSituations') . '') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande'))
+ $text .= ' disabled';
+ $text .='>';
$text .= $opt;
$text .= ' ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3);
@@ -3334,7 +3342,7 @@ if ($action == 'create')
print $doleditor->Create(1);
// Private note
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print '';
print '';
@@ -3460,7 +3468,7 @@ elseif ($id > 0 || ! empty($ref))
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
- if ($user->societe_id > 0 && $user->societe_id != $object->socid)
+ if ($user->socid > 0 && $user->socid != $object->socid)
{
accessforbidden('', 0, 1);
}
@@ -4030,29 +4038,33 @@ elseif ($id > 0 || ! empty($ref))
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);
print ' ';
- print '';
- print '';
- print '';
- print ' ';
- if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
- if($action == 'actualizemulticurrencyrate') {
- list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
- }
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate?'multicurrency_tx':'none'), $object->multicurrency_code);
- } else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '';
+ // Multicurrency rate
+ if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
+ {
+ print ' ';
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
+ if($action == 'actualizemulticurrencyrate') {
+ list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
+ }
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate?'multicurrency_tx':'none'), $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ print '';
+ }
}
+ print ' ';
}
- print ' ';
}
// Bank Account
@@ -4099,7 +4111,7 @@ elseif ($id > 0 || ! empty($ref))
}
$displayWarranty = false;
- if( ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)) ) )
+ if (($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY))))
{
// Check if this situation invoice is 100% for real
if(!empty($object->situation_final) && !empty($object->lines)){
@@ -4179,9 +4191,7 @@ elseif ($id > 0 || ! empty($ref))
print '';
-
-
- if($displayWarranty)
+ if ($displayWarranty)
{
// Retained Warranty payment date limit
print '';
@@ -4547,7 +4557,7 @@ elseif ($id > 0 || ! empty($ref))
}
print ' ' . price($sign * $objp->amount) . ' ';
print '';
- if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
+ if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0)
{
print 'id.'&action=deletepaiement&paiement_id='.$objp->rowid.'">';
print img_delete();
@@ -5024,7 +5034,7 @@ elseif ($id > 0 || ! empty($ref))
{
if (! $objectidnext && count($object->lines) > 0)
{
- print ' ' . $langs->trans("ChangeIntoRepeatableInvoice") . ' ';
+ print '' . $langs->trans("ChangeIntoRepeatableInvoice") . ' ';
}
}
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/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 9ff90b7b025..408ce2c1303 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -896,7 +896,7 @@ class FactureRec extends CommonInvoice
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
* @param int $fk_fournprice Id of origin supplier price
- * @param int $pa_ht Price (without tax) of product when it was bought
+ * @param int $pa_ht Price (without tax) of product for margin calculation
* @return int <0 if KO, Id of line if OK
*/
public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0)
@@ -920,8 +920,9 @@ class FactureRec extends CommonInvoice
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
if (empty($info_bits)) $info_bits=0;
- $pu_ht=price2num($pu_ht);
- $pu_ttc=price2num($pu_ttc);
+ $pu_ht = price2num($pu_ht);
+ $pu_ttc = price2num($pu_ttc);
+ $pu_ht_devise = price2num($pu_ht_devise);
$txtva=price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
@@ -1258,7 +1259,7 @@ class FactureRec extends CommonInvoice
}
}
- $url = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id;
+ $url = DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$this->id;
if ($short) return $url;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 8859578e94b..ac39b84e428 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1127,7 +1127,7 @@ class Facture extends CommonInvoice
{
$line = new FactureLigne($this->db);
- $line->libelle = $object->lines[$i]->libelle;
+ $line->libelle = $object->lines[$i]->libelle; // deprecated
$line->label = $object->lines[$i]->label;
$line->desc = $object->lines[$i]->desc;
$line->subprice = $object->lines[$i]->subprice;
@@ -1551,7 +1551,7 @@ class Facture extends CommonInvoice
$line->product_type = $objp->product_type; // Type of line
$line->ref = $objp->product_ref; // Ref product
$line->product_ref = $objp->product_ref; // Ref product
- $line->libelle = $objp->product_label; // TODO deprecated
+ $line->libelle = $objp->product_label; // deprecated
$line->product_label = $objp->product_label; // Label product
$line->product_desc = $objp->product_desc; // Description product
$line->fk_product_type = $objp->fk_product_type; // Type of product
@@ -3961,7 +3961,7 @@ class Facture extends CommonInvoice
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut, f.total";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@@ -3970,7 +3970,7 @@ class Facture extends CommonInvoice
$sql.= $clause." f.paye=0";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
$sql.= " AND f.fk_statut = ".self::STATUS_VALIDATED;
- if ($user->societe_id) $sql.= " AND f.fk_soc = ".$user->societe_id;
+ if ($user->socid) $sql.= " AND f.fk_soc = ".$user->socid;
$resql=$this->db->query($sql);
if ($resql)
@@ -4211,7 +4211,7 @@ class Facture extends CommonInvoice
$sql = "SELECT count(f.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 62960b71346..72bb79545e5 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -45,7 +45,7 @@ $socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'facture', $id);
$object = new Facture($db);
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 9527f66b79e..36f768991f8 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -49,9 +49,9 @@ $action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id)
+if ($user->socid)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result=restrictedArea($user, 'facture', $id, '');
diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php
index f714d51cf6e..09873f5ee61 100644
--- a/htdocs/compta/facture/invoicetemplate_list.php
+++ b/htdocs/compta/facture/invoicetemplate_list.php
@@ -58,7 +58,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'invoice
$id=(GETPOST('facid', 'int')?GETPOST('facid', 'int'):GETPOST('id', 'int'));
$lineid=GETPOST('lineid', 'int');
$ref=GETPOST('ref', 'alpha');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$objecttype = 'facture_rec';
if ($action == "create" || $action == "add") $objecttype = '';
$result = restrictedArea($user, 'facture', $id, $objecttype);
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 5f1ce9e44c3..74c27c1e467 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -128,7 +128,7 @@ $pagenext = $page + 1;
// Security check
$fieldid = (! empty($ref)?'ref':'rowid');
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
$diroutputmassaction=$conf->facture->dir_output . '/temp/massgeneration/'.$user->id;
@@ -512,9 +512,8 @@ if (! $sall)
$sql.= " p.rowid, p.ref, p.title";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
- foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
- {
- $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
+ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
}
}
else
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index beeb5f730ab..ff71b1ff9af 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -43,7 +43,7 @@ $action=GETPOST('action', 'alpha');
// Security check
$socid=0;
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'facture', $id, '');
$object = new Facture($db);
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index cf59af89cf6..485401d340e 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -47,7 +47,7 @@ $socid=GETPOST('socid', 'int');
$action=GETPOST('action', 'alpha');
$fieldid = (! empty($ref)?'ref':'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
$object = new Facture($db);
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index dadbb27b30d..5f81d34a092 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -41,10 +41,10 @@ $object_status=GETPOST('object_status');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
@@ -159,7 +159,7 @@ if (! $mesg)
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 1453491fd11..8531249afdb 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -56,10 +56,10 @@ $bid=GETPOST('bid', 'int');
// Security check
$socid='';
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$max=3;
@@ -624,12 +624,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$chargestatic=new ChargeSociales($db);
$sql = "SELECT c.rowid, c.amount, c.date_ech, c.paye,";
- $sql.= " cc.libelle,";
+ $sql.= " cc.libelle as label,";
$sql.= " SUM(pc.amount) as sumpaid";
$sql.= " FROM (".MAIN_DB_PREFIX."c_chargesociales as cc, ".MAIN_DB_PREFIX."chargesociales as c)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = c.rowid";
$sql.= " WHERE c.fk_type = cc.id";
- $sql.= " AND c.entity = ".$conf->entity;
+ $sql.= " AND c.entity IN (".getEntity('tax').')';
$sql.= " AND c.paye = 0";
// Add where from hooks
$parameters=array();
@@ -661,8 +661,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$obj = $db->fetch_object($resql);
$chargestatic->id=$obj->rowid;
- $chargestatic->ref=$obj->libelle;
- $chargestatic->lib=$obj->libelle;
+ $chargestatic->ref=$obj->rowid;
+ $chargestatic->label=$obj->label;
$chargestatic->paye=$obj->paye;
print ' ';
@@ -672,6 +672,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print ''.price($obj->sumpaid).' ';
print ''.$chargestatic->getLibStatut(3).' ';
print ' ';
+
$tot_ttc+=$obj->amount;
$i++;
}
@@ -957,7 +958,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{
$facstatic=new FactureFournisseur($db);
- $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
+ $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle as label, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
$sql.= ", ff.date_lim_reglement";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid, s.email";
@@ -1074,9 +1075,8 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
-
print ''.dol_print_date($db->jdate($obj->da), "day").' ';
- print ''.$obj->libelle.' '.$obj->label.' ';
+ print ''.$obj->label.' ';
$i++;
}
$db->free($resql);
diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php
index 55f5c82a72a..54a8513fc0c 100644
--- a/htdocs/compta/journal/purchasesjournal.php
+++ b/htdocs/compta/journal/purchasesjournal.php
@@ -45,7 +45,7 @@ $date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
// Security check
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
@@ -100,7 +100,7 @@ $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0];
-$sql = "SELECT f.rowid, f.ref_supplier, f.type, f.datef, f.libelle,";
+$sql = "SELECT f.rowid, f.ref_supplier, f.type, f.datef, f.libelle as label,";
$sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
@@ -158,7 +158,7 @@ if ($result)
$tabfac[$obj->rowid]["date"] = $obj->datef;
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier;
$tabfac[$obj->rowid]["type"] = $obj->type;
- $tabfac[$obj->rowid]["lib"] = $obj->libelle;
+ $tabfac[$obj->rowid]["lib"] = $obj->label;
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
if ($obj->recuperableonly != 1) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php
index 74032e34d18..f6cc0ec03b6 100644
--- a/htdocs/compta/journal/sellsjournal.php
+++ b/htdocs/compta/journal/sellsjournal.php
@@ -47,7 +47,7 @@ $date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
// Security check
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php
index e7762b834e4..4acb3f108a3 100644
--- a/htdocs/compta/localtax/card.php
+++ b/htdocs/compta/localtax/card.php
@@ -40,7 +40,7 @@ $lttype=GETPOST('localTaxType', 'int');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$object = new Localtax($db);
diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php
index 97f97bbc735..c31a02b5b33 100644
--- a/htdocs/compta/localtax/clients.php
+++ b/htdocs/compta/localtax/clients.php
@@ -82,7 +82,7 @@ if (empty($modetax)) $modetax=0;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
if (empty($local))
diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php
index c02de96035d..6fa963ad25e 100644
--- a/htdocs/compta/localtax/index.php
+++ b/htdocs/compta/localtax/index.php
@@ -76,7 +76,7 @@ if (empty($modetax)) $modetax=0;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php
index 0b0716b53a9..cfa1d492a60 100644
--- a/htdocs/compta/localtax/list.php
+++ b/htdocs/compta/localtax/list.php
@@ -29,7 +29,7 @@ $langs->load("compta");
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$ltt=GETPOST("localTaxType");
diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php
index 0251173a863..0c49f23dc3d 100644
--- a/htdocs/compta/localtax/quadri_detail.php
+++ b/htdocs/compta/localtax/quadri_detail.php
@@ -94,7 +94,7 @@ if (empty($modetax)) $modetax=0;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
if (empty($local))
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index d0377ad9ff1..5590a45f97f 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -59,9 +59,9 @@ $multicurrency_amounts=array();
$multicurrency_amountsresttopay=array();
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$object=new Facture($db);
diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php
index e11da654bdd..1fd4f735a50 100644
--- a/htdocs/compta/paiement/card.php
+++ b/htdocs/compta/paiement/card.php
@@ -44,7 +44,7 @@ $confirm=GETPOST('confirm', 'alpha');
$backtopage=GETPOST('backtopage', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
@@ -220,7 +220,7 @@ print $form->editfieldval("Date", 'datep', $object->date, $object, $user->rights
print '';
// Payment type (VIR, LIQ, ...)
-$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
+$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_label;
print ''.$langs->trans('PaymentMode').' '.$labeltype;
print $object->num_paiement?' - '.$object->num_paiement:'';
print ' ';
@@ -429,7 +429,7 @@ print '';
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
- if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '')
+ if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '')
{
if ($user->rights->facture->paiement)
{
@@ -438,7 +438,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
}
}
-if ($user->societe_id == 0 && $action == '')
+if ($user->socid == 0 && $action == '')
{
if ($user->rights->facture->paiement)
{
diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index 3afce69e94b..f91ac35f678 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -43,7 +43,7 @@ $confirm=GETPOST('confirm', 'alpha');
// Security check
$fieldname = (! empty($ref)?'ref':'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname);
$sortfield=GETPOST('sortfield', 'alpha');
@@ -770,12 +770,12 @@ else
print '
';
-if ($user->societe_id == 0 && ! empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque)
+if ($user->socid == 0 && ! empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque)
{
print '
id.'&action=valide&sortfield='.$sortfield.'&sortorder='.$sortorder.'">'.$langs->trans('Validate').' ';
}
-if ($user->societe_id == 0 && ! empty($object->id) && $user->rights->banque->cheque)
+if ($user->socid == 0 && ! empty($object->id) && $user->rights->banque->cheque)
{
print '
id.'&action=delete&sortfield='.$sortfield.'&sortorder='.$sortorder.'">'.$langs->trans('Delete').' ';
}
diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
index 940013df44e..6f0438644a6 100644
--- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php
+++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
@@ -506,7 +506,7 @@ class RemiseCheque extends CommonObject
// phpcs:enable
global $conf, $langs;
- if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
+ if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe
$sql = "SELECT b.rowid, b.datev as datefin";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
@@ -561,7 +561,7 @@ class RemiseCheque extends CommonObject
// phpcs:enable
global $user;
- if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
+ if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe
$sql = "SELECT count(b.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php
index cdbc56896cb..bbec9e1fba7 100644
--- a/htdocs/compta/paiement/cheque/index.php
+++ b/htdocs/compta/paiement/cheque/index.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->loadLangs(array('banks', 'categories', 'compta', 'bills'));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'banque', '', '');
diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php
index 396432545d9..2201412f3f8 100644
--- a/htdocs/compta/paiement/cheque/list.php
+++ b/htdocs/compta/paiement/cheque/list.php
@@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array('banks', 'categories', 'bills'));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'banque', '', '');
$search_ref = GETPOST('search_ref', 'alpha');
diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php
index 37614f7e36e..4363f39216f 100644
--- a/htdocs/compta/paiement/class/cpaiement.class.php
+++ b/htdocs/compta/paiement/class/cpaiement.class.php
@@ -41,7 +41,14 @@ class Cpaiement
public $table_element = 'c_paiement';
public $code;
+
+ /**
+ * @deprecated
+ * @see $label
+ */
public $libelle;
+ public $label;
+
public $type;
public $active;
public $accountancy_code;
@@ -80,6 +87,9 @@ class Cpaiement
if (isset($this->libelle)) {
$this->libelle = trim($this->libelle);
}
+ if (isset($this->label)) {
+ $this->label = trim($this->label);
+ }
if (isset($this->type)) {
$this->type = trim($this->type);
}
@@ -100,7 +110,6 @@ class Cpaiement
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
-
$sql.= 'entity,';
$sql.= 'code,';
$sql.= 'libelle,';
@@ -108,10 +117,7 @@ class Cpaiement
$sql.= 'active,';
$sql.= 'accountancy_code,';
$sql.= 'module';
-
-
$sql .= ') VALUES (';
-
$sql .= ' '.(! isset($this->entity)?getEntity('c_paiement'):$this->entity).',';
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
@@ -119,8 +125,6 @@ class Cpaiement
$sql .= ' '.(! isset($this->active)?'NULL':$this->active).',';
$sql .= ' '.(! isset($this->accountancy_code)?'NULL':"'".$this->db->escape($this->accountancy_code)."'").',';
$sql .= ' '.(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'");
-
-
$sql .= ')';
$this->db->begin();
@@ -173,7 +177,7 @@ class Cpaiement
$sql = 'SELECT';
$sql .= ' t.id,';
$sql .= " t.code,";
- $sql .= " t.libelle,";
+ $sql .= " t.libelle as label,";
$sql .= " t.type,";
$sql .= " t.active,";
$sql .= " t.accountancy_code,";
@@ -195,7 +199,8 @@ class Cpaiement
$this->id = $obj->id;
$this->code = $obj->code;
- $this->libelle = $obj->libelle;
+ $this->libelle = $obj->label;
+ $this->label = $obj->label;
$this->type = $obj->type;
$this->active = $obj->active;
$this->accountancy_code = $obj->accountancy_code;
@@ -238,6 +243,9 @@ class Cpaiement
if (isset($this->libelle)) {
$this->libelle = trim($this->libelle);
}
+ if (isset($this->label)) {
+ $this->label = trim($this->label);
+ }
if (isset($this->type)) {
$this->type = trim($this->type);
}
@@ -361,6 +369,7 @@ class Cpaiement
$this->code = '';
$this->libelle = '';
+ $this->label = '';
$this->type = '';
$this->active = '';
$this->accountancy_code = '';
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index e6d2a27087c..e4a4a275029 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -78,7 +78,7 @@ class Paiement extends CommonObject
/**
* @var string type libelle
*/
- public $type_libelle;
+ public $type_label;
/**
* @var string type code
@@ -160,7 +160,7 @@ class Paiement extends CommonObject
public function fetch($id, $ref = '', $fk_bank = '')
{
$sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank,';
- $sql.= ' c.code as type_code, c.libelle as type_libelle,';
+ $sql.= ' c.code as type_code, c.libelle as type_label,';
$sql.= ' p.num_paiement as num_payment, p.note,';
$sql.= ' b.fk_account';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
@@ -188,7 +188,7 @@ class Paiement extends CommonObject
$this->montant = $obj->amount; // deprecated
$this->amount = $obj->amount;
$this->note = $obj->note;
- $this->type_libelle = $obj->type_libelle;
+ $this->type_label = $obj->type_label;
$this->type_code = $obj->type_code;
$this->statut = $obj->statut;
$this->ext_payment_id = $obj->ext_payment_id;
diff --git a/htdocs/compta/paiement/index.php b/htdocs/compta/paiement/index.php
index fa47915f216..89136ec5712 100644
--- a/htdocs/compta/paiement/index.php
+++ b/htdocs/compta/paiement/index.php
@@ -19,7 +19,7 @@
require '../../main.inc.php';
// Security check
-if (!$user->admin && $user->societe_id > 0)
+if (!$user->admin && $user->socid > 0)
accessforbidden();
diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php
index 090cc7c83fb..7faa2727ae4 100644
--- a/htdocs/compta/paiement/list.php
+++ b/htdocs/compta/paiement/list.php
@@ -51,7 +51,7 @@ $month = GETPOST('month', 'int');
$year = GETPOST('year', 'int');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'facture', $facid, '');
$paymentstatic=new Paiement($db);
@@ -117,8 +117,6 @@ if (GETPOST("orphelins", "alpha"))
$sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,";
$sql.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code";
- // Add fields for extrafields
- foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@@ -139,8 +137,6 @@ else
$sql.= " c.code as paiement_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
$sql.= " s.rowid as socid, s.nom as name, s.email";
- // Add fields for extrafields
- foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index 35325dce4cb..0140031431f 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -34,10 +34,10 @@ if (! $user->rights->facture->lire) accessforbidden();
$action=GETPOST('action', 'aZ09');
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$dir = $conf->facture->dir_output.'/payments';
diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php
index 120e326d6a2..e3c23041ec8 100644
--- a/htdocs/compta/paiement/tovalidate.php
+++ b/htdocs/compta/paiement/tovalidate.php
@@ -32,10 +32,10 @@ if (! $user->rights->facture->lire)
accessforbidden();
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index def454f2ca5..238ac01fd1a 100644
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -36,9 +36,9 @@ $amounts = array();
// Security check
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
@@ -202,9 +202,9 @@ if ($action == 'create')
print '
';
print ''.$langs->trans("Ref").' '.$chid.' ';
- print ''.$langs->trans("Type")." ".$charge->type_libelle." \n";
+ print ''.$langs->trans("Type")." ".$charge->type_label." \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/payment_sc/card.php b/htdocs/compta/payment_sc/card.php
index 605f5cec3bc..ecc3a23430a 100644
--- a/htdocs/compta/payment_sc/card.php
+++ b/htdocs/compta/payment_sc/card.php
@@ -39,7 +39,7 @@ $langs->loadLangs(array('bills', 'banks', 'companies'));
$id=GETPOST("id", 'int');
$action=GETPOST('action', 'aZ09');
$confirm=GETPOST('confirm');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
@@ -221,7 +221,7 @@ dol_fiche_end();
*/
$disable_delete = 0;
-$sql = 'SELECT f.rowid as scid, f.libelle, f.paye, f.amount as sc_amount, pf.amount, pc.libelle as sc_type';
+$sql = 'SELECT f.rowid as scid, f.libelle as label, f.paye, f.amount as sc_amount, pf.amount, pc.libelle as sc_type';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pf,'.MAIN_DB_PREFIX.'chargesociales as f, '.MAIN_DB_PREFIX.'c_chargesociales as pc';
$sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id';
$sql.= ' AND f.entity = '.$conf->entity;
@@ -259,11 +259,11 @@ if ($resql)
print "\n";
// Type
print '';
- print $socialcontrib->type_libelle;
+ print $socialcontrib->type_label;
/*print $socialcontrib->type;*/
print " \n";
// Label
- print ''.$objp->libelle.' ';
+ print ''.$objp->label.' ';
// Expected to pay
print ''.price($objp->sc_amount).' ';
// Status
@@ -299,7 +299,7 @@ print '';
/*
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
- if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '')
+ if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '')
{
if ($user->rights->facture->paiement)
{
diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php
index ecea96b7a09..eb18618ab62 100644
--- a/htdocs/compta/prelevement/bons.php
+++ b/htdocs/compta/prelevement/bons.php
@@ -33,7 +33,7 @@ $langs->loadLangs(array('banks', 'categories', 'widthdrawals'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php
index 1282226623c..6c60cdaa059 100644
--- a/htdocs/compta/prelevement/card.php
+++ b/htdocs/compta/prelevement/card.php
@@ -37,7 +37,7 @@ if (!$user->rights->prelevement->bons->lire)
accessforbidden();
// Security check
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
// Get supervariables
$action = GETPOST('action', 'alpha');
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 4016ebdc813..f1c3f70c53a 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -69,7 +69,7 @@ class BonPrelevement extends CommonObject
public $total;
public $fetched;
public $statut; // 0-Wait, 1-Trans, 2-Done
- public $labelstatut=array();
+ public $labelStatus=array();
public $invoice_in_error=array();
public $thirdparty_in_error=array();
@@ -1995,55 +1995,55 @@ class BonPrelevement extends CommonObject
/**
* Return status label for a status
*
- * @param int $statut id statut
+ * @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
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- if (empty($this->labelstatut))
+ if (empty($this->labelStatus))
{
global $langs;
$langs->load("withdrawals");
- $this->labelstatut[0]=$langs->trans("StatusWaiting");
- $this->labelstatut[1]=$langs->trans("StatusTrans");
- $this->labelstatut[2]=$langs->trans("StatusCredited");
+ $this->labelStatus[0]=$langs->trans("StatusWaiting");
+ $this->labelStatus[1]=$langs->trans("StatusTrans");
+ $this->labelStatus[2]=$langs->trans("StatusCredited");
}
if ($mode == 0 || $mode == 1)
{
- return $this->labelstatut[$statut];
+ return $this->labelStatus[$status];
}
elseif ($mode == 2)
{
- if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
- elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut];
- elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
+ if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status];
+ elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status];
+ elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status];
}
elseif ($mode == 3)
{
- if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1');
- elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3');
- elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6');
+ if ($status==0) return img_picto($this->labelStatus[$status], 'statut1');
+ elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3');
+ elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6');
}
elseif ($mode == 4)
{
- if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
- elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut];
- elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
+ if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status];
+ elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status];
+ elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status];
}
elseif ($mode == 5)
{
- if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
- elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3');
- elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
+ if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1');
+ elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3');
+ elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6');
}
elseif ($mode == 6)
{
- if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
- elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3');
- elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
+ if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1');
+ elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3');
+ elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6');
}
}
}
diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php
index 3b0f61b17a0..467351e3110 100644
--- a/htdocs/compta/prelevement/class/ligneprelevement.class.php
+++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php
@@ -132,36 +132,36 @@ class LignePrelevement
/**
* Return status label for a status
*
- * @param int $statut id statut
+ * @param int $status Id status
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
if ($mode == 0)
{
- return $langs->trans($this->statuts[$statut]);
+ return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 1)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); // Waiting
- elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited
- elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused
+ if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting
+ elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited
+ elseif ($status==3) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused
}
elseif ($mode == 2)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
- elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
- elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8');
+ if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut1');
+ elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6');
+ elseif ($status==3) return img_picto($langs->trans($this->statuts[$status]), 'statut8');
}
elseif ($mode == 3)
{
- if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
- elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
- elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8');
+ if ($status==0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1');
+ elseif ($status==2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6');
+ elseif ($status==3) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8');
}
}
diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index 3aaad5662a3..c4cad05d1f6 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills'));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
// Get supervariables
diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php
index 4ea74e83b4f..52b312e6b4c 100644
--- a/htdocs/compta/prelevement/demandes.php
+++ b/htdocs/compta/prelevement/demandes.php
@@ -36,7 +36,7 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
// Security check
$socid = GETPOST('socid', 'int');
$status = GETPOST('status', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index fbc36418222..334e36c5a68 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->loadLangs(array('banks', 'categories', 'companies', 'withdrawals', 'bills'));
// Securite acces client
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
// Get supervariables
$prev_id = GETPOST('id', 'int');
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index 3dbfec69461..17e8dcebe98 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->loadLangs(array("banks","categories",'withdrawals','bills'));
// Securite acces client
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
// Get supervariables
$prev_id = GETPOST('id', 'int');
diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php
index c8914b41f26..01fde1b2450 100644
--- a/htdocs/compta/prelevement/fiche-stat.php
+++ b/htdocs/compta/prelevement/fiche-stat.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->loadLangs(array("banks","categories",'withdrawals','bills'));
// Security check
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
// Get supervariables
$prev_id = GETPOST('id', 'int');
diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php
index 80d7abb4f0a..3af40c84dcb 100644
--- a/htdocs/compta/prelevement/index.php
+++ b/htdocs/compta/prelevement/index.php
@@ -38,7 +38,7 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'prelevement', '', '');
@@ -71,7 +71,7 @@ $thirdpartystatic=new Societe($db);
$invoicestatic=new Facture($db);
$bprev = new BonPrelevement($db);
-
+print '
';
print '
';
print ''.$langs->trans("Statistics").' ';
@@ -85,7 +85,7 @@ print '';
print ''.$langs->trans("AmountToWithdraw").' ';
print '';
print price($bprev->SommeAPrelever(), '', '', 1, -1, -1, 'auto');
-print '
';
+print '
';
@@ -116,6 +116,7 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
+ print '
';
print '
';
print '';
print ''.$langs->trans("InvoiceWaitingWithdraw").' ('.$num.') ';
@@ -162,7 +163,7 @@ if ($resql)
{
print ''.$langs->trans("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders")).' ';
}
- print "
";
+ print "
";
}
else
{
@@ -189,6 +190,7 @@ if ($result)
$i = 0;
print"\n\n";
+ print '';
print '
';
print ''.$langs->trans("LastWithdrawalReceipt", $limit).' ';
print ''.$langs->trans("Date").' ';
@@ -216,7 +218,7 @@ if ($result)
print " \n";
$i++;
}
- print "
";
+ print "
";
$db->free($result);
}
else
diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php
index 41ac08b0fb2..454861dea73 100644
--- a/htdocs/compta/prelevement/line.php
+++ b/htdocs/compta/prelevement/line.php
@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->loadlangs(array('banks', 'categories', 'bills', 'withdrawals'));
// Security check
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
// Get supervariables
$action = GETPOST('action', 'alpha');
diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php
index 2ffb8def303..c016f1e6c02 100644
--- a/htdocs/compta/prelevement/list.php
+++ b/htdocs/compta/prelevement/list.php
@@ -34,7 +34,7 @@ $langs->loadLangs(array('banks', 'withdrawals', 'companies', 'categories'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php
index 6cde242ae93..4235f5d7fc3 100644
--- a/htdocs/compta/prelevement/rejets.php
+++ b/htdocs/compta/prelevement/rejets.php
@@ -35,7 +35,7 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
// Get supervariables
diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php
index 0dd5087869c..1b9396a411a 100644
--- a/htdocs/compta/prelevement/stats.php
+++ b/htdocs/compta/prelevement/stats.php
@@ -33,7 +33,7 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index 6fc1a3b16b2..88a72344f52 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -35,7 +35,7 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
$id = GETPOST('id')?GETPOST('id', 'int'):GETPOST('socid', 'int');
// Security check
-if ($user->societe_id) $id=$user->societe_id;
+if ($user->socid) $id=$user->socid;
$result = restrictedArea($user, 'societe', $id, '&societe');
$object = new Societe($db);
@@ -96,7 +96,7 @@ if ($id > 0)
$head = societe_prepare_head($object);
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 1);
+ dol_banner_tab($object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 1);
dol_fiche_end();
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index 928776aa06e..c85894c60d6 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -50,7 +50,7 @@ $showaccountdetail = GETPOST('showaccountdetail', 'aZ09')?GETPOST('showaccountde
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
@@ -1132,11 +1132,11 @@ else
while ($i < $num) {
$obj = $db->fetch_object($result);
- $amount += $obj->amount;
- $total_ht += $obj->amount;
- $total_ttc += $obj->amount;
- $subtotal_ht += $obj->amount;
- $subtotal_ttc += $obj->amount;
+ $amount += -$obj->amount;
+ $total_ht += -$obj->amount;
+ $total_ttc += -$obj->amount;
+ $subtotal_ht += -$obj->amount;
+ $subtotal_ttc += -$obj->amount;
$i++;
}
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index 0503f31d6fb..33609f98997 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -98,7 +98,7 @@ $nbofyear = ($year_end - $year_start) + 1;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
@@ -480,10 +480,10 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
$obj = $db->fetch_object($result);
if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
- $encaiss[$obj->dm] += $obj->amount;
+ $encaiss[$obj->dm] += -$obj->amount;
if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
- $encaiss_ttc[$obj->dm] += $obj->amount;
+ $encaiss_ttc[$obj->dm] += -$obj->amount;
$i++;
}
diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php
index 8b8f7126568..9af5a559f5e 100644
--- a/htdocs/compta/resultat/result.php
+++ b/htdocs/compta/resultat/result.php
@@ -130,7 +130,7 @@ if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta", 'alpha');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->comptarapport->lire)
accessforbidden();
diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index 7399a7098c6..f35b145b969 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -49,7 +49,7 @@ $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges');
$object = new ChargeSociales($db);
@@ -167,7 +167,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
else
{
$object->type = $actioncode;
- $object->lib = GETPOST('label');
+ $object->label = GETPOST('label', 'alpha');
$object->date_ech = $dateech;
$object->periode = $dateperiod;
$object->amount = $amount;
@@ -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
@@ -445,8 +464,8 @@ if ($id > 0)
$morehtmlref='';
// Ref customer
- $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
+ $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
// Project
if (! empty($conf->projet->enabled))
{
@@ -495,7 +514,7 @@ if ($id > 0)
print '
';
// Type
- print ''.$langs->trans("Type")." ".$object->type_libelle." ";
+ print ''.$langs->trans("Type")." ".$object->type_label." ";
print " ";
// Period end date
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index c5a882283c7..85643d084ff 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -55,16 +55,27 @@ class ChargeSociales extends CommonObject
protected $table_ref_field = 'ref';
public $date_ech;
- public $lib;
+ public $label;
public $type;
- public $type_libelle;
+ public $type_label;
public $amount;
public $paye;
public $periode;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $date_modification;
public $date_validation;
+ /**
+ * @deprecated Use label instead
+ */
+ public $lib;
+
/**
* @var int account ID
*/
@@ -106,7 +117,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,9 +139,10 @@ 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->type_label = $obj->libelle;
$this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
@@ -203,7 +215,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 +335,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')."'";
@@ -459,12 +471,12 @@ class ChargeSociales extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
- * @param int $statut Id statut
+ * @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
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
- public function LibStatut($statut, $mode = 0, $alreadypaid = -1)
+ public function LibStatut($status, $mode = 0, $alreadypaid = -1)
{
// phpcs:enable
global $langs;
@@ -474,38 +486,38 @@ class ChargeSociales extends CommonObject
if ($mode == 0 || $mode == 1)
{
- if ($statut == 0) return $langs->trans("Unpaid");
- elseif ($statut == 1) return $langs->trans("Paid");
+ if ($status == 0) return $langs->trans("Unpaid");
+ elseif ($status == 1) return $langs->trans("Paid");
}
elseif ($mode == 2)
{
- if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
- elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
- elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
+ if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
+ elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
+ elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
elseif ($mode == 3)
{
- if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
- elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
- elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
+ if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
+ elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
+ elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6');
}
elseif ($mode == 4)
{
- if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
- elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
- elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
+ if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
+ elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
+ elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
elseif ($mode == 5)
{
- if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
- elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
- elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
+ if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
+ elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
+ elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
elseif ($mode == 6)
{
- if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
- elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
- elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
+ if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
+ elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
+ elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
else return "Error, mode/status not found";
@@ -543,15 +555,15 @@ 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->type_libelle))
- $label .= ''.$langs->trans('Type') . ': ' . $this->type_libelle;
+ if (! empty($this->label))
+ $label .= ''.$langs->trans('Label') . ': ' . $this->label;
+ if (! empty($this->type_label))
+ $label .= ''.$langs->trans('Type') . ': ' . $this->type_label;
$linkclose='';
if (empty($notooltip) && $user->rights->facture->lire)
@@ -677,12 +689,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_label = 'Type of social contribution';
}
}
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index e13738fd5f4..4fb2f27b53f 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -236,7 +236,7 @@ class PaymentSocialContribution extends CommonObject
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
- $sql.= " pt.code as type_code, pt.libelle as type_libelle,";
+ $sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
@@ -267,7 +267,7 @@ class PaymentSocialContribution extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
- $this->type_libelle = $obj->type_libelle;
+ $this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
@@ -592,7 +592,7 @@ class PaymentSocialContribution extends CommonObject
{
$socialcontrib = new ChargeSociales($this->db);
$socialcontrib->fetch($key);
- $result=$acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_libelle.(($socialcontrib->lib && $socialcontrib->lib!=$socialcontrib->type_libelle)?' ('.$socialcontrib->lib.')':''), 'sc');
+ $result=$acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib!=$socialcontrib->type_label)?' ('.$socialcontrib->lib.')':''), 'sc');
if ($result <= 0) dol_print_error($this->db);
}
}
diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php
index b3fb1cf697b..4a714df8bae 100644
--- a/htdocs/compta/sociales/document.php
+++ b/htdocs/compta/sociales/document.php
@@ -47,7 +47,7 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges');
@@ -108,8 +108,8 @@ if ($object->id)
$morehtmlref='';
// Label of social contribution
- $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
+ $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
// Project
if (! empty($conf->projet->enabled))
{
diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php
index 3d59e2b229c..e449f907bc8 100644
--- a/htdocs/compta/sociales/info.php
+++ b/htdocs/compta/sociales/info.php
@@ -39,7 +39,7 @@ $action=GETPOST('action', 'aZ09');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges');
$object = new ChargeSociales($db);
@@ -79,8 +79,8 @@ dol_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, 'bill');
$morehtmlref='
';
// Label of social contribution
-$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
-$morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
+$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
+$morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
// Project
if (! empty($conf->projet->enabled))
{
diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php
index 56493f3bf7c..6fbf174abc5 100644
--- a/htdocs/compta/sociales/list.php
+++ b/htdocs/compta/sociales/list.php
@@ -42,7 +42,7 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'sclist';
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$search_ref = GETPOST('search_ref', 'int');
@@ -110,8 +110,8 @@ $chargesociale_static=new ChargeSociales($db);
llxHeader('', $langs->trans("SocialContributions"));
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
-$sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
-$sql.= " c.libelle as type_lib,";
+$sql.= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
+$sql.= " c.libelle as type_label,";
$sql.= " SUM(pc.amount) as alreadypayed";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
@@ -261,8 +261,8 @@ if ($resql)
$chargesociale_static->id=$obj->id;
$chargesociale_static->ref=$obj->id;
- $chargesociale_static->lib=$obj->libelle;
- $chargesociale_static->type_libelle=$obj->type_lib;
+ $chargesociale_static->label=$obj->label;
+ $chargesociale_static->type_label=$obj->type_label;
print '
';
@@ -272,10 +272,10 @@ if ($resql)
print '';
// Label
- print ''.dol_trunc($obj->libelle, 42).' ';
+ print ''.dol_trunc($obj->label, 42).' ';
// Type
- print ''.$obj->type_lib.' ';
+ print ''.$obj->type_label.' ';
// Date end period
print '';
diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php
index caf11a6ea3b..d22bd80722a 100644
--- a/htdocs/compta/sociales/payments.php
+++ b/htdocs/compta/sociales/payments.php
@@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array('compta', 'bills'));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax|salaries', '', '', 'charges|');
$mode=GETPOST("mode", 'alpha');
@@ -126,8 +126,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print " \n";
- $sql = "SELECT c.id, c.libelle as lib,";
- $sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
+ $sql = "SELECT c.id, c.libelle as type_label,";
+ $sql.= " cs.rowid, cs.libelle as label, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment,";
$sql.= " pct.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
@@ -162,10 +162,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
- print '
';
- // Ref payment
+
$payment_sc_static->id=$obj->pid;
$payment_sc_static->ref=$obj->pid;
+
+ print ' ';
+ // Ref payment
print ''.$payment_sc_static->getNomUrl(1)." \n";
// Date payment
print ''.dol_print_date($db->jdate($obj->datep), 'day').' ';
@@ -176,12 +178,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
// Label
print '';
$socialcontrib->id=$obj->rowid;
- $socialcontrib->ref=$obj->libelle;
- $socialcontrib->lib=$obj->libelle;
+ $socialcontrib->ref=$obj->rowid;
+ $socialcontrib->label=$obj->label;
print $socialcontrib->getNomUrl(1, '20');
print ' ';
// Type
- print ''.$obj->lib.' ';
+ print ''.$obj->type_label.' ';
// Date
$date=$obj->periode;
if (empty($date)) $date=$obj->date_ech;
diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php
index 590269b332c..08ddd9a576e 100644
--- a/htdocs/compta/stats/byratecountry.php
+++ b/htdocs/compta/stats/byratecountry.php
@@ -107,7 +107,7 @@ if (empty($modetax)) $modetax=0;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php
index 5570b08435b..138bff4a525 100644
--- a/htdocs/compta/stats/cabyprodserv.php
+++ b/htdocs/compta/stats/cabyprodserv.php
@@ -36,7 +36,7 @@ $langs->loadLangs(array("products","categories","errors",'accountancy'));
// Security pack (data & check)
$socid = GETPOST('socid', 'int');
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php
index 8973c92f68f..286e6aeb29a 100644
--- a/htdocs/compta/stats/cabyuser.php
+++ b/htdocs/compta/stats/cabyuser.php
@@ -35,7 +35,7 @@ $langs->load("accountancy");
$socid = GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php
index 139e9f22160..68f9e0d9f99 100644
--- a/htdocs/compta/stats/casoc.php
+++ b/htdocs/compta/stats/casoc.php
@@ -57,7 +57,7 @@ if (GETPOST('subcat', 'alpha') === 'yes') {
}
// Security check
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php
index cf28a4cd5d6..ac3e800e6e4 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -98,7 +98,7 @@ if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta", 'alpha');
// Security check
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index e58fa66acaf..dbbaa8d56fc 100644
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -40,7 +40,7 @@ if (empty($refund)) $refund=0;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$object = new Tva($db);
diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php
index 576ea819fda..e97e4554b41 100644
--- a/htdocs/compta/tva/clients.php
+++ b/htdocs/compta/tva/clients.php
@@ -90,7 +90,7 @@ if (empty($modetax)) $modetax=0;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php
index d26d8954cc4..d3a5b60d7ba 100644
--- a/htdocs/compta/tva/document.php
+++ b/htdocs/compta/tva/document.php
@@ -48,7 +48,7 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', $id, 'vat', 'charges');
diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php
index d6019c1eef5..1ed3658b37a 100644
--- a/htdocs/compta/tva/index.php
+++ b/htdocs/compta/tva/index.php
@@ -76,7 +76,7 @@ if (empty($modetax)) $modetax=0;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
diff --git a/htdocs/compta/tva/info.php b/htdocs/compta/tva/info.php
index 667cffd065b..6190a30f316 100644
--- a/htdocs/compta/tva/info.php
+++ b/htdocs/compta/tva/info.php
@@ -34,7 +34,7 @@ $action=GETPOST('action', 'aZ09');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$object = new Tva($db);
diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php
index cffa9152a92..e27093ff89f 100644
--- a/htdocs/compta/tva/list.php
+++ b/htdocs/compta/tva/list.php
@@ -36,7 +36,7 @@ $langs->loadLangs(array('compta', 'bills'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$search_ref = GETPOST('search_ref', 'int');
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index bb9067d5a04..791c360ff67 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -91,7 +91,7 @@ if (empty($modetax)) $modetax=0;
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', '', '', 'charges');
diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php
index 30efcd28632..8ffc88d1a14 100644
--- a/htdocs/contact/agenda.php
+++ b/htdocs/contact/agenda.php
@@ -84,7 +84,7 @@ else
$search_agenda_label=GETPOST('search_agenda_label');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
index d7cfe53b0bc..8ab92047daa 100644
--- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
+++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
@@ -133,7 +133,7 @@ if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['act
control->tpl['showend'];
-if (empty($user->societe_id)) {
+if (empty($user->socid)) {
print '';
if ($user->rights->societe->contact->creer) {
print '
control->tpl['id'].'&action=edit&canvas='.$canvas.'">'.$langs->trans('Modify').' ';
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 08b2e8e1d41..9642cdfa84c 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -76,7 +76,7 @@ if (! empty($canvas))
}
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -181,7 +181,7 @@ if (empty($reshook))
$object->socid = GETPOST("socid", 'int');
$object->lastname = GETPOST("lastname", 'alpha');
$object->firstname = GETPOST("firstname", 'alpha');
- $object->civility_id = GETPOST("civility_id", 'alpha');
+ $object->civility_code = GETPOST("civility_code", 'alpha');
$object->poste = GETPOST("poste", 'alpha');
$object->address = GETPOST("address", 'alpha');
$object->zip = GETPOST("zipcode", 'alpha');
@@ -377,7 +377,7 @@ if (empty($reshook))
$object->socid = GETPOST("socid", 'int');
$object->lastname = GETPOST("lastname", 'alpha');
$object->firstname = GETPOST("firstname", 'alpha');
- $object->civility_id = GETPOST("civility_id", 'alpha');
+ $object->civility_code = GETPOST("civility_code", 'alpha');
$object->poste = GETPOST("poste", 'alpha');
$object->address = GETPOST("address", 'alpha');
@@ -638,8 +638,8 @@ else
}
// Civility
- print '
'.$langs->trans("UserTitle").' ';
- print $formcompany->select_civility(GETPOST("civility", 'alpha')?GETPOST("civility", 'alpha'):$object->civility_code);
+ print ' '.$langs->trans("UserTitle").' ';
+ print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility_code", 'alpha'):$object->civility_code, 'civility_code');
print ' ';
print '
'.$langs->trans("PostOrFunction").' ';
@@ -962,8 +962,8 @@ else
}
// Civility
- print ''.$langs->trans("UserTitle").' ';
- print $formcompany->select_civility(isset($_POST["civility"])?GETPOST("civility"):$object->civility_code);
+ print ' '.$langs->trans("UserTitle").' ';
+ print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility", "aZ09"):$object->civility_code, 'civility_code');
print ' ';
print '
'.$langs->trans("PostOrFunction").' ';
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index c6c674bd4cd..f8a43d70494 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -213,7 +213,7 @@ class Contact extends CommonObject
$sql = "SELECT count(sp.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -222,7 +222,7 @@ class Contact extends CommonObject
}
$sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element).')';
$sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))";
- if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id;
+ if ($user->socid > 0) $sql.=" AND sp.fk_soc = ".$user->socid;
$resql=$this->db->query($sql);
if ($resql)
@@ -386,13 +386,13 @@ class Contact extends CommonObject
$this->town=(empty($this->town)?'':$this->town);
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id);
if (empty($this->statut)) $this->statut = 0;
-
+ if (empty($this->civility_code) && ! is_numeric($this->civility_id)) $this->civility_code = $this->civility_id; // For backward compatibility
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',";
elseif ($this->socid == -1) $sql .= " fk_soc=null,";
- $sql .= " civility='".$this->db->escape($this->civility_id)."'";
+ $sql .= " civility='".$this->db->escape($this->civility_code)."'";
$sql .= ", lastname='".$this->db->escape($this->lastname)."'";
$sql .= ", firstname='".$this->db->escape($this->firstname)."'";
$sql .= ", address='".$this->db->escape($this->address)."'";
@@ -1320,13 +1320,13 @@ class Contact extends CommonObject
// phpcs:enable
global $langs;
- $labelstatus = array(
+ $labelStatus = array(
0 => 'ActivityCeased',
1 => 'InActivity',
4 => 'InActivity',
5 => 'ActivityCeased',
);
- $labelstatusshort = array(
+ $labelStatusShort = array(
0 => 'ActivityCeased',
1 => 'InActivity',
4 => 'InActivity',
@@ -1336,8 +1336,8 @@ class Contact extends CommonObject
$statusType = 'status4';
if ($status==0 || $status==5) $statusType = 'status5';
- $label = $langs->trans($labelstatus[$status]);
- $labelshort = $langs->trans($labelstatusshort[$status]);
+ $label = $langs->trans($labelStatus[$status]);
+ $labelshort = $langs->trans($labelStatusShort[$status]);
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
}
diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php
index 00817ee5799..4b08d3cb95a 100644
--- a/htdocs/contact/consumption.php
+++ b/htdocs/contact/consumption.php
@@ -121,7 +121,7 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
}
$morehtmlref.='';
-dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', $morehtmlref);
+dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'rowid', 'nom', $morehtmlref);
print '';
@@ -170,7 +170,7 @@ if ($type_element == 'fichinter')
{ // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$documentstatic=new Fichinter($db);
- $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle, ';
+ $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle as type_contact_label, ';
$tables_from = MAIN_DB_PREFIX.'fichinterdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter as f ON d.fk_fichinter=f.rowid';
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
@@ -183,7 +183,7 @@ elseif ($type_element == 'invoice')
{ // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$documentstatic=new Facture($db);
- $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle, ';
+ $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle as type_contact_label, ';
$tables_from = MAIN_DB_PREFIX.'facturedet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON d.fk_facture=f.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
@@ -198,7 +198,7 @@ elseif ($type_element == 'propal')
{
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$documentstatic=new Propal($db);
- $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, tc.libelle, ';
+ $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
$tables_from = MAIN_DB_PREFIX.'propaldet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propal as c ON d.fk_propal=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
@@ -213,7 +213,7 @@ elseif ($type_element == 'order')
{
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$documentstatic=new Commande($db);
- $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, tc.libelle, ';
+ $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
$tables_from = MAIN_DB_PREFIX.'commandedet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON d.fk_commande=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
@@ -228,7 +228,7 @@ elseif ($type_element == 'supplier_invoice')
{ // Supplier : Show products from invoices.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$documentstatic=new FactureFournisseur($db);
- $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle, ';
+ $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle as type_contact_label, ';
$tables_from = MAIN_DB_PREFIX.'facture_fourn_det d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
@@ -256,7 +256,7 @@ elseif ($type_element == 'supplier_order')
{ // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$documentstatic=new CommandeFournisseur($db);
- $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, tc.libelle, ';
+ $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
$tables_from = MAIN_DB_PREFIX.'commande_fournisseurdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur as c ON d.fk_commande=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
@@ -272,7 +272,7 @@ elseif ($type_element == 'contract')
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$documentstatic=new Contrat($db);
$documentstaticline=new ContratLigne($db);
- $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, tc.libelle, ';
+ $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, tc.libelle as type_contact_label, ';
$tables_from = MAIN_DB_PREFIX.'contratdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'contrat as c ON d.fk_contrat=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
@@ -344,14 +344,14 @@ if ($sql_select)
$num = $db->num_rows($resql);
- $param="&socid=".$socid."&type_element=".$type_element;
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
+ $param="&socid=".urlencode($socid)."&type_element=".urlencode($type_element);
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr);
if ($sref) $param.= "&sref=".urlencode($sref);
- if ($month) $param.= "&month=".$month;
- if ($year) $param.= "&year=".$year;
- if ($optioncss != '') $param.='&optioncss='.$optioncss;
+ if ($month) $param.= "&month=".urlencode($month);
+ if ($year) $param.= "&year=".urlencode($year);
+ if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, '', 0, '', '', $limit);
@@ -408,6 +408,7 @@ if ($sql_select)
$documentstatic->statut=$objp->status;
$documentstatic->status=$objp->status;
$documentstatic->paye=$objp->paid;
+ $documentstatic->paid=$objp->paid;
if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status;
@@ -573,8 +574,7 @@ if ($sql_select)
*/
print '';
- //print '
'.$prodreftxt.' ';
- print '
'.$objp->libelle.' ';
+ print '
'.$objp->type_contact_label.' '; // Type of contact label
print '
'.$objp->prod_qty.' ';
$total_qty+=$objp->prod_qty;
diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php
index 1dbc22d1a51..8533cb13feb 100644
--- a/htdocs/contact/document.php
+++ b/htdocs/contact/document.php
@@ -51,7 +51,7 @@ if (! empty($canvas))
}
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
// Get parameters
diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php
index 3cb46276d43..2546f5d19e4 100644
--- a/htdocs/contact/info.php
+++ b/htdocs/contact/info.php
@@ -34,7 +34,7 @@ $langs->load("companies");
// Security check
$id = GETPOST("id", 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db);
diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php
index 826b5d3db39..cf2bf91bf99 100644
--- a/htdocs/contact/ldap.php
+++ b/htdocs/contact/ldap.php
@@ -36,7 +36,7 @@ $action=GETPOST('action', 'aZ09');
// Security check
$id = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db);
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 60232a052af..6694c363977 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -54,7 +54,7 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'contactl
$id = GETPOST('id', 'int');
$contactid = GETPOST('id', 'int');
$ref = ''; // There is no ref for contacts
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contact', $contactid, '');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php
index 72ee557c085..230211cca5e 100644
--- a/htdocs/contact/note.php
+++ b/htdocs/contact/note.php
@@ -36,7 +36,7 @@ $langs->load("companies");
// Security check
$id = GETPOST('id', 'int');
-if ($user->societe_id) $id=$user->societe_id;
+if ($user->socid) $id=$user->socid;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db);
diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php
index 3a09f294849..093245025cd 100644
--- a/htdocs/contact/perso.php
+++ b/htdocs/contact/perso.php
@@ -35,7 +35,7 @@ $id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db);
@@ -319,7 +319,7 @@ else
if ($action != 'edit')
{
// Barre d'actions
- if ($user->societe_id == 0)
+ if ($user->socid == 0)
{
print '
';
diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php
index df1629b46a6..4eb794a3054 100644
--- a/htdocs/contrat/agenda.php
+++ b/htdocs/contrat/agenda.php
@@ -52,7 +52,7 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contrat', $id, '');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 3a8e4f99a65..4e0226d4cae 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -62,7 +62,7 @@ $datecontrat='';
$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0);
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'contrat', $id);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -1256,7 +1256,7 @@ if ($action == 'create')
print $doleditor->Create(1);
print '
';
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print '
'.$langs->trans("NotePrivate").' ';
$doleditor=new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%');
@@ -1890,7 +1890,7 @@ else
print ' ';
print ''.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).' ';
print '';
- if ($user->societe_id == 0)
+ if ($user->socid == 0)
{
if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline')
{
@@ -2098,7 +2098,7 @@ else
* Buttons
*/
- if ($user->societe_id == 0)
+ if ($user->socid == 0)
{
print '';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index a6ccd9f7cf1..0b9c6768eda 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -189,6 +189,12 @@ class Contrat extends CommonObject
protected $lines_id_index_mapper=array();
+ const STATUS_DRAFT = 0;
+ const STATUS_VALIDATED = 1;
+ const STATUS_CLOSED = 2;
+
+
+
/**
* Constructor
*
@@ -1881,40 +1887,31 @@ class Contrat extends CommonObject
/**
* Renvoi label of a given contrat status
*
- * @param int $statut Status id
+ * @param int $status Id status
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length
* @return string Label
*/
- public function LibStatut($statut, $mode)
+ public function LibStatut($status, $mode)
{
// phpcs:enable
- global $langs;
- $langs->load("contracts");
- if ($mode == 0)
+
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
- if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
- elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
- elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
+ global $langs;
+ $langs->load("contracts");
+ $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated');
+ $this->labelStatus[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed');
+ $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft');
+ $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated');
+ $this->labelStatusShort[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed');
}
- elseif ($mode == 1)
- {
- if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
- elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
- elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
- }
- elseif ($mode == 2)
- {
- if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0').' '.$langs->trans("ContractStatusDraft"); }
- elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4').' '.$langs->trans("ContractStatusValidated"); }
- elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6').' '.$langs->trans("ContractStatusClosed"); }
- }
- elseif ($mode == 3)
- {
- if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0'); }
- elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4'); }
- elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6'); }
- }
- elseif ($mode == 4 || $mode == 6 || $mode == 7)
+
+ $statusType = 'status'.$status;
+ if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
+ if ($status == self::STATUS_VALIDATED) $statusType = 'status6';
+
+ if ($mode == 4 || $mode == 6 || $mode == 7)
{
$text='';
if ($mode == 4) {
@@ -1924,22 +1921,20 @@ class Contrat extends CommonObject
$text.=': ';
$text.='';
}
- $text.=($mode == 7?'
':'');
- $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
- $text.=($mode == 7?'
':'');
- $text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
- $text.=($mode == 7?'
':'');
- $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
- $text.=($mode == 7?'
':'');
- $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')) : '';
- $text.=($mode == 7?'
':'');
+ $text.=($mode == 7?'
':'');
+ $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
+ $text.=($mode == 7?' ':'');
+ $text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
+ $text.=($mode == 7?' ':'');
+ $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
+ $text.=($mode == 7?' ':'');
+ $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="marginleft2"')) : '';
+ $text.=($mode == 7?' ':'');
return $text;
}
- elseif ($mode == 5)
+ else
{
- if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'), 'statut0'); }
- elseif ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'), 'statut4'); }
- elseif ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'), 'statut6'); }
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
}
@@ -2073,10 +2068,10 @@ class Contrat extends CommonObject
/**
* Return list of line rowid
*
- * @param int $statut Status of lines to get
+ * @param int $status Status of lines to get
* @return array|int Array of line's rowid or <0 if error
*/
- public function array_detail($statut = -1)
+ public function array_detail($status = -1)
{
// phpcs:enable
$tab=array();
@@ -2084,7 +2079,7 @@ class Contrat extends CommonObject
$sql = "SELECT cd.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql.= " WHERE fk_contrat =".$this->id;
- if ($statut >= 0) $sql.= " AND statut = '$statut'";
+ if ($status >= 0) $sql.= " AND statut = ".$status;
dol_syslog(get_class($this)."::array_detail()", LOG_DEBUG);
$resql=$this->db->query($sql);
@@ -2162,7 +2157,7 @@ class Contrat extends CommonObject
$this->from = " FROM ".MAIN_DB_PREFIX."contrat as c";
$this->from.= ", ".MAIN_DB_PREFIX."contratdet as cd";
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($mode == 'inactive')
{
@@ -2193,8 +2188,8 @@ class Contrat extends CommonObject
}
$sql.= " AND c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
- if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) $sql.=" AND c.fk_soc = ".$user->socid;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
$resql=$this->db->query($sql);
if ($resql)
@@ -2265,7 +2260,7 @@ class Contrat extends CommonObject
$sql = "SELECT count(c.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@@ -2728,65 +2723,34 @@ class ContratLigne extends CommonObjectLine
/**
* Return label of a contract line status
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @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 $expired 0=Not expired, 1=Expired, -1=Both or unknown
* @param string $moreatt More attribute
* @return string Libelle
*/
- public static function LibStatut($statut, $mode, $expired = -1, $moreatt = '')
+ public static function LibStatut($status, $mode, $expired = -1, $moreatt = '')
{
// phpcs:enable
global $langs;
$langs->load("contracts");
- if ($mode == 0)
+
+ if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); }
+ elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); }
+ elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); }
+ elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); }
+ elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); }
+
+ $statusType = 'status'.$status;
+ if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status3';
+ if ($status == self::STATUS_CLOSED) $statusType = 'status6';
+
+ $params = array(); $reg = array();
+ if (preg_match('/class="(.*)"/', $moreatt, $reg))
{
- if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
- elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
- }
- elseif ($mode == 1)
- {
- if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
- elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
- }
- elseif ($mode == 2)
- {
- if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
- elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
- }
- elseif ($mode == 3)
- {
- if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0', $moreatt); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4', $moreatt); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4', $moreatt); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3', $moreatt); }
- elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6', $moreatt); }
- }
- elseif ($mode == 4)
- {
- if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLate"); }
- elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
- }
- elseif ($mode == 5)
- {
- if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'), 'statut0'); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'), 'statut4'); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'), 'statut4'); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'), 'statut3'); }
- elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'), 'statut6'); }
+ $params = array('badgeParams'=>array('css' => $reg[1]));
}
+ return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params);
}
/**
diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php
index 85247327dda..56a0c198db3 100644
--- a/htdocs/contrat/contact.php
+++ b/htdocs/contrat/contact.php
@@ -43,7 +43,7 @@ $id = GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'contrat', $id);
$object = new Contrat($db);
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index 7fbc291839d..fceba285f47 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -46,11 +46,11 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
unset($_GET["action"]);
$action='';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result = restrictedArea($user, 'contrat', $id);
diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php
index 8fd54a4f8e4..9d96ca7be5e 100644
--- a/htdocs/contrat/index.php
+++ b/htdocs/contrat/index.php
@@ -46,7 +46,7 @@ $statut=GETPOST('statut')?GETPOST('statut'):1;
// Security check
$socid=0;
$id = GETPOST('id', 'int');
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'contrat', $id);
$staticcompany=new Societe($db);
@@ -114,7 +114,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
$sql.= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate($now)."')))";
$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
-if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
+if ($user->socid) $sql.=' AND c.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY cd.statut";
$resql = $db->query($sql);
@@ -151,7 +151,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
$sql.= " AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now)."')";
$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
-if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
+if ($user->socid) $sql.=' AND c.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY cd.statut";
$resql = $db->query($sql);
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 0fd27d29826..3df193d53d2 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -84,7 +84,7 @@ if (! $sortorder) $sortorder='DESC';
// Security check
$id=GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'contrat', $id);
$diroutputmassaction=$conf->contrat->dir_output . '/temp/massgeneration/'.$user->id;
diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php
index 25772c08193..e4cceff10e0 100644
--- a/htdocs/contrat/note.php
+++ b/htdocs/contrat/note.php
@@ -41,7 +41,7 @@ $id=GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'contrat', $id);
$object = new Contrat($db);
diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php
index 81c0b13449b..a7656289fdd 100644
--- a/htdocs/contrat/services_list.php
+++ b/htdocs/contrat/services_list.php
@@ -90,7 +90,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
// Security check
$contratid = GETPOST('id', 'int');
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'contrat', $contratid);
if ($search_status != '')
diff --git a/htdocs/core/actions_comments.inc.php b/htdocs/core/actions_comments.inc.php
index a84edb0150a..1c679c88825 100644
--- a/htdocs/core/actions_comments.inc.php
+++ b/htdocs/core/actions_comments.inc.php
@@ -57,6 +57,24 @@ if ($action == 'addcomment')
}
}
}
+if ($action === 'updatecomment')
+{
+ if ($comment->fetch($idcomment) >= 0)
+ {
+ $comment->description = GETPOST('comment_description', 'none');
+ if ($comment->update($user) > 0)
+ {
+ setEventMessages($langs->trans("CommentAdded"), null, 'mesgs');
+ header('Location: '.$varpage.'?id='.$id.($withproject?'&withproject=1#comment':''));
+ exit;
+ }
+ else
+ {
+ setEventMessages($comment->error, $comment->errors, 'errors');
+ $action='';
+ }
+ }
+}
if ($action == 'deletecomment')
{
if ($comment->fetch($idcomment) >= 0)
diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index d6a2ba77f05..b369550dda2 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -104,7 +104,7 @@ if (empty($url))
$langs->loadLangs(array("ecm","companies","other"));
// Security check
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
//print 'xxx'.$upload_dir;
diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php
index e812e8b9a3c..0d662b6a0bd 100644
--- a/htdocs/core/ajax/objectonoff.php
+++ b/htdocs/core/ajax/objectonoff.php
@@ -39,8 +39,8 @@ $element=GETPOST('element', 'alpha');
$object = new GenericObject($db);
// Security check
-if (! empty($user->societe_id))
- $socid = $user->societe_id;
+if (! empty($user->socid))
+ $socid = $user->socid;
diff --git a/htdocs/core/ajax/pingresult.php b/htdocs/core/ajax/pingresult.php
index 9de6e53a0f5..eec1c9f0aca 100644
--- a/htdocs/core/ajax/pingresult.php
+++ b/htdocs/core/ajax/pingresult.php
@@ -36,8 +36,8 @@ $hash_algo=GETPOST('hash_algo', 'alpha');
// Security check
-if (! empty($user->societe_id))
- $socid = $user->societe_id;
+if (! empty($user->socid))
+ $socid = $user->socid;
$now = dol_now();
diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php
index af86e73ce2c..c104384434d 100644
--- a/htdocs/core/boxes/box_actions.php
+++ b/htdocs/core/boxes/box_actions.php
@@ -90,13 +90,13 @@ class box_actions extends ModeleBoxes
$sql.= ", s.rowid as socid";
$sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm AS ta, ".MAIN_DB_PREFIX."actioncomm AS a";
- if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
+ if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql.= " WHERE a.fk_action = ta.id";
$sql.= " AND a.entity = ".$conf->entity;
$sql.= " AND a.percent >= 0 AND a.percent < 100";
- if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
$sql.= " ORDER BY a.datec DESC";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index c18bf2f3bf3..9609f596618 100644
--- a/htdocs/core/boxes/box_activity.php
+++ b/htdocs/core/boxes/box_activity.php
@@ -84,7 +84,7 @@ class box_activity extends ModeleBoxes
$totalnb = 0;
$line = 0;
$cachetime = 3600;
- $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
+ $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
$now = dol_now();
$nbofperiod=3;
@@ -113,12 +113,12 @@ class box_activity extends ModeleBoxes
{
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE p.entity IN (".getEntity('propal').")";
$sql.= " AND p.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " AND p.datep >= '".$this->db->idate($tmpdate)."'";
$sql.= " AND p.date_cloture IS NULL"; // just unclosed
$sql.= " GROUP BY p.fk_statut";
@@ -202,12 +202,12 @@ class box_activity extends ModeleBoxes
if ($refresh) {
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE c.entity = ".$conf->entity;
$sql.= " AND c.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'";
$sql.= " GROUP BY c.fk_statut";
$sql.= " ORDER BY c.fk_statut DESC";
@@ -286,11 +286,11 @@ class box_activity extends ModeleBoxes
{
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE f.entity IN (".getEntity('invoice').')';
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1";
$sql.= " GROUP BY f.fk_statut";
diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php
index 185f581b5c5..feb7564cdaf 100644
--- a/htdocs/core/boxes/box_clients.php
+++ b/htdocs/core/boxes/box_clients.php
@@ -97,11 +97,11 @@ class box_clients extends ModeleBoxes
$sql.= ", s.email";
$sql.= ", s.datec, s.tms, s.status";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (1, 3)";
$sql.= " AND s.entity IN (".getEntity('societe').")";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) $sql.= " AND s.rowid = $user->socid";
$sql.= " ORDER BY s.tms DESC";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php
index 327f06fc0c9..40d809fd6e7 100644
--- a/htdocs/core/boxes/box_commandes.php
+++ b/htdocs/core/boxes/box_commandes.php
@@ -102,12 +102,12 @@ class box_commandes extends ModeleBoxes
$sql.= ", c.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql.=" AND c.fk_statut = 1";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql.= " ORDER BY c.tms DESC, c.ref DESC ";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php
index 02ed249d3b6..c4259b6252a 100644
--- a/htdocs/core/boxes/box_comptes.php
+++ b/htdocs/core/boxes/box_comptes.php
@@ -64,7 +64,7 @@ class box_comptes extends ModeleBoxes
// disable module for such cases
$listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
- if (! in_array('banque', $listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
+ if (! in_array('banque', $listofmodulesforexternal) && ! empty($user->socid)) $this->enabled=0; // disabled for external users
$this->hidden = ! ($user->rights->banque->lire);
}
diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php
index 09e33c5f6a8..5bdb17ba0b9 100644
--- a/htdocs/core/boxes/box_contacts.php
+++ b/htdocs/core/boxes/box_contacts.php
@@ -90,10 +90,10 @@ class box_contacts extends ModeleBoxes
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON sp.fk_pays = co.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
- if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
- if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id;
+ if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) $sql.= " AND sp.fk_soc = ".$user->socid;
$sql.= " ORDER BY sp.tms DESC";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php
index 0d155f158e9..37fdf45f118 100644
--- a/htdocs/core/boxes/box_contracts.php
+++ b/htdocs/core/boxes/box_contracts.php
@@ -87,11 +87,11 @@ class box_contracts extends ModeleBoxes
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
$sql.= ", c.ref_customer, c.ref_supplier";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_contrat DESC, c.ref DESC ";
else $sql.= " ORDER BY c.tms DESC, c.ref DESC ";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php
index 09841f4a4a8..65724f5fa4b 100644
--- a/htdocs/core/boxes/box_factures.php
+++ b/htdocs/core/boxes/box_factures.php
@@ -97,12 +97,12 @@ class box_factures extends ModeleBoxes
$sql.= ", s.rowid as socid, s.nom as name, s.code_client, s.email, s.tva_intra, s.code_compta, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
$sql.= ", f.date_lim_reglement as datelimite";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.ref DESC ";
else $sql.= " ORDER BY f.tms DESC, f.ref DESC ";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php
index 46e2da3ab62..9eb836fe1e2 100644
--- a/htdocs/core/boxes/box_factures_fourn.php
+++ b/htdocs/core/boxes/box_factures_fourn.php
@@ -99,11 +99,11 @@ class box_factures_fourn extends ModeleBoxes
$sql.= ' f.date_lim_reglement as datelimite, f.tms, f.type';
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.ref DESC ";
else $sql.= " ORDER BY f.tms DESC, f.ref DESC ";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php
index 0a6c7e904a3..3c0fc6444a2 100644
--- a/htdocs/core/boxes/box_factures_fourn_imp.php
+++ b/htdocs/core/boxes/box_factures_fourn_imp.php
@@ -91,13 +91,13 @@ class box_factures_fourn_imp extends ModeleBoxes
$sql.= " f.paye, f.fk_statut, f.type";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ",".MAIN_DB_PREFIX."facture_fourn as f";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.paye=0";
$sql.= " AND fk_statut = 1";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " ORDER BY datelimite DESC, f.ref_supplier DESC ";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php
index 3c4ba1c9736..992e1333390 100644
--- a/htdocs/core/boxes/box_factures_imp.php
+++ b/htdocs/core/boxes/box_factures_imp.php
@@ -100,15 +100,15 @@ class box_factures_imp extends ModeleBoxes
$sql.= " f.paye, f.fk_statut, f.rowid as facid";
$sql.= ", sum(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
$sql.= " AND f.paye = 0";
$sql.= " AND fk_statut = 1";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php
index a646d6556ba..b0851ed28c0 100644
--- a/htdocs/core/boxes/box_ficheinter.php
+++ b/htdocs/core/boxes/box_ficheinter.php
@@ -92,8 +92,8 @@ class box_ficheinter extends ModeleBoxes
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
$sql.= " WHERE f.fk_soc = s.rowid ";
$sql.= " AND f.entity = ".$conf->entity;
- if (! $user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (! $user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " ORDER BY f.tms DESC";
$sql.= $this->db->plimit($max, 0);
@@ -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_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php
index 6369b25987a..5f26351affe 100644
--- a/htdocs/core/boxes/box_fournisseurs.php
+++ b/htdocs/core/boxes/box_fournisseurs.php
@@ -88,11 +88,11 @@ class box_fournisseurs extends ModeleBoxes
$sql.= " s.code_fournisseur, s.email as semail,";
$sql.= " s.logo";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fournisseur = 1";
$sql.= " AND s.entity IN (".getEntity('societe').")";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " ORDER BY s.tms DESC ";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php
index ba0e24ddaab..91ec36fd500 100644
--- a/htdocs/core/boxes/box_graph_invoices_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_permonth.php
@@ -92,7 +92,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
$dir=''; // We don't need a path because image file will not be saved into disk
$prefix='';
$socid=0;
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
if ($user->rights->facture->lire)
@@ -135,7 +135,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
- if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
+ // default value for customer mode
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
$px1 = new DolGraph();
@@ -180,7 +181,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
- if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png';
+ // default value for customer mode
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$endyear.'.png';
$px2 = new DolGraph();
diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
index 4393e9db790..9be3a986fa9 100644
--- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
@@ -91,7 +91,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$dir=''; // We don't need a path because image file will not be saved into disk
$prefix='';
$socid=0;
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
if ($user->rights->fournisseur->facture->lire)
@@ -132,7 +132,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
- if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
+ // default value for customer mode
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$year.'.png';
$px1 = new DolGraph();
@@ -143,7 +144,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$px1->SetData($data1);
unset($data1);
- $i=$startyear;$legend=array();
+ $i=$startyear;
+ $legend=array();
while ($i <= $endyear)
{
if ($startmonth != 1)
@@ -177,7 +179,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
- if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png';
+ // default value for customer mode
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$year.'.png';
$px2 = new DolGraph();
diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php
index 6e5bf253832..5ea1bb9f764 100644
--- a/htdocs/core/boxes/box_graph_orders_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_permonth.php
@@ -92,7 +92,7 @@ class box_graph_orders_permonth extends ModeleBoxes
$dir=''; // We don't need a path because image file will not be saved into disk
$prefix='';
$socid=0;
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
if ($user->rights->commande->lire)
@@ -135,7 +135,8 @@ class box_graph_orders_permonth extends ModeleBoxes
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
- if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png';
+ // default value for customer mode
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$endyear.'.png';
$px1 = new DolGraph();
@@ -144,7 +145,8 @@ class box_graph_orders_permonth extends ModeleBoxes
{
$px1->SetData($data1);
unset($data1);
- $i=$startyear;$legend=array();
+ $i=$startyear;
+ $legend=array();
while ($i <= $endyear)
{
if ($startmonth != 1)
@@ -178,7 +180,8 @@ class box_graph_orders_permonth extends ModeleBoxes
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
- if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png';
+ // default value for customer mode
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$endyear.'.png';
$px2 = new DolGraph();
diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
index 443f374346d..fba42b42eba 100644
--- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
@@ -91,7 +91,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$dir=''; // We don't need a path because image file will not be saved into disk
$prefix='';
$socid=0;
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
if ($user->rights->fournisseur->commande->lire)
@@ -134,7 +134,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
- if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png';
+ // default value for customer mode
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssuppliernbinyear-'.$endyear.'.png';
$px1 = new DolGraph();
@@ -143,7 +144,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
{
$px1->SetData($data1);
unset($data1);
- $i=$startyear;$legend=array();
+ $i=$startyear;
+ $legend=array();
while ($i <= $endyear)
{
if ($startmonth != 1)
@@ -177,7 +179,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
- if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png';
+ // default value for customer mode
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssupplieramountinyear-'.$endyear.'.png';
$px2 = new DolGraph();
diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php
index 332f92b7ace..7bcc85aa47f 100644
--- a/htdocs/core/boxes/box_graph_product_distribution.php
+++ b/htdocs/core/boxes/box_graph_product_distribution.php
@@ -128,7 +128,7 @@ class box_graph_product_distribution extends ModeleBoxes
);
- $socid=empty($user->societe_id)?0:$user->societe_id;
+ $socid=empty($user->socid)?0:$user->socid;
$userid=0; // No filter on user creation
$WIDTH=($nbofgraph >= 2 || ! empty($conf->dol_optimize_smallscreen))?'160':'320';
diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php
index a06c5d8ff83..150e9517c8a 100644
--- a/htdocs/core/boxes/box_graph_propales_permonth.php
+++ b/htdocs/core/boxes/box_graph_propales_permonth.php
@@ -94,7 +94,7 @@ class box_graph_propales_permonth extends ModeleBoxes
$dir=''; // We don't need a path because image file will not be saved into disk
$prefix='';
$socid=0;
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
if ($user->rights->propale->lire)
diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php
index 56299c60429..de2bbd79181 100644
--- a/htdocs/core/boxes/box_last_modified_ticket.php
+++ b/htdocs/core/boxes/box_last_modified_ticket.php
@@ -96,9 +96,9 @@ class box_last_modified_ticket extends ModeleBoxes
$sql.= " WHERE t.entity = ".$conf->entity;
// $sql.= " AND e.rowid = er.fk_event";
- //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) {
- $sql.= " AND t.fk_soc= ".$user->societe_id;
+ //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) {
+ $sql.= " AND t.fk_soc= ".$user->socid;
}
$sql.= " ORDER BY t.tms DESC, t.rowid DESC ";
diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php
index cf4b7f305f7..4c66c647477 100644
--- a/htdocs/core/boxes/box_last_ticket.php
+++ b/htdocs/core/boxes/box_last_ticket.php
@@ -96,9 +96,9 @@ class box_last_ticket extends ModeleBoxes
$sql .= " WHERE t.entity = " . $conf->entity;
// $sql.= " AND e.rowid = er.fk_event";
- //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) {
- $sql .= " AND t.fk_soc= " . $user->societe_id;
+ //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) {
+ $sql .= " AND t.fk_soc= " . $user->socid;
}
//$sql.= " AND t.fk_statut > 9";
diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php
index 1e4588f05cf..29f37751ce9 100644
--- a/htdocs/core/boxes/box_members.php
+++ b/htdocs/core/boxes/box_members.php
@@ -63,7 +63,7 @@ class box_members extends ModeleBoxes
// disable module for such cases
$listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
- if (! in_array('adherent', $listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
+ if (! in_array('adherent', $listofmodulesforexternal) && ! empty($user->socid)) $this->enabled=0; // disabled for external users
$this->hidden = ! ($user->rights->adherent->lire);
}
diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php
index 23c4cc368cf..5cccd24ad6a 100644
--- a/htdocs/core/boxes/box_produits.php
+++ b/htdocs/core/boxes/box_produits.php
@@ -63,7 +63,7 @@ class box_produits extends ModeleBoxes
$listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tmpentry=array('enabled'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'perms'=>(! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)), 'module'=>'product|service');
- $showmode=isVisibleToUserType(($user->societe_id > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
+ $showmode=isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden = ($showmode != 1);
}
diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php
index 22509a6c9a2..3c674cd32c0 100644
--- a/htdocs/core/boxes/box_produits_alerte_stock.php
+++ b/htdocs/core/boxes/box_produits_alerte_stock.php
@@ -65,7 +65,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tmpentry=array('enabled'=>((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && ! empty($conf->stock->enabled)), 'perms'=>($user->rights->stock->lire), 'module'=>'product|service|stock');
- $showmode=isVisibleToUserType(($user->societe_id > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
+ $showmode=isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden = ($showmode != 1);
}
diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php
index 9053e5f2ab3..48a6d260e2c 100644
--- a/htdocs/core/boxes/box_project.php
+++ b/htdocs/core/boxes/box_project.php
@@ -89,7 +89,7 @@ class box_project extends ModeleBoxes
$projectstatic = new Project($this->db);
$socid=0;
- //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+ //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId='';
diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php
index 0ba1b1565f8..1fe8c2a0ed8 100644
--- a/htdocs/core/boxes/box_propales.php
+++ b/htdocs/core/boxes/box_propales.php
@@ -88,11 +88,11 @@ class box_propales extends ModeleBoxes
$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.fk_soc = s.rowid";
$sql.= " AND p.entity = ".$conf->entity;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC ";
else $sql.= " ORDER BY p.tms DESC, p.ref DESC ";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php
index b489247e0b1..9d6a10b6225 100644
--- a/htdocs/core/boxes/box_prospect.php
+++ b/htdocs/core/boxes/box_prospect.php
@@ -94,11 +94,11 @@ class box_prospect extends ModeleBoxes
$sql.= ", s.logo";
$sql.= ", s.fk_stcomm, s.datec, s.tms, s.status";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (2, 3)";
$sql.= " AND s.entity IN (".getEntity('societe').")";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " ORDER BY s.tms DESC";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php
index f080403aba3..dbb26408b6f 100644
--- a/htdocs/core/boxes/box_services_contracts.php
+++ b/htdocs/core/boxes/box_services_contracts.php
@@ -96,10 +96,10 @@ class box_services_contracts extends ModeleBoxes
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= ")";
$sql.= " WHERE c.entity = ".$conf->entity;
- if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= $this->db->order("c.tms", "DESC");
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php
index b56674adaa0..9ddfa229e55 100644
--- a/htdocs/core/boxes/box_services_expired.php
+++ b/htdocs/core/boxes/box_services_expired.php
@@ -87,12 +87,12 @@ class box_services_expired extends ModeleBoxes
$sql.= " s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$this->db->idate($now)."'";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
- if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) $sql.=' AND c.fk_soc = '.$user->socid;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid";
$sql.= " ORDER BY date_line ASC";
$sql.= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php
index 42c1b7464b9..a95c008688b 100644
--- a/htdocs/core/boxes/box_supplier_orders.php
+++ b/htdocs/core/boxes/box_supplier_orders.php
@@ -93,11 +93,11 @@ class box_supplier_orders extends ModeleBoxes
$sql.= " c.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql.= " ORDER BY c.tms DESC, c.ref DESC ";
$sql.= $this->db->plimit($max, 0);
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/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php
index 8cc8de94295..f5399cd9eea 100644
--- a/htdocs/core/boxes/modules_boxes.php
+++ b/htdocs/core/boxes/modules_boxes.php
@@ -216,7 +216,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
$cachetime = 900; // 900 : 15mn
$cachedir = DOL_DATA_ROOT.'/boxes/temp';
- $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache';
+ $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'.cache';
$filename = '/box-'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$out = '';
diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php
index 3f4b486f547..18c20b0b07c 100644
--- a/htdocs/core/class/comment.class.php
+++ b/htdocs/core/class/comment.class.php
@@ -62,6 +62,11 @@ class Comment extends CommonObject
*/
public $fk_user_author;
+ /**
+ * @var int ID
+ */
+ public $fk_user_modif;
+
/**
* @var int Entity
*/
@@ -94,17 +99,18 @@ class Comment extends CommonObject
*/
public function create($user, $notrigger = 0)
{
- global $conf, $langs;
+ global $user;
$error=0;
// Insert request
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."comment (";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." (";
$sql.= "description";
$sql.= ", datec";
$sql.= ", fk_element";
$sql.= ", element_type";
$sql.= ", fk_user_author";
+ $sql.= ", fk_user_modif";
$sql.= ", entity";
$sql.= ", import_key";
$sql.= ") VALUES (";
@@ -113,6 +119,7 @@ class Comment extends CommonObject
$sql.= ", '".(isset($this->fk_element)?$this->fk_element:"null")."'";
$sql.= ", '".$this->db->escape($this->element_type)."'";
$sql.= ", '".(isset($this->fk_user_author)?$this->fk_user_author:"null")."'";
+ $sql.= ", ".$user->id."";
$sql.= ", ".(!empty($this->entity)?$this->entity:'1');
$sql.= ", ".(!empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
$sql.= ")";
@@ -128,7 +135,7 @@ class Comment extends CommonObject
if (! $error)
{
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_comment");
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
if (! $notrigger)
{
@@ -177,9 +184,10 @@ class Comment extends CommonObject
$sql.= " c.fk_element,";
$sql.= " c.element_type,";
$sql.= " c.fk_user_author,";
+ $sql.= " c.fk_user_modif,";
$sql.= " c.entity,";
$sql.= " c.import_key";
- $sql.= " FROM ".MAIN_DB_PREFIX."comment as c";
+ $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c";
$sql.= " WHERE c.rowid = ".$id;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@@ -196,8 +204,9 @@ class Comment extends CommonObject
$this->description = $obj->description;
$this->element_type = $obj->element_type;
$this->datec = $this->db->jdate($obj->datec);
- $this->tms = $obj->tms;
+ $this->tms = $this->db->jdate($obj->tms);
$this->fk_user_author = $obj->fk_user_author;
+ $this->fk_user_modif = $obj->fk_user_modif;
$this->fk_element = $obj->fk_element;
$this->entity = $obj->entity;
$this->import_key = $obj->import_key;
@@ -225,22 +234,21 @@ class Comment extends CommonObject
*/
public function update(User $user, $notrigger = 0)
{
- global $conf, $langs;
+ global $user;
$error=0;
// Clean parameters
if (isset($this->fk_element)) $this->fk_project=(int) trim($this->fk_element);
- if (isset($this->fk_user_author)) $this->fk_user_author=(int) trim($this->fk_user_author);
if (isset($this->description)) $this->description=trim($this->description);
// Update request
- $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_comment SET";
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
$sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").",";
$sql.= " datec=".($this->datec!=''?"'".$this->db->idate($this->datec)."'":'null').",";
$sql.= " fk_element=".(isset($this->fk_element)?$this->fk_element:"null").",";
$sql.= " element_type='".$this->db->escape($this->element_type)."',";
- $sql.= " fk_user_author=".(isset($this->fk_user_author)?$this->fk_user_author:"null").",";
+ $sql.= " fk_user_modif=".$user->id.",";
$sql.= " entity=".(!empty($this->entity)?$this->entity:'1').",";
$sql.= " import_key=".(!empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
$sql.= " WHERE rowid=".$this->id;
@@ -297,7 +305,7 @@ class Comment extends CommonObject
$this->db->begin();
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."comment";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE rowid=".$this->id;
$resql = $this->db->query($sql);
@@ -345,7 +353,7 @@ class Comment extends CommonObject
if(!empty($element_type) && !empty($fk_element)) {
$sql = "SELECT";
$sql.= " c.rowid";
- $sql.= " FROM ".MAIN_DB_PREFIX."comment as c";
+ $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c";
$sql.= " WHERE c.fk_element = ".$fk_element;
$sql.= " AND c.element_type = '".$db->escape($element_type)."'";
$sql.= " AND c.entity = ".$conf->entity;
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 20889e1a742..6a9bc0c9f29 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -585,7 +585,7 @@ abstract class CommonDocGenerator
{
$resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long'));
$resarray['line_unit_short']=$outputlangs->trans($line->getLabelOfUnit('short'));
- }
+ }
// Retrieve extrafields
$extrafieldkey=$line->element;
@@ -595,7 +595,30 @@ abstract class CommonDocGenerator
$extrafields->fetch_name_optionals_label($extrafieldkey, true);
$line->fetch_optionals();
- $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
+ $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
+
+ // Check if the current line belongs to a supplier order
+ if (get_class($line) == 'CommandeFournisseurLigne')
+ {
+ // Add the product supplier extrafields to the substitutions
+ $extrafields->fetch_name_optionals_label("product_fournisseur_price");
+ $extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
+ $columns = "";
+ foreach ($extralabels as $key => $value)
+ $columns .= "$key, ";
+
+ if ($columns != "")
+ {
+ $columns = substr($columns, 0, strlen($columns) - 2);
+ $resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_supplier . "'");
+ if ($this->db->num_rows($resql) > 0) {
+ $resql = $this->db->fetch_object($resql);
+
+ foreach ($extralabels as $key => $value)
+ $resarray['line_product_supplier_'.$key] = $resql->{$key};
+ }
+ }
+ }
// Load product data optional fields to the line -> enables to use "line_options_{extrafield}"
if (isset($line->fk_product) && $line->fk_product > 0)
@@ -820,7 +843,7 @@ abstract class CommonDocGenerator
$id = $object->array_options['options_'.$key];
if ($id != "")
{
- $param = $extrafields->attribute_param[$key];
+ $param = $extrafields->attributes[$object->table_element]['param'][$key];
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
$InfoFieldList = explode(":", $param_list[0]);
$classname=$InfoFieldList[0];
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index ec27b83e0a0..b6381ccc7ca 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -496,27 +496,27 @@ abstract class CommonInvoice extends CommonObject
$prefix='Short';
if (! $paye){
if ($status == 0) {
- $labelstatut = $langs->trans('BillStatusDraft');
- $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusDraft');
+ $labelStatus = $langs->trans('BillStatusDraft');
+ $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusDraft');
}
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
- $labelstatut = $langs->trans('BillStatusClosedUnpaid');
- $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
+ $labelStatus = $langs->trans('BillStatusClosedUnpaid');
+ $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
$statusType='status5';
}
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
- $labelstatut = $langs->trans('BillStatusClosedPaidPartially');
- $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
+ $labelStatus = $langs->trans('BillStatusClosedPaidPartially');
+ $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
$statusType='status9';
}
elseif ($alreadypaid <= 0) {
- $labelstatut = $langs->trans('BillStatusNotPaid');
- $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusNotPaid');
+ $labelStatus = $langs->trans('BillStatusNotPaid');
+ $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusNotPaid');
$statusType='status1';
}
else {
- $labelstatut = $langs->trans('BillStatusStarted');
- $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusStarted');
+ $labelStatus = $langs->trans('BillStatusStarted');
+ $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusStarted');
$statusType='status3';
}
}
@@ -525,20 +525,20 @@ abstract class CommonInvoice extends CommonObject
$statusType='status6';
if ($type == self::TYPE_CREDIT_NOTE){
- $labelstatut = $langs->trans('BillStatusPaidBackOrConverted'); // credit note
- $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
+ $labelStatus = $langs->trans('BillStatusPaidBackOrConverted'); // credit note
+ $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
}
elseif ($type == self::TYPE_DEPOSIT){
- $labelstatut = $langs->trans('BillStatusConverted'); // deposit invoice
- $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice
+ $labelStatus = $langs->trans('BillStatusConverted'); // deposit invoice
+ $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice
}
else{
- $labelstatut = $langs->trans('BillStatusPaid');
- $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaid');
+ $labelStatus = $langs->trans('BillStatusPaid');
+ $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusPaid');
}
}
- return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
+ return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 6adbba4366a..0cfe1958f03 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -421,7 +421,12 @@ abstract class CommonObject
public $civility_id;
// Dates
- public $date_creation; // Date creation
+ /**
+ * @var integer|string date_creation
+ */
+ public $date_creation;
+
+
public $date_validation; // Date validation
public $date_modification; // Date last change (tms field)
@@ -1064,13 +1069,13 @@ abstract class CommonObject
/**
* Get array of all contacts for an object
*
- * @param int $statut Status of links to get (-1=all)
+ * @param int $status Status of links to get (-1=all)
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param int $list 0:Return array contains all properties, 1:Return array contains just id
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
* @return array|int Array of contacts, -1 if error
*/
- public function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '')
+ public function liste_contact($status = -1, $source = 'external', $list = 0, $code = '')
{
// phpcs:enable
global $langs;
@@ -1093,7 +1098,7 @@ abstract class CommonObject
if ($source == 'internal') $sql.= " AND tc.source = 'internal'";
if ($source == 'external' || $source == 'thirdparty') $sql.= " AND tc.source = 'external'";
$sql.= " AND tc.active=1";
- if ($statut >= 0) $sql.= " AND ec.statut = '".$statut."'";
+ if ($status >= 0) $sql.= " AND ec.statut = ".$status;
$sql.=" ORDER BY t.lastname ASC";
dol_syslog(get_class($this)."::liste_contact", LOG_DEBUG);
@@ -1748,7 +1753,7 @@ abstract class CommonObject
// Security on socid
$socid = 0;
- if ($user->societe_id > 0) $socid = $user->societe_id;
+ if ($user->socid > 0) $socid = $user->socid;
// this->ismultientitymanaged contains
// 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@@ -5631,7 +5636,7 @@ abstract class CommonObject
{
$morecss = 'minwidth100imp';
}
- elseif ($type == 'datetime')
+ elseif ($type == 'datetime' || $type == 'link')
{
$morecss = 'minwidth200imp';
}
@@ -6100,7 +6105,7 @@ abstract class CommonObject
$param_list_array = explode(':', $param_list[0]);
$showempty=(($required && $default != '')?0:1);
- $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', '', '', 0, empty($val['disabled'])?0:1);
+ $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, empty($val['disabled'])?0:1);
if (! empty($param_list_array[2])) // If we set to add a create button
{
diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php
index 61f02e0fa83..ef529f39d9a 100644
--- a/htdocs/core/class/dolreceiptprinter.class.php
+++ b/htdocs/core/class/dolreceiptprinter.class.php
@@ -1,6 +1,5 @@
+/* Copyright (C) 2015-2018 Frédéric France
*
* 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
diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php
index 155050c6997..c4af5773885 100644
--- a/htdocs/core/class/emailsenderprofile.class.php
+++ b/htdocs/core/class/emailsenderprofile.class.php
@@ -105,7 +105,13 @@ class EmailSenderProfile extends CommonObject
public $label;
public $email;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $tms;
//public $fk_user_creat;
//public $fk_user_modif;
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 6807e75ba80..83734acd36e 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1029,7 +1029,7 @@ class ExtraFields
{
$morecss = 'minwidth100imp';
}
- elseif ($type == 'datetime')
+ elseif ($type == 'datetime' || $type == 'link')
{
$morecss = 'minwidth200imp';
}
@@ -1586,7 +1586,7 @@ class ExtraFields
* @param string $key Key of attribute
* @param string $value Value to show
* @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
- * @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data
+ * @param string $extrafieldsobjectkey If defined (for example $object->table_element), function uses the new method to get extrafields data
* @return string Formated value
*/
public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '')
@@ -1611,6 +1611,7 @@ class ExtraFields
}
else // Old usage
{
+ //dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING);
$label=$this->attribute_label[$key];
$type=$this->attribute_type[$key];
$size=$this->attribute_size[$key];
diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php
index f944ccdc0c0..0eed1a56580 100644
--- a/htdocs/core/class/fiscalyear.class.php
+++ b/htdocs/core/class/fiscalyear.class.php
@@ -290,42 +290,42 @@ class Fiscalyear extends CommonObject
/**
* Give a label from a status
*
- * @param int $statut Id status
+ * @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
* @return string Label
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
if ($mode == 0)
{
- return $langs->trans($this->statuts[$statut]);
+ return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 1)
{
- return $langs->trans($this->statuts_short[$statut]);
+ return $langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 2)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8').' '.$langs->trans($this->statuts_short[$statut]);
+ if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 3)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8');
+ if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8');
}
elseif ($mode == 4)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]);
+ if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]);
}
elseif ($mode == 5)
{
- if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
- elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
+ if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
+ elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
}
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 7f1c2cbee50..0aca6a94213 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1651,7 +1651,7 @@ class Form
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
}
}
- if (! empty($user->societe_id)) $sql.= " AND u.fk_soc = ".$user->societe_id;
+ if (! empty($user->socid)) $sql.= " AND u.fk_soc = ".$user->socid;
if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN (".$excludeUsers.")";
if ($includeUsers) $sql.= " AND u.rowid IN (".$includeUsers.")";
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0";
@@ -3765,7 +3765,7 @@ class Form
*
* @param string $selected Id account pre-selected
* @param string $htmlname Name of select zone
- * @param int $statut Status of searched accounts (0=open, 1=closed, 2=both)
+ * @param int $status Status of searched accounts (0=open, 1=closed, 2=both)
* @param string $filtre To filter list
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib To add more attribute on select
@@ -3773,7 +3773,7 @@ class Form
* @param string $morecss More CSS
* @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...)
*/
- public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '')
+ public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '')
{
// phpcs:enable
global $langs, $conf;
@@ -3784,7 +3784,7 @@ class Form
$sql = "SELECT rowid, label, bank, clos as status, currency_code";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE entity IN (".getEntity('bank_account').")";
- if ($statut != 2) $sql.= " AND clos = '".$statut."'";
+ if ($status != 2) $sql.= " AND clos = ".(int) $status;
if ($filtre) $sql.=" AND ".$filtre;
$sql.= " ORDER BY label";
@@ -3815,7 +3815,7 @@ class Form
}
print trim($obj->label);
if ($showcurrency) print ' ('.$obj->currency_code.')';
- if ($statut == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
+ if ($status == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
print '';
$i++;
}
@@ -3823,7 +3823,7 @@ class Form
}
else
{
- if ($statut == 0) print ''.$langs->trans("NoActiveBankAccountDefined").' ';
+ if ($status == 0) print ''.$langs->trans("NoActiveBankAccountDefined").' ';
else print ''.$langs->trans("NoBankAccountFound").' ';
}
}
@@ -3839,13 +3839,13 @@ class Form
*
* @param string $selected Id establishment pre-selected
* @param string $htmlname Name of select zone
- * @param int $statut Status of searched establishment (0=open, 1=closed, 2=both)
+ * @param int $status Status of searched establishment (0=open, 1=closed, 2=both)
* @param string $filtre To filter list
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib To add more attribute on select
* @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...)
*/
- public function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '')
+ public function selectEstablishments($selected = '', $htmlname = 'entity', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '')
{
// phpcs:enable
global $langs, $conf;
@@ -3856,7 +3856,7 @@ class Form
$sql = "SELECT rowid, name, fk_country, status, entity";
$sql.= " FROM ".MAIN_DB_PREFIX."establishment";
$sql.= " WHERE 1=1";
- if ($statut != 2) $sql.= " AND status = '".$statut."'";
+ if ($status != 2) $sql.= " AND status = ".(int) $status;
if ($filtre) $sql.=" AND ".$filtre;
$sql.= " ORDER BY name";
@@ -3886,7 +3886,7 @@ class Form
print '';
}
print trim($obj->name);
- if ($statut == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
+ if ($status == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
print ' ';
$i++;
}
@@ -3894,7 +3894,7 @@ class Form
}
else
{
- if ($statut == 0) print ''.$langs->trans("NoActiveEstablishmentDefined").' ';
+ if ($status == 0) print ''.$langs->trans("NoActiveEstablishmentDefined").' ';
else print ''.$langs->trans("NoEstablishmentFound").' ';
}
}
@@ -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.
@@ -5336,13 +5344,14 @@ class Form
* @param int $disabled Disable input fields
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
- * @param datetime $adddateof Add a link "Date of invoice" using the following date.
- * @param string $openinghours Specify hour strat and hour end for the select ex 8,20
+ * @param datetime $adddateof Add a link "Date of invoice" using the following date. See also $labeladddateof for the label used.
+ * @param string $openinghours Specify hour start and hour end for the select ex 8,20
* @param int $stepminutes Specify step for minutes between 1 and 30
+ * @param string $labeladddateof Label to use for the $adddateof parameter.
* @return string Html for selectDate
* @see form_date(), select_month(), select_year(), select_dayofweek()
*/
- public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1)
+ public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '')
{
global $conf,$langs;
@@ -5729,7 +5738,8 @@ class Form
if ($conf->use_javascript_ajax && $adddateof)
{
$tmparray=dol_getdate($adddateof);
- $retstring.=' -
'.$langs->trans("DateInvoice").'';
+ if (empty($labeladddateof)) $labeladddateof = $langs->trans("DateInvoice");
+ $retstring.=' - '.$labeladddateof.'';
}
return $retstring;
@@ -5857,7 +5867,12 @@ class Form
if ($classname && class_exists($classname))
{
$objecttmp = new $classname($this->db);
- $objecttmp->filter = $filter;
+ // Make some replacement
+ $sharedentities = getEntity(strtolower($classname));
+ $objecttmp->filter = str_replace(
+ array('__ENTITY__', '__SHARED_ENTITIES__', '__USER_ID__'),
+ array($conf->entity, $sharedentities, $user->id),
+ $filter);
}
}
if (! is_object($objecttmp))
@@ -5866,6 +5881,7 @@ class Form
return 'Error bad setup of type for field '.join(',', $InfoFieldList);
}
+ //var_dump($objecttmp->filter);
$prefixforautocompletemode=$objecttmp->element;
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index d231dacab87..22acff7763d 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -688,7 +688,7 @@ class FormFile
}
else
{
- dol_print_error($this->db, 'Bad value for modulepart');
+ dol_print_error($this->db, "Bad value for modulepart '".$modulepart."' in showdocuments");
return -1;
}
}
diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php
index 25a46090b1d..613992bdd2a 100644
--- a/htdocs/core/class/html.formmargin.class.php
+++ b/htdocs/core/class/html.formmargin.class.php
@@ -195,7 +195,7 @@ class FormMargin
{
global $langs, $conf, $user;
- if (! empty($user->societe_id)) return;
+ if (! empty($user->socid)) return;
if (! $user->rights->margins->liretous) return;
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/get_menudiv.php b/htdocs/core/get_menudiv.php
index 1fe50a963b4..edebf8a31b4 100644
--- a/htdocs/core/get_menudiv.php
+++ b/htdocs/core/get_menudiv.php
@@ -174,7 +174,7 @@ $(document).ready(function(){
';
-if (empty($user->societe_id)) // If internal user or not defined
+if (empty($user->socid)) // If internal user or not defined
{
$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
}
@@ -202,7 +202,7 @@ if (! class_exists('MenuManager'))
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
}
}
-$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
+$menumanager = new MenuManager($db, empty($user->socid)?0:1);
$menumanager->loadMenu('all', 'all'); // Load this->tabMenu with sql menu entries
//var_dump($menumanager);exit;
$menumanager->showmenu('jmobile');
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 708cb60d696..9320d25d704 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -268,7 +268,7 @@ function societe_prepare_head(Societe $object)
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'thirdparty');
- if ($user->societe_id == 0)
+ if ($user->socid == 0)
{
// Notifications
if (! empty($conf->notification->enabled))
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 a00c8d73d97..11fbf512ab1 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1122,13 +1122,20 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
{
global $conf, $langs, $hookmanager;
- $out="\n".''."\n";
-
- if ($morehtmlright) $out.='
'.$morehtmlright.'
'; // Output right area first so when space is missing, text is in front of tabs and not under.
-
// Show title
$showtitle=1;
if (! empty($conf->dol_optimize_smallscreen)) $showtitle=0;
+
+ $out = "\n".'';
+
+ if ((! empty($title) && $showtitle) || $morehtmlright || ! empty($links)) {
+ $out.= '
'."\n";
+ }
+
+ // Show right part
+ if ($morehtmlright) $out.='
'.$morehtmlright.'
'; // Output right area first so when space is missing, text is in front of tabs and not under.
+
+ // Show title
if (! empty($title) && $showtitle)
{
$limittitle=30;
@@ -1138,6 +1145,8 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out.='';
}
+ // Show tabs
+
// Define max of key (max may be higher than sizeof because of hole due to module disabling some tabs).
$maxkey=-1;
if (is_array($links) && ! empty($links))
@@ -1149,16 +1158,15 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
if (! empty($conf->dol_optimize_smallscreen)) $conf->global->MAIN_MAXTABS_IN_CARD=2;
// Show tabs
- $bactive=false;
// if =0 we don't use the feature
$limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD);
$displaytab=0;
$nbintab=0;
- $popuptab=0; $outmore='';
+ $popuptab=0;
+ $outmore='';
for ($i = 0 ; $i <= $maxkey ; $i++)
{
- if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2]))
- {
+ if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) {
// If active tab is already present
if ($i >= $limittoshow) $limittoshow--;
}
@@ -1166,13 +1174,10 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
for ($i = 0 ; $i <= $maxkey ; $i++)
{
- if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2]))
- {
+ if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) {
$isactive=true;
- $bactive=true;
}
- else
- {
+ else {
$isactive=false;
}
@@ -1258,7 +1263,9 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out.="";
}
- $out.="
\n";
+ if ((! empty($title) && $showtitle) || $morehtmlright || ! empty($links)) {
+ $out.="
\n";
+ }
if (! $notab || $notab == -1 || $notab == -2) $out.="\n".''."\n";
@@ -1984,56 +1991,48 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $
if ($second< 0 || $second > 60) return '';
}
- if (method_exists('DateTime', 'getTimestamp'))
+ if (empty($gm) || $gm === 'server')
{
- if (empty($gm) || $gm === 'server')
- {
- $default_timezone=@date_default_timezone_get(); // Example 'Europe/Berlin'
+ $default_timezone=@date_default_timezone_get(); // Example 'Europe/Berlin'
+ $localtz = new DateTimeZone($default_timezone);
+ }
+ elseif ($gm === 'user')
+ {
+ // We use dol_tz_string first because it is more reliable.
+ $default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); // Example 'Europe/Berlin'
+ try {
$localtz = new DateTimeZone($default_timezone);
}
- elseif ($gm === 'user')
+ catch(Exception $e)
{
- // We use dol_tz_string first because it is more reliable.
- $default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); // Example 'Europe/Berlin'
- try {
- $localtz = new DateTimeZone($default_timezone);
- }
- catch(Exception $e)
- {
- dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING);
- $default_timezone=@date_default_timezone_get();
- }
+ dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING);
+ $default_timezone=@date_default_timezone_get();
}
- elseif (strrpos($gm, "tz,") !== false)
- {
- $timezone=str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin'
- try
- {
- $localtz = new DateTimeZone($timezone);
- }
- catch(Exception $e)
- {
- dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING);
- }
- }
-
- if (empty($localtz)) {
- $localtz = new DateTimeZone('UTC');
- }
- //var_dump($localtz);
- //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute);
- $dt = new DateTime(null, $localtz);
- $dt->setDate((int) $year, (int) $month, (int) $day);
- $dt->setTime((int) $hour, (int) $minute, (int) $second);
- $date=$dt->getTimestamp(); // should include daylight saving time
- //var_dump($date);
- return $date;
}
- else
+ elseif (strrpos($gm, "tz,") !== false)
{
- dol_print_error('', 'PHP version must be 5.4+');
- return '';
+ $timezone=str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin'
+ try
+ {
+ $localtz = new DateTimeZone($timezone);
+ }
+ catch(Exception $e)
+ {
+ dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING);
+ }
}
+
+ if (empty($localtz)) {
+ $localtz = new DateTimeZone('UTC');
+ }
+ //var_dump($localtz);
+ //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute);
+ $dt = new DateTime(null, $localtz);
+ $dt->setDate((int) $year, (int) $month, (int) $day);
+ $dt->setTime((int) $hour, (int) $minute, (int) $second);
+ $date=$dt->getTimestamp(); // should include daylight saving time
+ //var_dump($date);
+ return $date;
}
@@ -3024,7 +3023,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
* @param string $alt Force alt for bind people
* @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty.
- * @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left maring on picto, 0 = No margin left. Works for fontawesome picto only.
+ * @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only.
* @return string Return img tag
* @see img_object(), img_picto_common()
*/
@@ -3055,7 +3054,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',
@@ -3086,12 +3086,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') {
@@ -8116,25 +8114,24 @@ function roundUpToNextMultiple($n, $x = 5)
* @param string $type type of badge : Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9
* @param string $mode default '' , pill, dot
* @param string $url the url for link
- * @param array $params various params for future : recommended rather than adding more fuction arguments
+ * @param array $params various params for future : recommended rather than adding more fuction arguments. array('attr'=>array('title'=>'abc'))
* @return string Html badge
*/
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
{
$attr=array(
- 'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'')
+ 'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'').(empty($params['css'])?'':' '.$params['css'])
);
- if(empty($html)){
+ if (empty($html)) {
$html = $label;
}
- if(!empty($url)){
+ if (!empty($url)) {
$attr['href'] = $url;
}
- if($mode==='dot')
- {
+ if ($mode==='dot') {
$attr['class'].= ' classfortooltip';
$attr['title'] = $html;
$attr['aria-label'] = $label;
@@ -8142,8 +8139,8 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
}
// Override attr
- if(!empty($params['attr']) && is_array($params['attr'])){
- foreach($params['attr']as $key => $value){
+ if (!empty($params['attr']) && is_array($params['attr'])) {
+ foreach($params['attr']as $key => $value) {
$attr[$key] = $value;
}
}
@@ -8154,7 +8151,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
$attr = array_map('dol_escape_htmltag', $attr);
$TCompiledAttr = array();
- foreach($attr as $key => $value){
+ foreach($attr as $key => $value) {
$TCompiledAttr[] = $key.'="'.$value.'"';
}
@@ -8197,13 +8194,13 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
elseif ($displayMode == 1) {
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
}
- // use status with images
- elseif (empty($conf->global->MAIN_STATUS_USES_CSS)) {
+ // Use status with images (for backward compatibility)
+ elseif (! empty($conf->global->MAIN_STATUS_USES_IMAGES)) {
$return = '';
$htmlLabel = (in_array($displayMode, array(1,2,5))?'
':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?' ':'');
$htmlLabelShort = (in_array($displayMode, array(1,2,5))?'
':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?' ':'');
- // For small screen, we use the short label instead of long label.
+ // For small screen, we always use the short label instead of long label.
if (! empty($conf->dol_optimize_smallscreen))
{
if ($displayMode == 0) $displayMode = 1;
@@ -8211,7 +8208,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
elseif ($displayMode == 6) $displayMode = 5;
}
- // image's filename are still in French, so we use this array to convert
+ // For backward compatibility. Image's filename are still in French, so we use this array to convert
$statusImg=array(
'status0' => 'statut0'
,'status1' => 'statut1'
@@ -8248,7 +8245,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
}
}
// Use new badge
- elseif (!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)) {
+ elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) {
$statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel;
if ($displayMode == 3) {
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 30eba9867b8..07f058f2fe2 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -1617,7 +1617,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
$found=0;
$dirtoscan='';
- $sql = "SELECT nom as id, nom as lib, libelle as label, description as description";
+ $sql = "SELECT nom as id, nom as doc_template_name, libelle as label, description as description";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity IN (0,".$conf->entity.")";
@@ -1677,18 +1677,18 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
}
else
{
- if ($type == 'member' && $obj->lib == 'standard') // Special case, if member template, we add variant per format
+ if ($type == 'member' && $obj->doc_template_name == 'standard') // Special case, if member template, we add variant per format
{
global $_Avery_Labels;
include_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
foreach($_Avery_Labels as $key => $val)
{
- $liste[$obj->id.':'.$key]=($obj->label?$obj->label:$obj->lib).' '.$val['name'];
+ $liste[$obj->id.':'.$key]=($obj->label?$obj->label:$obj->doc_template_name).' '.$val['name'];
}
}
else // Common usage
{
- $liste[$obj->id]=$obj->label?$obj->label:$obj->lib;
+ $liste[$obj->id]=$obj->label?$obj->label:$obj->doc_template_name;
}
}
$i++;
diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php
index 004f355a27a..7dfee37666a 100644
--- a/htdocs/core/lib/invoice.lib.php
+++ b/htdocs/core/lib/invoice.lib.php
@@ -189,7 +189,7 @@ function invoice_rec_prepare_head($object)
$h = 0;
$head = array();
- $head[$h][0] = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?id='.$object->id;
+ $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card-rec.php?id='.$object->id;
$head[$h][1] = $langs->trans("CardBill");
$head[$h][2] = 'card';
$h++;
diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php
index e6f36b25d47..4e5cbb92c02 100644
--- a/htdocs/core/lib/modulebuilder.lib.php
+++ b/htdocs/core/lib/modulebuilder.lib.php
@@ -128,17 +128,19 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$i++;
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
- $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
- $texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
+ $texttoinsert.= " 'notnull'=>".(empty($val['notnull'])?0:$val['notnull']).",";
+ $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
+ if ($val['noteditable']) $texttoinsert.= " 'noteditable'=>'".$val['noteditable']."',";
if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',";
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
+ if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
- if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
+ if ($val['css']) $texttoinsert.= " 'css'=>'".$val['css']."',";
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
- if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\",";
if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',";
+ if ($val['disabled']) $texttoinsert.= " 'disabled'=>'".$val['disabled']."',";
if ($val['arrayofkeyval'])
{
$texttoinsert.= " 'arrayofkeyval'=>array(";
@@ -149,8 +151,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$texttoinsert.="'".$key2."'=>'".$val2."'";
$i++;
}
- $texttoinsert.= ")";
+ $texttoinsert.= "),";
}
+ if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
+
$texttoinsert.= "),\n";
}
}
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 544ca40fcf6..11c5d50592a 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -291,6 +291,11 @@ function product_admin_prepare_head()
$head[$h][2] = 'attributes';
$h++;
+ $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_supplier_extrafields.php';
+ $head[$h][1] = $langs->trans("ProductSupplierExtraFields");
+ $head[$h][2] = 'supplierAttributes';
+ $h++;
+
complete_head_from_modules($conf, $langs, null, $head, $h, 'product_admin', 'remove');
return $head;
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 0c80b05c9cd..825142d1385 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -670,8 +670,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($total_projectlinesa_planned) {
$totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
$totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
- // this conf is actually hidden, by default we use 1% for "be carefull or warning"
- $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
+
+ // this conf is actually hidden, by default we use 10% for "be carefull or warning"
+ $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
// define progress color according to time spend vs workload
$progressBarClass = 'progress-bar-info';
@@ -1748,12 +1749,12 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
* @param int $socid Id thirdparty
* @param int $projectsListId Id of project I have permission on
* @param int $mytasks Limited to task I am contact to
- * @param int $statut -1=No filter on statut, 0 or 1 = Filter on status
+ * @param int $status -1=No filter on statut, 0 or 1 = Filter on status
* @param array $listofoppstatus List of opportunity status
* @param array $hiddenfields List of info to not show ('projectlabel', 'declaredprogress', '...', )
* @return void
*/
-function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $statut = -1, $listofoppstatus = array(), $hiddenfields = array())
+function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array())
{
global $langs,$conf,$user,$bc;
@@ -1767,7 +1768,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$project_year_filter=0;
$title=$langs->trans("Projects");
- if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]);
+ if (strcmp($status, '') && $status >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]);
$arrayidtypeofcontact=array();
@@ -1796,9 +1797,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$sql.= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
$sql.= " AND ctc.element = 'project_task'";
}
- if ($statut >= 0)
+ if ($status >= 0)
{
- $sql.= " AND p.fk_statut = ".$statut;
+ $sql.= " AND p.fk_statut = ".(int) $status;
}
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE))
{
@@ -1995,6 +1996,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
* @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null
* @param spaced $spaced bool used to add space at bottom (made by css)
* @return string
+ * @see getTaskProgressBadge()
*/
function getTaskProgressView($task, $label = true, $progressNumber = true, $hideOnProgressNull = false, $spaced = false)
{
@@ -2020,26 +2022,27 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
if ($task->planned_workload){
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
- // this conf is actually hidden, by default we use 1% for "be carefull or warning"
- $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
+ // this conf is actually hidden, by default we use 10% for "be carefull or warning"
+ $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
- $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.'%';
- $diffTitle.= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.'%';
+ $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : '');
+ $diffTitle.= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : '');
- if($progressCalculated > doubleval($task->progress)){
+ //var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.doubleval($task->progress * $warningRatio));
+ if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
$progressBarClass = 'progress-bar-danger';
- $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
- $diff = '
'.($task->progress-$progressCalculated).'%';
+ $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
+ $diff = '
'.($task->progress-$progressCalculated).'%';
}
- elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
+ elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
$progressBarClass = 'progress-bar-warning';
- $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
- $diff = '
'.($task->progress-$progressCalculated).'%';
+ $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
+ $diff = '
'.($task->progress-$progressCalculated).'%';
}
else{
$progressBarClass = 'progress-bar-success';
- $title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).'%');
- $diff = '
'.($task->progress-$progressCalculated).'%';
+ $title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).' '.$langs->trans("point"));
+ $diff = '
'.($task->progress-$progressCalculated).'%';
}
}
@@ -2062,7 +2065,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
if($progressNumber !== false)
{
$out.= '
';
- if($progressNumber!==true){
+ if ($progressNumber!==true) {
$out.= $progressNumber; // replace label by param
}
else{
@@ -2087,8 +2090,21 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
$out.= ' ';
- $out.= '
';
- $out.= '
';
+ $out.= '
';
+ $diffval = doubleval($task->progress) - doubleval($progressCalculated);
+ if ($diffval >= 0) {
+ // good
+ $out.= '
';
+ $out.= '
';
+ $out.= '
';
+ }
+ else
+ {
+ // bad
+ $out.= '
';
+ $out.= '
';
+ $out.= '
';
+ }
$out.= '
';
$out.= '
';
@@ -2101,6 +2117,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
* @param label $label string empty = auto (progress), string = replace output
* @param tooltip $tooltip string empty = auto , string = replace output
* @return string
+ * @see getTaskProgressView()
*/
function getTaskProgressBadge($task, $label = '', $tooltip = '')
{
@@ -2117,13 +2134,13 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '')
if ($task->planned_workload){
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
- // this conf is actually hidden, by default we use 1% for "be carefull or warning"
- $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
+ // this conf is actually hidden, by default we use 10% for "be carefull or warning"
+ $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
- if($progressCalculated > doubleval($task->progress)){
+ if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
$badgeClass.= 'badge-danger';
}
- elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
+ elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
$badgeClass.= 'badge-warning';
}
else{
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index a4b96a6b650..d5226bb7e3d 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -217,7 +217,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
{
$featureforlistofmodule=$feature;
if ($featureforlistofmodule == 'produit') $featureforlistofmodule='product';
- if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($featureforlistofmodule, $listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
+ if (! empty($user->socid) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($featureforlistofmodule, $listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
{
$readok=0; $nbko++;
continue;
diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php
index 63e9a2fc9ff..e89e9a79194 100644
--- a/htdocs/core/lib/ticket.lib.php
+++ b/htdocs/core/lib/ticket.lib.php
@@ -819,6 +819,46 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
}
}
+ $documents = getTicketActionCommEcmList($actionstatic) ;
+ if(!empty($documents))
+ {
+ $footer.= '
';
+ foreach ($documents as $doc)
+ {
+ $footer.= '
';
+
+ $filePath = DOL_DATA_ROOT . '/'. $doc->filepath . '/'. $doc->filename;
+ $mime = dol_mimetype($filePath);
+ $file = $actionstatic->id.'/'.$doc->filename;
+ $thumb = $actionstatic->id.'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename,'.')).'_mini'.substr($doc->filename, strrpos($doc->filename,'.'));
+ $doclink = dol_buildpath('document.php', 1).'?modulepart=actions&attachment=0&file='.urlencode($file).'&entity='.$conf->entity;
+ $viewlink = dol_buildpath('viewimage.php', 1).'?modulepart=actions&file='.urlencode($thumb).'&entity='.$conf->entity;
+
+ $mimeAttr = ' mime="'.$mime.'" ';
+ $class = '';
+ if(in_array($mime, array('image/png', 'image/jpeg', 'application/pdf'))){
+ $class.= ' documentpreview';
+ }
+
+ $footer.= '';
+ $footer.= img_mime($filePath).' '.$doc->filename;
+ $footer.= ' ';
+
+ $footer.= ' ';
+ }
+ $footer.= '
';
+ }
+
+
+
+
+
+
+
if(!empty($footer)){
$out.='';
}
@@ -838,3 +878,32 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
if ($noprint) return $out;
else print $out;
}
+
+
+/**
+ * @var $object ActionComm
+ * @return array
+ */
+function getTicketActionCommEcmList($object)
+{
+ global $conf, $db;
+
+ $documents = array();
+
+ $sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm';
+ $sql.= ' WHERE ecm.filepath = \'agenda/'.$object->id.'\'';
+ //$sql.= ' ecm.src_object_type = \''.$object->element.'\' AND ecm.src_object_id = '.$object->id; // Actually upload file doesn't add type
+ $sql.= ' ORDER BY ecm.position ASC';
+
+ $resql= $db->query($sql);
+ if ($resql) {
+ if ($db->num_rows($resql)) {
+ while ($obj = $db->fetch_object($resql)) {
+ $documents[$obj->id] = $obj;
+ }
+ }
+ }
+
+ return $documents;
+}
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 7beadc9496b..a65d51d5f04 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -108,7 +108,7 @@ function user_prepare_head($object)
}
// Notifications
- if ($user->societe_id == 0 && ! empty($conf->notification->enabled))
+ if ($user->socid == 0 && ! empty($conf->notification->enabled))
{
$nbNote = 0;
$sql = "SELECT COUNT(n.rowid) as nb";
@@ -157,7 +157,7 @@ function user_prepare_head($object)
}
// Such info on users is visible only by internal user
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
// Notes
$nbNote = 0;
diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php
index b45eaa4b7a9..7e7cbd9672e 100644
--- a/htdocs/core/lib/xcal.lib.php
+++ b/htdocs/core/lib/xcal.lib.php
@@ -25,499 +25,573 @@
* Build a file from an array of events
* All input params and data must be encoded in $conf->charset_output
*
- * @param string $format 'vcal' or 'ical'
- * @param string $title Title of export
- * @param string $desc Description of export
- * @param array $events_array Array of events ('eid','startdate','duration','enddate','title','summary','category','email','url','desc','author')
- * @param string $outputfile Output file
- * @return int <0 if ko, Nb of events in file if ok
+ * @param string $format "vcal" or "ical"
+ * @param string $title Title of export
+ * @param string $desc Description of export
+ * @param array $events_array Array of events ("uid","startdate","duration","enddate","title","summary","category","email","url","desc","author")
+ * @param string $outputfile Output file
+ * @return int < 0 if ko, Nb of events in file if ok
*/
function build_calfile($format, $title, $desc, $events_array, $outputfile)
{
- global $conf,$langs;
+ global $conf, $langs;
- dol_syslog("xcal.lib.php::build_calfile Build cal file ".$outputfile." to format ".$format);
+ dol_syslog("xcal.lib.php::build_calfile Build cal file ".$outputfile." to format ".$format);
- if (empty($outputfile)) return -1;
+ if (empty($outputfile))
+ {
+ // -1 = error
+ return -1;
+ }
// Note: A cal file is an UTF8 encoded file
- $calfileh=fopen($outputfile, 'w');
- if ($calfileh)
- {
- include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
- $now=dol_now();
+ $calfileh = fopen($outputfile, "w");
- $encoding='';
- if ($format == 'vcal') $encoding='ENCODING=QUOTED-PRINTABLE:';
+ if ($calfileh)
+ {
+ include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
- // Print header
- fwrite($calfileh, "BEGIN:VCALENDAR\n");
- fwrite($calfileh, "VERSION:2.0\n");
- fwrite($calfileh, "METHOD:PUBLISH\n");
- //fwrite($calfileh,"PRODID:-//DOLIBARR ".DOL_VERSION."//EN\n");
- fwrite($calfileh, "PRODID:-//DOLIBARR ".DOL_VERSION."\n");
- fwrite($calfileh, "CALSCALE:GREGORIAN\n");
- fwrite($calfileh, "X-WR-CALNAME:".$encoding.format_cal($format, $title)."\n");
- fwrite($calfileh, "X-WR-CALDESC:".$encoding.format_cal($format, $desc)."\n");
- //fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n");
- if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)
- && $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60){
- $hh=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, 'hour');
- $mm=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, 'min');
- $ss=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, 'sec');
- fwrite($calfileh, "X-PUBLISHED-TTL: P".$hh."H".$mm."M".$ss."S\n");
+ $now = dol_now();
+ $encoding = "";
+
+ if ($format === "vcal")
+ {
+ $encoding = "ENCODING=QUOTED-PRINTABLE:";
}
- foreach ($events_array as $key => $event)
- {
- $eventqualified=true;
- if ($eventqualified)
- {
- // See http://fr.wikipedia.org/wiki/ICalendar for format
- // See http://www.ietf.org/rfc/rfc2445.txt for RFC
- $uid = $event['uid'];
- $type = $event['type'];
- $startdate = $event['startdate'];
- $duration = $event['duration'];
- $enddate = $event['enddate'];
- $summary = $event['summary'];
- $category = $event['category'];
- $priority = $event['priority'];
- $fulldayevent = $event['fulldayevent'];
- $location = $event['location'];
- $email = $event['email'];
- $url = $event['url'];
- $transparency = $event['transparency']; // OPAQUE (busy) or TRANSPARENT (not busy)
- $description=preg_replace('/
/i', "\n", $event['desc']);
- $description=dol_string_nohtmltag($description, 0); // Remove html tags
- $created = $event['created'];
- $modified = $event['modified'];
+ // Print header
+ fwrite($calfileh, "BEGIN:VCALENDAR\n");
- // Uncomment for tests
- //$summary="Resume";
- //$description="Description";
- //$description="MemberValidatedInDolibarr gd gdf gd gdff\nNom: tgdf g dfgdf gfd r ter\nType: gdfgfdf dfg fd gfd gd gdf gdf gfd gdfg dfg ddf\nAuteur: AD01fg dgdgdfg df gdf gd";
+ // version is always "2.0"
+ fwrite($calfileh, "VERSION:2.0\n");
- // Format
- $summary=format_cal($format, $summary);
- $description=format_cal($format, $description);
- $category=format_cal($format, $category);
- $location=format_cal($format, $location);
+ fwrite($calfileh, "METHOD:PUBLISH\n");
+ fwrite($calfileh, "PRODID:-//DOLIBARR ".DOL_VERSION."\n");
+ fwrite($calfileh, "CALSCALE:GREGORIAN\n");
+ fwrite($calfileh, "X-WR-CALNAME:".$encoding.format_cal($format, $title)."\n");
+ fwrite($calfileh, "X-WR-CALDESC:".$encoding.format_cal($format, $desc)."\n");
+ //fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n");
- // Output the vCard/iCal VEVENT object
- /*
- Example from Google ical export for a 1 hour event:
- BEGIN:VEVENT
- DTSTART:20101103T120000Z
- DTEND:20101103T130000Z
- DTSTAMP:20101121T144902Z
- UID:4eilllcsq8r1p87ncg7vc8dbpk@google.com
- CREATED:20101121T144657Z
- DESCRIPTION:
- LAST-MODIFIED:20101121T144707Z
- LOCATION:
- SEQUENCE:0
- STATUS:CONFIRMED
- SUMMARY:Tâche 1 heure
- TRANSP:OPAQUE
- END:VEVENT
+ if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE) && $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60)
+ {
+ $hh = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "hour");
+ $mm = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "min");
+ $ss = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "sec");
- Example from Google ical export for a 1 day event:
- BEGIN:VEVENT
- DTSTART;VALUE=DATE:20101102
- DTEND;VALUE=DATE:20101103
- DTSTAMP:20101121T144902Z
- UID:d09t43kcf1qgapu9efsmmo1m6k@google.com
- CREATED:20101121T144607Z
- DESCRIPTION:
- LAST-MODIFIED:20101121T144607Z
- LOCATION:
- SEQUENCE:0
- STATUS:CONFIRMED
- SUMMARY:Tâche 1 jour
- TRANSP:TRANSPARENT
- END:VEVENT
- */
- if ($type == 'event')
- {
- fwrite($calfileh, "BEGIN:VEVENT\n");
- fwrite($calfileh, "UID:".$uid."\n");
- if (! empty($email))
- {
- fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n");
- fwrite($calfileh, "CONTACT:MAILTO:".$email."\n");
- }
- if (! empty($url))
- {
- fwrite($calfileh, "URL:".$url."\n");
- };
+ fwrite($calfileh, "X-PUBLISHED-TTL: P".$hh."H".$mm."M".$ss."S\n");
+ }
- if ($created) fwrite($calfileh, "CREATED:".dol_print_date($created, 'dayhourxcard', true)."\n");
- if ($modified) fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, 'dayhourxcard', true)."\n");
- fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
- fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n");
+ foreach ($events_array as $key => $event)
+ {
+ // See http://fr.wikipedia.org/wiki/ICalendar for format
+ // See http://www.ietf.org/rfc/rfc2445.txt for RFC
- /* Other keys:
- // Status values for a "VEVENT"
- statvalue = "TENTATIVE" ;Indicates event is
- ;tentative.
- / "CONFIRMED" ;Indicates event is
- ;definite.
- / "CANCELLED" ;Indicates event was
- // Status values for "VTODO".
- statvalue =/ "NEEDS-ACTION" ;Indicates to-do needs action.
- / "COMPLETED" ;Indicates to-do completed.
- / "IN-PROCESS" ;Indicates to-do in process of
- / "CANCELLED" ;Indicates to-do was cancelled.
- // Status values for "VJOURNAL".
- statvalue =/ "DRAFT" ;Indicates journal is draft.
- / "FINAL" ;Indicates journal is final.
- / "CANCELLED" ;Indicates journal is removed.
- */
- //fwrite($calfileh,"CLASS:PUBLIC\n"); // PUBLIC, PRIVATE, CONFIDENTIAL
- //fwrite($calfileh,"X-MICROSOFT-CDO-BUSYSTATUS:1\n");
- //ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Laurent Destailleur;X-NUM-GUESTS=0:mailto:eldy10@gmail.com
+ // TODO: avoid use extra event array, use objects direct thahtwas created before
- if (! empty($location)) fwrite($calfileh, "LOCATION:".$encoding.$location."\n");
- if ($fulldayevent) fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n");
+ $uid = $event["uid"];
+ $type = $event["type"];
+ $startdate = $event["startdate"];
+ $duration = $event["duration"];
+ $enddate = $event["enddate"];
+ $summary = $event["summary"];
+ $category = $event["category"];
+ $priority = $event["priority"];
+ $fulldayevent = $event["fulldayevent"];
+ $location = $event["location"];
+ $email = $event["email"];
+ $url = $event["url"];
+ $transparency = $event["transparency"];
+ $description = dol_string_nohtmltag(preg_replace("/
/i", "\n", $event["desc"]), 0);
+ $created = $event["created"];
+ $modified = $event["modified"];
+ $assignedUsers = $event["assignedUsers"];
- // see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2
- if ($fulldayevent) fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n");
+ // Format
+ $summary = format_cal($format, $summary);
+ $description = format_cal($format, $description);
+ $category = format_cal($format, $category);
+ $location = format_cal($format, $location);
- // Date must be GMT dates
- // Current date
- fwrite($calfileh, "DTSTAMP:".dol_print_date($now, 'dayhourxcard', true)."\n");
- // Start date
- $prefix='';
- $startdatef = dol_print_date($startdate, 'dayhourxcard', true);
- if ($fulldayevent)
- {
- $prefix=';VALUE=DATE';
- $startdatef = dol_print_date($startdate, 'dayxcard', false); // Local time
- }
- fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n");
- // End date
- if ($fulldayevent)
- {
- if (empty($enddate)) $enddate=dol_time_plus_duree($startdate, 1, 'd');
- }
- else
- {
- if (empty($enddate)) $enddate=$startdate+$duration;
- }
- $prefix='';
- $enddatef = dol_print_date($enddate, 'dayhourxcard', true);
- if ($fulldayevent)
- {
- $prefix=';VALUE=DATE';
- $enddatef = dol_print_date($enddate+1, 'dayxcard', false);
- //$enddatef .= dol_print_date($enddate+1,'dayhourxcard',false); // Local time
- }
- fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n");
- fwrite($calfileh, 'STATUS:CONFIRMED'."\n");
- if (! empty($transparency)) fwrite($calfileh, "TRANSP:".$transparency."\n");
- if (! empty($category)) fwrite($calfileh, "CATEGORIES:".$encoding.$category."\n");
- fwrite($calfileh, "END:VEVENT\n");
- }
+ // Output the vCard/iCal VEVENT object
+ /*
+ Example from Google ical export for a 1 hour event:
+ BEGIN:VEVENT
+ DTSTART:20101103T120000Z
+ DTEND:20101103T130000Z
+ DTSTAMP:20101121T144902Z
+ UID:4eilllcsq8r1p87ncg7vc8dbpk@google.com
+ CREATED:20101121T144657Z
+ DESCRIPTION:
+ LAST-MODIFIED:20101121T144707Z
+ LOCATION:
+ SEQUENCE:0
+ STATUS:CONFIRMED
+ SUMMARY:Tâche 1 heure
+ TRANSP:OPAQUE
+ END:VEVENT
- // Output the vCard/iCal VTODO object
- // ...
- //PERCENT-COMPLETE:39
+ Example from Google ical export for a 1 day event:
+ BEGIN:VEVENT
+ DTSTART;VALUE=DATE:20101102
+ DTEND;VALUE=DATE:20101103
+ DTSTAMP:20101121T144902Z
+ UID:d09t43kcf1qgapu9efsmmo1m6k@google.com
+ CREATED:20101121T144607Z
+ DESCRIPTION:
+ LAST-MODIFIED:20101121T144607Z
+ LOCATION:
+ SEQUENCE:0
+ STATUS:CONFIRMED
+ SUMMARY:Tâche 1 jour
+ TRANSP:TRANSPARENT
+ END:VEVENT
+ */
- // Output the vCard/iCal VJOURNAL object
- if ($type == 'journal')
- {
- fwrite($calfileh, "BEGIN:VJOURNAL\n");
- fwrite($calfileh, "UID:".$uid."\n");
- if (! empty($email))
- {
- fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n");
- fwrite($calfileh, "CONTACT:MAILTO:".$email."\n");
- }
- if (! empty($url))
- {
- fwrite($calfileh, "URL:".$url."\n");
- };
+ if ($type === "event")
+ {
+ fwrite($calfileh, "BEGIN:VEVENT\n");
+ fwrite($calfileh, "UID:".$uid."\n");
- if ($created) fwrite($calfileh, "CREATED:".dol_print_date($created, 'dayhourxcard', true)."\n");
- if ($modified) fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, 'dayhourxcard', true)."\n");
- fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
- fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n");
- fwrite($calfileh, 'STATUS:CONFIRMED'."\n");
- fwrite($calfileh, "CATEGORIES:".$category."\n");
- fwrite($calfileh, "LOCATION:".$location."\n");
- fwrite($calfileh, "TRANSP:OPAQUE\n");
- fwrite($calfileh, "CLASS:CONFIDENTIAL\n");
- fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, 'dayhourxcard', true)."\n");
+ if (! empty($email))
+ {
+ fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n");
+ fwrite($calfileh, "CONTACT:MAILTO:".$email."\n");
+ }
- fwrite($calfileh, "END:VJOURNAL\n");
- }
+ if (! empty($url))
+ {
+ fwrite($calfileh, "URL:".$url."\n");
+ }
+ if (is_array($assignedUsers))
+ {
+ foreach($assignedUsers as $assignedUser)
+ {
+ if($assignedUser->email === $email)
+ {
+ continue;
+ }
- // Put other info in comment
- /*
- $comment=array();
- $comment ['eid'] = $eid;
- $comment ['url'] = $linktoevent;
- $comment ['date'] = dol_mktime($evttime,"Ymd");
- $comment ['duration'] = $duration;
- $comment ['startdate'] = $startdate;
- $comment ['enddate'] = $enddate;
- fwrite($calfileh,"COMMENT:" . serialize ($comment) . "\n");
- */
- }
- }
+ fwrite($calfileh, "ATTENDEE;RSVP=TRUE:mailto:".$assignedUser->email."\n");
+ }
+ }
- // Footer
- fwrite($calfileh, "END:VCALENDAR");
+ if ($created)
+ {
+ fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n");
+ }
- fclose($calfileh);
- if (! empty($conf->global->MAIN_UMASK))
- @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
- }
- else
- {
- dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing");
- return -2;
- }
+ if ($modified)
+ {
+ fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n");
+ }
+
+ fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
+ fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n");
+
+ if (! empty($location))
+ {
+ fwrite($calfileh, "LOCATION:".$encoding.$location."\n");
+ }
+
+ if ($fulldayevent)
+ {
+ fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n");
+ }
+
+ // see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2
+ if ($fulldayevent)
+ {
+ fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n");
+ }
+
+ // Date must be GMT dates
+ // Current date
+ fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n");
+
+ // Start date
+ $prefix = "";
+ $startdatef = dol_print_date($startdate, "dayhourxcard", true);
+
+ if ($fulldayevent)
+ {
+ // Local time
+ $prefix = ";VALUE=DATE";
+ $startdatef = dol_print_date($startdate, "dayxcard", false);
+ }
+
+ fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n");
+
+ // End date
+ if ($fulldayevent)
+ {
+ if (empty($enddate))
+ {
+ $enddate = dol_time_plus_duree($startdate, 1, "d");
+ }
+ }
+ else
+ {
+ if (empty($enddate))
+ {
+ $enddate = $startdate+$duration;
+ }
+ }
+
+ $prefix = "";
+ $enddatef = dol_print_date($enddate, "dayhourxcard", true);
+
+ if ($fulldayevent)
+ {
+ $prefix = ";VALUE=DATE";
+ $enddatef = dol_print_date($enddate+1, "dayxcard", false);
+
+ // Local time
+ //$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false);
+ }
+
+ fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n");
+ fwrite($calfileh, "STATUS:CONFIRMED"."\n");
+
+ if (! empty($transparency))
+ {
+ fwrite($calfileh, "TRANSP:".$transparency."\n");
+ }
+
+ if (! empty($category))
+ {
+ fwrite($calfileh, "CATEGORIES:".$encoding.$category."\n");
+ }
+
+ fwrite($calfileh, "END:VEVENT\n");
+ }
+
+ // Output the vCard/iCal VJOURNAL object
+ if ($type === "journal")
+ {
+ fwrite($calfileh, "BEGIN:VJOURNAL\n");
+ fwrite($calfileh, "UID:".$uid."\n");
+
+ if (! empty($email))
+ {
+ fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n");
+ fwrite($calfileh, "CONTACT:MAILTO:".$email."\n");
+ }
+
+ if (! empty($url))
+ {
+ fwrite($calfileh, "URL:".$url."\n");
+ }
+
+ if ($created)
+ {
+ fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n");
+ }
+
+ if ($modified)
+ {
+ fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n");
+ }
+
+ fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
+ fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n");
+ fwrite($calfileh, "STATUS:CONFIRMED"."\n");
+ fwrite($calfileh, "CATEGORIES:".$category."\n");
+ fwrite($calfileh, "LOCATION:".$location."\n");
+ fwrite($calfileh, "TRANSP:OPAQUE\n");
+ fwrite($calfileh, "CLASS:CONFIDENTIAL\n");
+ fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n");
+
+ fwrite($calfileh, "END:VJOURNAL\n");
+ }
+ }
+
+ // Footer
+ fwrite($calfileh, "END:VCALENDAR");
+
+ fclose($calfileh);
+
+ if (! empty($conf->global->MAIN_UMASK))
+ {
+ @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
+ }
+ }
+ else
+ {
+ dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing");
+ return -2;
+ }
}
/**
- * Build a file from an array of events.
+ * Build a file from an array of events.
* All input data must be encoded in $conf->charset_output
*
- * @param string $format 'rss'
- * @param string $title Title of export
- * @param string $desc Description of export
- * @param array $events_array Array of events ('uid','startdate','summary','url','desc','author','category')
- * @param string $outputfile Output file
- * @param string $filter Filter
- * @return int <0 if ko, Nb of events in file if ok
+ * @param string $format "rss"
+ * @param string $title Title of export
+ * @param string $desc Description of export
+ * @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category")
+ * @param string $outputfile Output file
+ * @param string $filter (optional) Filter
+ * @return int < 0 if ko, Nb of events in file if ok
*/
-function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '')
+function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = "")
{
- global $user,$conf,$langs;
- global $dolibarr_main_url_root;
+ global $user, $conf, $langs;
+ global $dolibarr_main_url_root;
- dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format);
+ dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format);
- if (empty($outputfile)) return -1;
+ if (empty($outputfile))
+ {
+ // -1 = error
+ return -1;
+ }
- $fichier=fopen($outputfile, 'w');
- if ($fichier)
- {
- $date=date("r");
+ $fichier = fopen($outputfile, "w");
- // Print header
- $form='charset_output.'"?>';
- fwrite($fichier, $form);
- fwrite($fichier, "\n");
- $form='
';
- fwrite($fichier, $form);
- fwrite($fichier, "\n");
+ if ($fichier)
+ {
+ $date = date("r");
- $form="\n".$title." \n";
- fwrite($fichier, $form);
+ // Print header
+ fwrite($fichier, 'charset_output.""?>');
+ fwrite($fichier, "\n");
- $form=' '."\n".
- // 'fr '."\n".
- 'Dolibarr '."\n".
- ''.$date.' '."\n".
- 'Dolibarr '."\n";
+ fwrite($fichier, '');
+ fwrite($fichier, "\n");
- // Define $urlwithroot
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
- $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
- //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
- $url=$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
- $form.=' '."\n";
+ fwrite($fichier, "\n".$title." \n");
- //print $form;
- fwrite($fichier, $form);
+ $form = " "."\n".
+ // "fr "."\n".
+ "Dolibarr "."\n".
+ "".$date." "."\n".
+ "Dolibarr "."\n";
+ // Define $urlwithroot
+ $urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root));
- foreach ($events_array as $key => $event)
- {
- $eventqualified=true;
- if ($filter)
- {
- // TODO Add a filter
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
- $eventqualified=false;
- }
+ $url=$urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
- if ($eventqualified)
- {
- $uid = $event['uid'];
- $startdate = $event['startdate'];
- $summary = $event['summary'];
- $url = $event['url'];
- $author = $event['author'];
- $category = $event['category'];
- /* No place inside a RSS
- $priority = $event['priority'];
- $fulldayevent = $event['fulldayevent'];
- $location = $event['location'];
- $email = $event['email'];
+ fwrite($fichier, " "."\n");
+
+ foreach ($events_array as $key => $event)
+ {
+ $eventqualified = true;
+
+ if ($filter)
+ {
+ // TODO Add a filter
+
+ $eventqualified=false;
+ }
+
+ if ($eventqualified)
+ {
+ $uid = $event["uid"];
+ $startdate = $event["startdate"];
+ $summary = $event["summary"];
+ $url = $event["url"];
+ $author = $event["author"];
+ $category = $event["category"];
+
+ /* No place inside a RSS
+ $priority = $event["priority"];
+ $fulldayevent = $event["fulldayevent"];
+ $location = $event["location"];
+ $email = $event["email"];
*/
- $description=preg_replace('/ /i', "\n", $event['desc']);
- $description=dol_string_nohtmltag($description, 0); // Remove html tags
- fwrite($fichier, "- \n");
- fwrite($fichier, "
\n");
- fwrite($fichier, " \n");
- fwrite($fichier, " \n");
- fwrite($fichier, " \n");
- fwrite($fichier, " \n");
- fwrite($fichier, "".date("r", $startdate)." \n");
- fwrite($fichier, " \n");
- fwrite($fichier, " \n");
- fwrite($fichier, " \n");
- }
- }
+ $description = dol_string_nohtmltag(preg_replace("/ /i", "\n", $event["desc"]), 0);
- fwrite($fichier, ' ');
- fwrite($fichier, "\n");
- fwrite($fichier, ' ');
+ fwrite($fichier, "- \n");
+ fwrite($fichier, "
\n");
+ fwrite($fichier, " \n");
+ fwrite($fichier, " \n");
+ fwrite($fichier, " \n");
+ fwrite($fichier, "global->MAIN_UMASK))
- @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
- }
+ if ($description)
+ fwrite($fichier, $description);
+ // else
+ // fwrite($fichier, "NoDesc");
+
+ fwrite($fichier, "]]> \n");
+ fwrite($fichier, "".date("r", $startdate)." \n");
+ fwrite($fichier, " \n");
+ fwrite($fichier, " \n");
+ fwrite($fichier, " \n");
+ }
+ }
+
+ fwrite($fichier, " ");
+ fwrite($fichier, "\n");
+ fwrite($fichier, " ");
+
+ fclose($fichier);
+
+ if (! empty($conf->global->MAIN_UMASK))
+ {
+ @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
+ }
+ }
}
-
/**
- * Encode for cal export
+ * Encode for cal export
*
- * @param string $format vcal or ical
- * @param string $string string to encode
- * @return string string encoded
+ * @param string $format "vcal" or "ical"
+ * @param string $string String to encode
+ * @return string String encoded
*/
function format_cal($format, $string)
{
- global $conf;
+ global $conf;
- $newstring=$string;
+ $newstring = $string;
- if ($format == 'vcal')
- {
- $newstring=quotedPrintEncode($newstring);
- }
- if ($format == 'ical')
- {
- // Replace new lines chars by '\n'
- $newstring=preg_replace('/'."\r\n".'/i', "\n", $newstring);
- $newstring=preg_replace('/'."\n\r".'/i', "\n", $newstring);
- $newstring=preg_replace('/'."\n".'/i', '\n', $newstring);
- // Must not exceed 75 char. Cut with "\r\n"+Space
- $newstring=calEncode($newstring);
- }
+ if ($format === "vcal")
+ {
+ $newstring = quotedPrintEncode($newstring);
+ }
- return $newstring;
+ if ($format === "ical")
+ {
+ // Replace new lines chars by "\n"
+ $newstring = preg_replace("/"."\r\n"."/i", "\\n", $newstring);
+ $newstring = preg_replace("/"."\n\r"."/i", "\\n", $newstring);
+ $newstring = preg_replace("/"."\n"."/i", "\\n", $newstring);
+
+ // Must not exceed 75 char. Cut with "\r\n"+Space
+ $newstring = calEncode($newstring);
+ }
+
+ return $newstring;
}
/**
- * Cut string after 75 chars. Add CRLF+Space.
- * line must be encoded in UTF-8
+ * Cut string after 75 chars. Add CRLF+Space.
+ * line must be encoded in UTF-8
*
- * @param string $line String to convert
- * @return string String converted
+ * @param string $line String to convert
+ * @return string String converted
*/
function calEncode($line)
{
- $out = '';
+ $out = "";
+ $newpara = "";
- $newpara = '';
+ // If mb_ functions exists, it"s better to use them
+ if (function_exists("mb_strlen"))
+ {
+ $strlength = mb_strlen($line, "UTF-8");
- // If mb_ functions exists, it's better to use them
- if (function_exists('mb_strlen'))
- {
- $strlength=mb_strlen($line, 'UTF-8');
- for ($j = 0; $j <= ($strlength - 1); $j++)
- {
- $char = mb_substr($line, $j, 1, 'UTF-8'); // Take char at position $j
+ for ($j = 0; $j < $strlength; $j++)
+ {
+ // Take char at position $j
+ $char = mb_substr($line, $j, 1, "UTF-8");
- if ((mb_strlen($newpara, 'UTF-8') + mb_strlen($char, 'UTF-8')) >= 75)
- {
- $out .= $newpara . "\r\n "; // CRLF + Space for cal
- $newpara = '';
- }
- $newpara .= $char;
- }
- $out .= $newpara;
- }
- else
- {
- $strlength=dol_strlen($line);
- for ($j = 0; $j <= ($strlength - 1); $j++)
- {
- $char = substr($line, $j, 1); // Take char at position $j
+ if ((mb_strlen($newpara, "UTF-8") + mb_strlen($char, "UTF-8")) >= 75)
+ {
+ // CRLF + Space for cal
+ $out .= $newpara . "\r\n ";
- if ((dol_strlen($newpara) + dol_strlen($char)) >= 75 )
- {
- $out .= $newpara . "\r\n "; // CRLF + Space for cal
- $newpara = '';
- }
- $newpara .= $char;
- }
- $out .= $newpara;
- }
+ $newpara = "";
+ }
- return trim($out);
+ $newpara .= $char;
+ }
+
+ $out .= $newpara;
+ }
+ else
+ {
+ $strlength = dol_strlen($line);
+
+ for ($j = 0; $j < $strlength; $j++)
+ {
+ // Take char at position $j
+ $char = substr($line, $j, 1);
+
+ if ((dol_strlen($newpara) + dol_strlen($char)) >= 75 )
+ {
+ // CRLF + Space for cal
+ $out .= $newpara . "\r\n ";
+
+ $newpara = "";
+ }
+
+ $newpara .= $char;
+ }
+
+ $out .= $newpara;
+ }
+
+ return trim($out);
}
/**
- * Encode into vcal format
+ * Encode into vcal format
*
- * @param string $str String to convert
- * @param int $forcal 1=For cal
- * @return string String converted
+ * @param string $str String to convert
+ * @param int $forcal (optional) 1 = For cal
+ * @return string String converted
*/
function quotedPrintEncode($str, $forcal = 0)
{
- $lines = preg_split("/\r\n/", $str);
- $out = '';
+ $lines = preg_split("/\r\n/", $str);
+ $out = "";
- foreach ($lines as $line)
- {
- $newpara = '';
+ foreach ($lines as $line)
+ {
+ $newpara = "";
- $strlength=strlen($line); // Do not use dol_strlen here, we need number of bytes
- for ($j = 0; $j <= ($strlength - 1); $j++)
- {
- $char = substr($line, $j, 1);
- $ascii = ord($char);
+ // Do not use dol_strlen here, we need number of bytes
+ $strlength = strlen($line);
- if ( $ascii < 32 || $ascii == 61 || $ascii > 126 )
- $char = '=' . strtoupper(sprintf("%02X", $ascii));
+ for ($j = 0; $j < $strlength; $j++)
+ {
+ $char = substr($line, $j, 1);
+ $ascii = ord($char);
- if ((strlen($newpara) + strlen($char)) >= 76 ) // Do not use dol_strlen here, we need number of bytes
- {
- $out .= $newpara . '=' . "\r\n"; // CRLF
- if ($forcal) $out .= " "; // + Space for cal
- $newpara = '';
- }
- $newpara .= $char;
- }
- $out .= $newpara;
- }
- return trim($out);
+ if ( $ascii < 32 || $ascii === 61 || $ascii > 126 )
+ {
+ $char = "=" . strtoupper(sprintf("%02X", $ascii));
+ }
+
+ // Do not use dol_strlen here, we need number of bytes
+ if ((strlen($newpara) + strlen($char)) >= 76 )
+ {
+ // New line with carray-return (CR) and line-feed (LF)
+ $out .= $newpara . "=" . "\r\n";
+
+ // extra space for cal
+ if ($forcal)
+ $out .= " ";
+
+ $newpara = "";
+ }
+
+ $newpara .= $char;
+ }
+
+ $out .= $newpara;
+ }
+ return trim($out);
}
/**
- * Decode vcal format
+ * Decode vcal format
*
- * @param string $str String to convert
- * @return string String converted
+ * @param string $str String to convert
+ * @return string String converted
*/
function quotedPrintDecode($str)
{
- $out = preg_replace('/=\r?\n/', '', $str);
- $out = quoted_printable_decode($out); // Available with PHP 4+
- return trim($out);
+ return trim(quoted_printable_decode(preg_replace("/=\r?\n/", "", $str)));
}
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index 5f27a68d63a..6819ab864b3 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -316,7 +316,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
// We update newmenu with entries found into database
$menuArbo = new Menubase($db, 'auguria');
- $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->societe_id?1:0), 'auguria', $tabMenu);
+ $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid?1:0), 'auguria', $tabMenu);
// We update newmenu for special dynamic menus
if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 380b6a22355..d9f0d663754 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -1852,7 +1852,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Add personalized menus and modules menus
//var_dump($newmenu->liste); //
$menuArbo = new Menubase($db, 'eldy');
- $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->societe_id)?0:1), 'eldy', $tabMenu);
+ $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid)?0:1), 'eldy', $tabMenu);
//var_dump($newmenu->liste); //
// We update newmenu for special dynamic menus
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 8885348bb16..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
@@ -85,14 +85,7 @@ class doc_generic_bom_odt extends ModelePDFBOMs
$this->marge_haute=0;
$this->marge_basse=0;
- $this->option_logo = 1; // Affiche logo
- $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
- $this->option_modereg = 0; // Affiche mode reglement
- $this->option_condreg = 0; // Affiche conditions reglement
- $this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
- $this->option_escompte = 0; // Affiche si il y a eu escompte
- $this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
@@ -486,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/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php
index 581fca03f8b..558744d87e8 100644
--- a/htdocs/core/modules/mailings/advthirdparties.modules.php
+++ b/htdocs/core/modules/mailings/advthirdparties.modules.php
@@ -31,6 +31,10 @@ class mailing_advthirdparties extends MailingTargets
public $require_admin=0;
public $require_module=array("none"); // This module should not be displayed as Selector in mailling
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='company';
/**
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index aa951426a12..b3687e4f603 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -37,6 +37,10 @@ class mailing_contacts1 extends MailingTargets
public $desc='Contacts of thirdparties (prospects, customers, suppliers...)';
public $require_module=array("societe"); // Module mailing actif si modules require_module actifs
public $require_admin=0; // Module mailing actif pour user admin ou non
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='contact';
/**
diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php
index a96457c2625..88af802ecfe 100644
--- a/htdocs/core/modules/mailings/example.modules.php
+++ b/htdocs/core/modules/mailings/example.modules.php
@@ -36,6 +36,10 @@ class mailing_example extends MailingTargets
public $tooltip='MyTooltipLangKey';
public $require_module=array();
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='';
/**
diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php
index 25ffcb717fd..ae0dff89b76 100644
--- a/htdocs/core/modules/mailings/fraise.modules.php
+++ b/htdocs/core/modules/mailings/fraise.modules.php
@@ -40,6 +40,10 @@ class mailing_fraise extends MailingTargets
public $require_admin=0;
public $require_module=array('adherent');
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='user';
/**
@@ -129,7 +133,7 @@ class mailing_fraise extends MailingTargets
$s.=' ';
$s.=$langs->trans("Type").': ';
$s.='
';
- $sql = "SELECT rowid, libelle, statut";
+ $sql = "SELECT rowid, libelle as label, statut";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql.= " WHERE entity IN (".getEntity('member_type').")";
$sql.= " ORDER BY rowid";
@@ -146,7 +150,7 @@ class mailing_fraise extends MailingTargets
{
$obj = $this->db->fetch_object($resql);
- $s.=''.dol_trunc($obj->libelle, 38, 'middle');
+ $s.=' '.dol_trunc($obj->label, 38, 'middle');
$s.=' ';
$i++;
}
diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php
index 970339e4dbb..8d55bd86adc 100644
--- a/htdocs/core/modules/mailings/pomme.modules.php
+++ b/htdocs/core/modules/mailings/pomme.modules.php
@@ -35,6 +35,10 @@ class mailing_pomme extends MailingTargets
public $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
public $require_module=array(); // Module mailing actif si modules require_module actifs
public $require_admin=1; // Module mailing actif pour user admin ou non
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='user';
/**
diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php
index 68cb49e10d9..e0c148e4f9f 100644
--- a/htdocs/core/modules/mailings/thirdparties.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties.modules.php
@@ -30,6 +30,10 @@ class mailing_thirdparties extends MailingTargets
public $require_admin=0;
public $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='company';
/**
diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
index 75dc4b9499b..7e3b468fc6d 100644
--- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
@@ -28,6 +28,10 @@ class mailing_thirdparties_services_expired extends MailingTargets
public $require_admin=0;
public $require_module=array('contrat');
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='company';
/**
diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php
index 4987c9ebc17..a69800230b1 100644
--- a/htdocs/core/modules/mailings/xinputfile.modules.php
+++ b/htdocs/core/modules/mailings/xinputfile.modules.php
@@ -35,6 +35,10 @@ class mailing_xinputfile extends MailingTargets
public $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
public $require_module=array(); // Module mailing actif si modules require_module actifs
public $require_admin=0; // Module mailing actif pour user admin ou non
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='generic';
public $tooltip='UseFormatFileEmailToTarget';
diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php
index 8d4ecf0b72e..7014f5f894d 100644
--- a/htdocs/core/modules/mailings/xinputuser.modules.php
+++ b/htdocs/core/modules/mailings/xinputuser.modules.php
@@ -35,6 +35,10 @@ class mailing_xinputuser extends MailingTargets
public $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
public $require_module=array(); // Module mailing actif si modules require_module actifs
public $require_admin=0; // Module mailing actif pour user admin ou non
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='generic';
public $tooltip='UseFormatInputEmailToTarget';
diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php
index 720721ac156..47daf430873 100644
--- a/htdocs/core/modules/modBom.class.php
+++ b/htdocs/core/modules/modBom.class.php
@@ -121,7 +121,7 @@ class modBom extends DolibarrModules
// 1=>array('BILLOFMATERIALS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
// );
$this->const = array(
- 1=>array('BOM_ADDON_PDF', 'chaine', 'avalue', 'Name of PDF model of BOM', 0),
+ 1=>array('BOM_ADDON_PDF', 'chaine', 'alpha', 'Name of PDF model of BOM', 0),
2=>array('BOM_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0),
3=>array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0)
);
@@ -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;
@@ -317,21 +317,49 @@ class modBom extends DolibarrModules
*/
public function init($options = '')
{
+ global $conf, $langs;
+
$result=$this->_load_tables('/bom/sql/');
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');
//$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->bom->enabled');
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->bom->enabled');
+
+ // Permissions
+ $this->remove($options);
+
$sql = array();
+ // ODT template
+ $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/boms/template_bom.odt';
+ $dirodt=DOL_DATA_ROOT.'/doctemplates/boms';
+ $dest=$dirodt.'/template_bom.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 = '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/modMargin.class.php b/htdocs/core/modules/modMargin.class.php
index 5ad2ba0d03a..aca3f4686e5 100644
--- a/htdocs/core/modules/modMargin.class.php
+++ b/htdocs/core/modules/modMargin.class.php
@@ -86,7 +86,7 @@ class modMargin extends DolibarrModules
// New pages on tabs
$this->tabs = array(
'product:+margin:Margins:margins:$user->rights->margins->liretous:/margin/tabs/productMargins.php?id=__ID__',
- 'thirdparty:+margin:Margins:margins:empty($user->societe_id) && $user->rights->margins->liretous && ($object->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__'
+ 'thirdparty:+margin:Margins:margins:empty($user->socid) && $user->rights->margins->liretous && ($object->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__'
);
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/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php
index eeef6ab34e5..1477f4d65f3 100644
--- a/htdocs/core/modules/printing/printgcp.modules.php
+++ b/htdocs/core/modules/printing/printgcp.modules.php
@@ -37,6 +37,10 @@ class printing_printgcp extends PrintingDriver
{
public $name = 'printgcp';
public $desc = 'PrintGCPDesc';
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'printer';
public $active = 'PRINTING_PRINTGCP';
public $conf = array();
diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php
index 1d76fe6f574..37659cec199 100644
--- a/htdocs/core/modules/printing/printipp.modules.php
+++ b/htdocs/core/modules/printing/printipp.modules.php
@@ -32,6 +32,10 @@ class printing_printipp extends PrintingDriver
{
public $name = 'printipp';
public $desc = 'PrintIPPDesc';
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'printer';
public $active = 'PRINTING_PRINTIPP';
public $conf = array();
diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php
index 2eaaef08447..7393f0e198d 100644
--- a/htdocs/core/modules/rapport/pdf_paiement.class.php
+++ b/htdocs/core/modules/rapport/pdf_paiement.class.php
@@ -101,7 +101,7 @@ class pdf_paiement
global $conf, $hookmanager, $langs, $user;
$socid=0;
- if ($user->societe_id) $socid=$user->societe_id;
+ if ($user->socid) $socid=$user->socid;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
index 3cc964f9456..97c0744c121 100644
--- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
@@ -276,7 +276,7 @@ class pdf_standard extends ModelePDFStock
$pdf->SetSubject($outputlangs->transnoentities("Stock"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
- $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->libelle));
+ $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->label));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
@@ -334,7 +334,7 @@ class pdf_standard extends ModelePDFStock
$sql = "SELECT label";
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
$sql.= " WHERE fk_product=".$objp->rowid;
- $sql.= " AND lang='". $langs->getDefaultLang() ."'";
+ $sql.= " AND lang='". $db->escape($langs->getDefaultLang()) ."'";
$sql.= " LIMIT 1";
$result = $db->query($sql);
@@ -934,7 +934,7 @@ class pdf_standard extends ModelePDFStock
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
- $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->libelle), '', 'R');
+ $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->label), '', 'R');
$posy+=5;
$pdf->SetFont('', '', $default_font_size - 1);
@@ -958,7 +958,7 @@ class pdf_standard extends ModelePDFStock
$e = new Entrepot($db);
if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0)
{
- $pdf->MultiCell(150, 3, $e->libelle, '', 'R');
+ $pdf->MultiCell(150, 3, $e->label, '', 'R');
}
else
{
diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
index 71e4da43773..9adc6afad9d 100644
--- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
@@ -256,7 +256,7 @@ class pdf_stdmovement extends ModelePDFMovement
$element = 'movement';
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
- $sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,";
+ $sql.= " e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu,";
$sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql.= " m.batch, m.price,";
$sql.= " m.type_mouvement,";
@@ -443,7 +443,7 @@ class pdf_stdmovement extends ModelePDFMovement
$pdf->SetSubject($outputlangs->transnoentities("Stock"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
- $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->libelle));
+ $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->label));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
@@ -587,7 +587,7 @@ class pdf_stdmovement extends ModelePDFMovement
$productlot->sellby= $objp->sellby;
$warehousestatic->id=$objp->entrepot_id;
- $warehousestatic->libelle=$objp->stock;
+ $warehousestatic->label=$objp->warehouse_ref;
$warehousestatic->lieu=$objp->lieu;
$arrayofuniqueproduct[$objp->rowid]=$objp->produit;
@@ -1015,7 +1015,7 @@ class pdf_stdmovement extends ModelePDFMovement
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
- $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->libelle), '', 'R');
+ $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->label), '', 'R');
$posy+=5;
$pdf->SetFont('', '', $default_font_size - 1);
@@ -1039,7 +1039,7 @@ class pdf_stdmovement extends ModelePDFMovement
$e = new MouvementStock($db);
if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0)
{
- $pdf->MultiCell(150, 3, $e->libelle, '', 'R');
+ $pdf->MultiCell(150, 3, $e->label, '', 'R');
}
else
{
diff --git a/htdocs/core/tools.php b/htdocs/core/tools.php
index 4f517603d63..f598bd31d83 100644
--- a/htdocs/core/tools.php
+++ b/htdocs/core/tools.php
@@ -29,7 +29,7 @@ $langs->loadLangs(array("companies","other"));
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid=$user->societe_id;
+if ($user->socid > 0) $socid=$user->socid;
diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php
index d1b1dfe1093..976b571081e 100644
--- a/htdocs/core/tpl/advtarget.tpl.php
+++ b/htdocs/core/tpl/advtarget.tpl.php
@@ -302,10 +302,10 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
);
print '' . "\n";
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) {
- print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
+ print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key]);
print ' ' . "\n";
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) {
- print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
+ print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key]);
print ' ' . "\n";
} else {
print '';
@@ -499,10 +499,10 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
);
print '' . "\n";
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) {
- print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
+ print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key . '_cnct']);
print ' ' . "\n";
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) {
- print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
+ print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key . '_cnct']);
print ' ' . "\n";
} else {
print '';
diff --git a/htdocs/core/tpl/bloc_comment.tpl.php b/htdocs/core/tpl/bloc_comment.tpl.php
index fba0810e7cd..d7b5e5d7532 100644
--- a/htdocs/core/tpl/bloc_comment.tpl.php
+++ b/htdocs/core/tpl/bloc_comment.tpl.php
@@ -36,21 +36,25 @@ print ' ';
print ' ';
print " \n";
-print '';
+if ($action !== 'editcomment')
+{
+ print ' ';
-// Description
-print '';
+ // Description
+ print ' ';
-$desc = GETPOST('comment_description');
+ $desc = GETPOST('comment_description');
-$doleditor = new DolEditor('comment_description', $desc, '', 80, 'dolibarr_notes', 'In', 0, true, true, ROWS_3, '100%');
-print $doleditor->Create(1);
+ $doleditor = new DolEditor('comment_description', $desc, '', 80, 'dolibarr_notes', 'In', 0, true, true, ROWS_3, '100%');
+ print $doleditor->Create(1);
-print ' ';
+ print '';
+
+ print '';
+ print ' ';
+ print ' ';
+}
-print '';
-print ' ';
-print ' ';
print '
';
// List of comments
@@ -91,15 +95,52 @@ if (!empty($object->comments))
print ''; // End comment-right
print ''; // End comment
diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php
index 14c65c9cbf1..c2be08aa5da 100644
--- a/htdocs/core/tpl/notes.tpl.php
+++ b/htdocs/core/tpl/notes.tpl.php
@@ -86,7 +86,7 @@ if ($module != 'product') {
print ''."\n";
print ''."\n";
}
-if (empty($user->societe_id)) {
+if (empty($user->socid)) {
print ''."\n";
print '
'."\n";
print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0);
diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php
index 82362e9d113..157e24f64b9 100644
--- a/htdocs/core/tpl/objectline_title.tpl.php
+++ b/htdocs/core/tpl/objectline_title.tpl.php
@@ -86,7 +86,7 @@ if ($this->situation_cycle_ref) {
print '
' . $langs->trans('TotalHT100Short') . ' ';
}
-if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
+if ($usemargins && ! empty($conf->margin->enabled) && empty($user->socid))
{
if (!empty($user->rights->margins->creer))
{
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index 165a4ba8a9a..ff66726b207 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -257,7 +257,7 @@ if ($this->situation_cycle_ref)
print '' . price($tmp[0]) . ' ';
}
-if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
+if ($usemargins && ! empty($conf->margin->enabled) && empty($user->socid))
{
if (!empty($user->rights->margins->creer)) { ?>
pa_ht); ?>
diff --git a/htdocs/document.php b/htdocs/document.php
index ac7d96e0b03..d31ccc47c48 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -88,7 +88,7 @@ if (empty($original_file) && empty($hashp)) accessforbidden('Bad link. Missing i
if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
// For some module part, dir may be privates
if (in_array($modulepart, array('facture_paiement','unpaid')))
@@ -187,7 +187,7 @@ if (! empty($hashp))
else
{
// Basic protection (against external users only)
- if ($user->societe_id > 0)
+ if ($user->socid > 0)
{
if ($sqlprotectagainstexternals)
{
@@ -199,7 +199,7 @@ else
while ($i < $num)
{
$obj = $db->fetch_object($resql);
- if ($user->societe_id != $obj->fk_soc)
+ if ($user->socid != $obj->fk_soc)
{
$accessallowed=0;
break;
diff --git a/htdocs/don/card.php b/htdocs/don/card.php
index 54d4e392f61..51244206516 100644
--- a/htdocs/don/card.php
+++ b/htdocs/don/card.php
@@ -432,7 +432,7 @@ if ($action == 'create')
print ' ';
// Private note
- if (empty($user->societe_id)) {
+ if (empty($user->socid)) {
print '';
print '' . $langs->trans('NotePrivate') . ' ';
print '';
@@ -564,7 +564,7 @@ if (! empty($id) && $action == 'edit')
}
// Payment mode
print " ".$langs->trans("PaymentMode")." \n";
- if ($object->modepaymentid) $selected = $object->modepaymentid;
+ if ($object->mode_reglement_id) $selected = $object->mode_reglement_id;
else $selected = '';
$form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
print " \n";
@@ -708,7 +708,7 @@ if (! empty($id) && $action != 'edit')
// Payment mode
print "".$langs->trans("PaymentMode")." ";
- $form->form_modes_reglement(null, $object->modepaymentid, 'none');
+ $form->form_modes_reglement(null, $object->mode_reglement_id, 'none');
print " \n";
// Other attributes
@@ -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..4c8c5f73d9b 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -116,17 +116,18 @@ class Don extends CommonObject
/**
* @var array Array of status label
*/
- public $labelstatut;
+ public $labelStatus;
/**
* @var array Array of status label short
*/
- public $labelstatutshort;
+ public $labelStatusShort;
+
- /**
- * Draft
- */
const STATUS_DRAFT = 0;
+ const STATUS_VALIDATED = 1;
+ const STATUS_PAID = 2;
+ const STATUS_CANCELED = -1;
/**
@@ -155,70 +156,32 @@ 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))
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
$langs->load("donations");
- $this->labelstatut[-1]=$langs->trans("Canceled");
- $this->labelstatut[0]=$langs->trans("DonationStatusPromiseNotValidated");
- $this->labelstatut[1]=$langs->trans("DonationStatusPromiseValidated");
- $this->labelstatut[2]=$langs->trans("DonationStatusPaid");
- $this->labelstatutshort[-1]=$langs->trans("Canceled");
- $this->labelstatutshort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
- $this->labelstatutshort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
- $this->labelstatutshort[2]=$langs->trans("DonationStatusPaidShort");
+ $this->labelStatus[-1]=$langs->trans("Canceled");
+ $this->labelStatus[0]=$langs->trans("DonationStatusPromiseNotValidated");
+ $this->labelStatus[1]=$langs->trans("DonationStatusPromiseValidated");
+ $this->labelStatus[2]=$langs->trans("DonationStatusPaid");
+ $this->labelStatusShort[-1]=$langs->trans("Canceled");
+ $this->labelStatusShort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
+ $this->labelStatusShort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
+ $this->labelStatusShort[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->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php
index f28ecddc0eb..d38e19e62f5 100644
--- a/htdocs/don/class/paymentdonation.class.php
+++ b/htdocs/don/class/paymentdonation.class.php
@@ -83,6 +83,10 @@ class PaymentDonation extends CommonObject
*/
public $total;
+ public $type_code;
+ public $type_label;
+
+
/**
* Constructor
*
@@ -121,7 +125,7 @@ class PaymentDonation extends CommonObject
if (isset($this->amount)) $this->amount=trim($this->amount);
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
- if (isset($this->note)) $this->note=trim($this->note);
+ if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
@@ -148,7 +152,7 @@ class PaymentDonation extends CommonObject
$sql.= " VALUES ($this->chid, '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->datepaid)."',";
$sql.= " ".$totalamount.",";
- $sql.= " ".$this->paymenttype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
+ $sql.= " ".$this->paymenttype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".$user->id.",";
$sql.= " 0)";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
@@ -205,11 +209,11 @@ class PaymentDonation extends CommonObject
$sql.= " t.amount,";
$sql.= " t.fk_typepayment,";
$sql.= " t.num_payment,";
- $sql.= " t.note,";
+ $sql.= " t.note as note_public,";
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
- $sql.= " pt.code as type_code, pt.libelle as type_libelle,";
+ $sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
@@ -234,13 +238,13 @@ class PaymentDonation extends CommonObject
$this->amount = $obj->amount;
$this->fk_typepayment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
- $this->note = $obj->note;
+ $this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
- $this->type_libelle = $obj->type_libelle;
+ $this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
@@ -275,7 +279,7 @@ class PaymentDonation extends CommonObject
if (isset($this->amount)) $this->amount=trim($this->amount);
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
- if (isset($this->note)) $this->note=trim($this->note);
+ if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
@@ -292,7 +296,7 @@ class PaymentDonation extends CommonObject
$sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";
$sql.= " fk_typepayment=".(isset($this->fk_typepayment)?$this->fk_typepayment:"null").",";
$sql.= " num_payment=".(isset($this->num_payment)?"'".$this->db->escape($this->num_payment)."'":"null").",";
- $sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
+ $sql.= " note=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
$sql.= " fk_bank=".(isset($this->fk_bank)?$this->fk_bank:"null").",";
$sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").",";
$sql.= " fk_user_modif=".(isset($this->fk_user_modif)?$this->fk_user_modif:"null")."";
@@ -474,11 +478,11 @@ class PaymentDonation extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @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
global $langs;
@@ -505,7 +509,7 @@ class PaymentDonation extends CommonObject
$this->amount='';
$this->fk_typepayment='';
$this->num_payment='';
- $this->note='';
+ $this->note_public='';
$this->fk_bank='';
$this->fk_user_creat='';
$this->fk_user_modif='';
@@ -633,7 +637,6 @@ class PaymentDonation extends CommonObject
$result='';
- if (empty($this->ref)) $this->ref=$this->lib;
$label = $langs->trans("ShowPayment").': '.$this->ref;
if (!empty($this->id))
diff --git a/htdocs/don/document.php b/htdocs/don/document.php
index 93004163b2e..982de549969 100644
--- a/htdocs/don/document.php
+++ b/htdocs/don/document.php
@@ -50,7 +50,7 @@ $confirm = GETPOST('confirm', 'alpha');
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'don', $id, '');
diff --git a/htdocs/don/info.php b/htdocs/don/info.php
index 12444938fdf..c16cfce10bb 100644
--- a/htdocs/don/info.php
+++ b/htdocs/don/info.php
@@ -39,7 +39,7 @@ $action=GETPOST('action', 'alpha');
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'don', $id, '');
$object = new Don($db);
diff --git a/htdocs/don/list.php b/htdocs/don/list.php
index 7d20dc93032..4e9d86af3f8 100644
--- a/htdocs/don/list.php
+++ b/htdocs/don/list.php
@@ -43,7 +43,7 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="d.datedon";
-$statut=(GETPOST("statut", 'intcomma')!='')?GETPOST("statut", 'intcomma'):"-1";
+$search_status=(GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-1";
$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST('search_ref', 'alpha');
$search_company=GETPOST('search_company', 'alpha');
@@ -87,13 +87,13 @@ $donationstatic=new Don($db);
// Genere requete de liste des dons
$sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,";
-$sql.= " d.amount, d.fk_statut as statut, ";
+$sql.= " d.amount, d.fk_statut as status,";
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
-if ($statut != '' && $statut != '-1')
+if ($search_status != '' && $search_status != '-1')
{
- $sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
+ $sql .= " AND d.fk_statut IN (".$db->escape($search_status).")";
}
if (trim($search_ref) != '')
{
@@ -135,9 +135,13 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
- $param = '&statut='.$statut;
- //if ($page > 0) $param.= '&page='.$page;
- if ($optioncss != '') $param.='&optioncss='.$optioncss;
+ $param = '';
+ if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
+ if ($search_status && $search_status != -1) $param .= '&search_status='.urlencode($search_status);
+ if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
+ if ($search_company) $param .= '&search_company='.urlencode($search_company);
+ if ($search_name) $param .= '&search_name='.urlencode($search_name);
+ if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
$newcardbutton='';
if ($user->rights->don->creer)
@@ -257,7 +261,7 @@ if ($resql)
print "\n";
}
print ''.price($objp->amount).' ';
- print ''.$donationstatic->LibStatut($objp->statut, 5).' ';
+ print ''.$donationstatic->LibStatut($objp->status, 5).' ';
print ' ';
print " ";
$i++;
diff --git a/htdocs/don/note.php b/htdocs/don/note.php
index b076ce60350..e1db83bdb7a 100644
--- a/htdocs/don/note.php
+++ b/htdocs/don/note.php
@@ -45,7 +45,7 @@ $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check
$socid=0;
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'don', $id, '');
$object = new Don($db);
diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php
index 4d3299b6699..36b9b78cf10 100644
--- a/htdocs/don/payment/card.php
+++ b/htdocs/don/payment/card.php
@@ -36,7 +36,7 @@ $langs->loadLangs(array("bills","banks","companies"));
$id=GETPOST('rowid')?GETPOST('rowid', 'int'):GETPOST('id', 'int');
$action=GETPOST('action', 'aZ09');
$confirm=GETPOST('confirm');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
// TODO Add rule to restrict access payment
//$result = restrictedArea($user, 'facture', $id,'');
@@ -172,8 +172,8 @@ print ''.$langs->trans('Number').' '.$object->num_payment.'
// Amount
print ''.$langs->trans('Amount').' '.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).' ';
-// Note
-print ''.$langs->trans('Note').' '.nl2br($object->note).' ';
+// Note public
+print ''.$langs->trans('Note').' '.nl2br($object->note_public).' ';
// Bank account
if (! empty($conf->banque->enabled))
@@ -272,7 +272,7 @@ print '';
/*
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
- if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '')
+ if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '')
{
if ($user->rights->facture->paiement)
{
@@ -282,7 +282,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
}
*/
-if ($_GET['action'] == '')
+if (empty($action))
{
if ($user->rights->don->supprimer)
{
diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php
index 71895a7d2c3..6a7871ba31b 100644
--- a/htdocs/don/payment/payment.php
+++ b/htdocs/don/payment/payment.php
@@ -35,10 +35,12 @@ $amounts = array();
// Security check
$socid=0;
-if ($user->societe_id > 0) {
- $socid = $user->societe_id;
+if ($user->socid > 0) {
+ $socid = $user->socid;
}
+$object = new Don($db);
+
/*
* Actions
@@ -59,17 +61,17 @@ if ($action == 'add_payment')
if (! $_POST["paymenttype"] > 0)
{
- $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
$error++;
}
if ($datepaid == '')
{
- $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Date"));
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$error++;
}
if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
{
- $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit"));
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
$error++;
}
@@ -103,9 +105,9 @@ if ($action == 'add_payment')
$payment->chid = $chid;
$payment->datepaid = $datepaid;
$payment->amounts = $amounts; // Tableau de montant
- $payment->paymenttype = $_POST["paymenttype"];
- $payment->num_payment = $_POST["num_payment"];
- $payment->note = $_POST["note"];
+ $payment->paymenttype = GETPOST("paymenttype", 'int');
+ $payment->num_payment = GETPOST("num_payment", 'alphanohtml');
+ $payment->note_public = GETPOST("note_public", 'none');
if (! $error)
{
@@ -143,7 +145,7 @@ if ($action == 'add_payment')
}
}
- $_GET["action"]='create';
+ $action = 'create';
}
@@ -151,26 +153,32 @@ if ($action == 'add_payment')
* View
*/
+$form=new Form($db);
+
llxHeader();
-$form=new Form($db);
+
+$sql = "SELECT sum(p.amount) as total";
+$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
+$sql.= " WHERE p.fk_donation = ".$chid;
+$resql = $db->query($sql);
+if ($resql)
+{
+ $obj=$db->fetch_object($resql);
+ $sumpaid = $obj->total;
+ $db->free();
+}
// Form to create donation payment
-if (GETPOST('action', 'aZ09') == 'create')
+if ($action == 'create')
{
- $don = new Don($db);
- $don->fetch($chid);
+ $object->fetch($chid);
- $total = $don->amount;
+ $total = $object->amount;
print load_fiche_titre($langs->trans("DoPayment"));
- if ($mesg)
- {
- print "
$mesg
";
- }
-
print '
';
print ' ';
print ' ';
@@ -179,47 +187,24 @@ if (GETPOST('action', 'aZ09') == 'create')
dol_fiche_head();
- print '';
-
- print ''.$langs->trans("Donation").' ';
-
- print ''.$langs->trans("Ref").' '.$chid.' ';
- print ''.$langs->trans("Date")." ".dol_print_date($don->date, 'day')." \n";
- print ''.$langs->trans("Amount")." ".price($don->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).' ';
-
- $sql = "SELECT sum(p.amount) as total";
- $sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
- $sql.= " WHERE p.fk_donation = ".$chid;
- $resql = $db->query($sql);
- if ($resql)
- {
- $obj=$db->fetch_object($resql);
- $sumpaid = $obj->total;
- $db->free();
- }
- print ''.$langs->trans("AlreadyPaid").' '.price($sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).' ';
- print ''.$langs->trans("RemainderToPay").' '.price($total-$sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).' ';
-
- print '';
- print "".$langs->trans("Payment").' ';
- print ' ';
+ print '';
print ''.$langs->trans("Date").' ';
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0;
- print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
+ print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1, 0, '', '', $object->date, '', 1, $langs->trans("DonationDate"));
print " ";
print ' ';
print ''.$langs->trans("PaymentMode").' ';
- $form->select_types_paiements(isset($_POST["paymenttype"])?$_POST["paymenttype"]:$don->paymenttype, "paymenttype");
+ $form->select_types_paiements(isset($_POST["paymenttype"])?$_POST["paymenttype"]:$object->paymenttype, "paymenttype");
print " \n";
print ' ';
print '';
print ''.$langs->trans('AccountToCredit').' ';
print '';
- $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$don->accountid, "accountid", 0, '', 1); // Show open bank account list
+ $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$object->accountid, "accountid", 0, '', 1); // Show open bank account list
print ' ';
// Number
@@ -230,7 +215,7 @@ if (GETPOST('action', 'aZ09') == 'create')
print '';
print ''.$langs->trans("Comments").' ';
- print ' ';
+ print ' ';
print ' ';
print '
';
@@ -240,12 +225,13 @@ if (GETPOST('action', 'aZ09') == 'create')
/*
* List of payments on donation
*/
-
+
$num = 1;
$i = 0;
print '';
print '';
+ print ''.$langs->trans("Donation").' ';
print ''.$langs->trans("Amount").' ';
print ''.$langs->trans("AlreadyPaid").' ';
print ''.$langs->trans("RemainderToPay").' ';
@@ -257,10 +243,12 @@ if (GETPOST('action', 'aZ09') == 'create')
while ($i < $num)
{
- $objp = $don;
+ $objp = $object;
print ' ';
+ print ''.$object->getNomUrl(1)." ";
+
print ''.price($objp->amount)." ";
print ''.price($sumpaid)." ";
diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php
index 8a740ff6941..1604ceb3870 100644
--- a/htdocs/don/stats/index.php
+++ b/htdocs/don/stats/index.php
@@ -35,10 +35,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
@@ -72,7 +72,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png';
}
@@ -112,7 +112,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenameamount = $dir.'/shipmentsamountinyear-'.$user->id.'-'.$year.'.png';
}
@@ -150,7 +150,7 @@ if (! $mesg)
/*
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/shipmentsaverage-'.$user->id.'-'.$year.'.png';
}
diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php
index 4c28e4c159d..56120d206b4 100644
--- a/htdocs/ecm/dir_add_card.php
+++ b/htdocs/ecm/dir_add_card.php
@@ -44,10 +44,10 @@ $pageid = GETPOST('pageid', 'int');
if (empty($module)) $module='ecm';
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$section=$urlsection=GETPOST('section', 'alpha');
diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php
index 4e8585508c6..fcfa5b71205 100644
--- a/htdocs/ecm/file_card.php
+++ b/htdocs/ecm/file_card.php
@@ -40,10 +40,10 @@ if (!$user->rights->ecm->setup) accessforbidden();
$socid = GETPOST("socid", "int");
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$sortfield = GETPOST("sortfield", 'alpha');
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 9d78ad5fd32..e51efb01aaa 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
$langs->loadLangs(array("ecm","companies","other","users","orders","propal","bills","contracts"));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ecm', 0);
// Get parameters
diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php
index 86d34080789..2fb4e88368a 100644
--- a/htdocs/ecm/index_auto.php
+++ b/htdocs/ecm/index_auto.php
@@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
$langs->loadLangs(array("ecm","companies","other","users","orders","propal","bills","contracts"));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ecm', 0);
// Get parameters
diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php
index 37f6e22798b..a801b6fca3b 100644
--- a/htdocs/ecm/search.php
+++ b/htdocs/ecm/search.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
$langs->loadLangs(array("ecm","companies","other","users","orders","propal","bills","contracts"));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ecm', '');
// Load permissions
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 7469faaa356..ada3fc1e4a8 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -151,7 +151,12 @@ class EmailCollector extends CommonObject
*/
public $status;
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $tms;
/**
@@ -183,6 +188,10 @@ class EmailCollector extends CommonObject
public $debuginfo;
+ const STATUS_DISABLED = 0;
+ const STATUS_ENABLED = 1;
+
+
/**
* Constructor
*
@@ -506,47 +515,20 @@ class EmailCollector 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[1] = $langs->trans('Enabled');
- $this->labelstatus[0] = $langs->trans('Disabled');
+ $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');
}
- 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], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- }
- elseif ($mode == 3)
- {
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
- elseif ($mode == 4)
- {
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- }
- elseif ($mode == 5)
- {
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
- elseif ($mode == 6)
- {
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
+ $statusType = 'status5';
+ if ($status == self::STATUS_ENABLED) $statusType = 'status4';
+
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php
index 0033b615f8a..77dd8d3a072 100644
--- a/htdocs/emailcollector/class/emailcollectoraction.class.php
+++ b/htdocs/emailcollector/class/emailcollectoraction.class.php
@@ -98,7 +98,13 @@ class EmailCollectorAction extends CommonObject
public $fk_emailcollector;
public $type;
public $actionparam;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $tms;
public $fk_user_creat;
public $fk_user_modif;
@@ -408,46 +414,46 @@ class EmailCollectorAction extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- if (empty($this->labelstatus))
+ if (empty($this->labelStatus))
{
global $langs;
//$langs->load("emailcollector");
- $this->labelstatus[1] = $langs->trans('Enabled');
- $this->labelstatus[0] = $langs->trans('Disabled');
+ $this->labelStatus[1] = $langs->trans('Enabled');
+ $this->labelStatus[0] = $langs->trans('Disabled');
}
if ($mode == 0)
{
- return $this->labelstatus[$status];
+ return $this->labelStatus[$status];
}
elseif ($mode == 1)
{
- return $this->labelstatus[$status];
+ return $this->labelStatus[$status];
}
elseif ($mode == 2)
{
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
+ elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
}
elseif ($mode == 3)
{
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
}
elseif ($mode == 4)
{
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
+ elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
}
elseif ($mode == 5)
{
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
}
elseif ($mode == 6)
{
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
}
}
diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php
index 5a8f3003c84..d9f1cfb0189 100644
--- a/htdocs/emailcollector/class/emailcollectorfilter.class.php
+++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php
@@ -97,7 +97,13 @@ class EmailCollectorFilter extends CommonObject
public $fk_emailcollector;
public $type;
public $rulevalue;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $tms;
public $fk_user_creat;
public $fk_user_modif;
@@ -383,46 +389,46 @@ class EmailCollectorFilter extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- if (empty($this->labelstatus))
+ if (empty($this->labelStatus))
{
global $langs;
//$langs->load("emailcollector");
- $this->labelstatus[1] = $langs->trans('Enabled');
- $this->labelstatus[0] = $langs->trans('Disabled');
+ $this->labelStatus[1] = $langs->trans('Enabled');
+ $this->labelStatus[0] = $langs->trans('Disabled');
}
if ($mode == 0)
{
- return $this->labelstatus[$status];
+ return $this->labelStatus[$status];
}
elseif ($mode == 1)
{
- return $this->labelstatus[$status];
+ return $this->labelStatus[$status];
}
elseif ($mode == 2)
{
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
+ elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
}
elseif ($mode == 3)
{
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
}
elseif ($mode == 4)
{
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
+ elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
}
elseif ($mode == 5)
{
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
}
elseif ($mode == 6)
{
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
}
}
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 536efaf885b..0c5874a5563 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -69,7 +69,7 @@ $line_id = GETPOST('lineid', 'int')?GETPOST('lineid', 'int'):'';
// Security check
$socid='';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
if ($origin == 'expedition') $result=restrictedArea($user, $origin, $id);
else {
@@ -92,6 +92,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$extrafields->fetch_name_optionals_label($object->table_element_line);
+$extrafields->fetch_name_optionals_label(OrderLine::$table_element);
// Load object. Make an object->fetch
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
@@ -301,12 +302,11 @@ if (empty($reshook))
}
// Extrafields
- $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
// Unset extrafield
- if (is_array($extralabelsline)) {
+ if (is_array($extrafields->attributes[$object->table_element_line]['label'])) {
// Get extra fields
- foreach ($extralabelsline as $key => $value) {
+ foreach ($extrafields->attributes[$object->table_element_line]['label'] as $key => $value) {
unset($_POST["options_" . $key]);
}
}
@@ -627,11 +627,10 @@ if (empty($reshook))
$line = new ExpeditionLigne($db);
// Extrafields Lines
- $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
// Unset extrafield POST Data
- if (is_array($extralabelsline)) {
- foreach ($extralabelsline as $key => $value) {
+ if (is_array($extrafields->attributes[$object->table_element_line]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element_line]['label'] as $key => $value) {
unset($_POST["options_" . $key]);
}
}
@@ -981,7 +980,7 @@ if ($action == 'create')
print " ";
// Note Private
- if ($object->note_private && ! $user->societe_id)
+ if ($object->note_private && ! $user->socid)
{
print ''.$langs->trans("NotePrivate").' ';
print '';
@@ -1031,7 +1030,6 @@ if ($action == 'create')
if (empty($reshook)) {
// copy from order
- $extrafields->fetch_name_optionals_label($object->table_element);
if ($object->fetch_optionals() > 0) {
$expe->array_options = array_merge($expe->array_options, $object->array_options);
}
@@ -1368,7 +1366,7 @@ if ($action == 'create')
print ' ';
print '';
- print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle);
+ print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->label);
print ' ';
}
}
@@ -1550,7 +1548,7 @@ if ($action == 'create')
{
$warehouseObject=new Entrepot($db);
$warehouseObject->fetch($warehouse_selected_id);
- print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle);
+ print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->label);
}
else
{
@@ -1572,11 +1570,9 @@ if ($action == 'create')
{
//var_dump($line);
$colspan=5;
- $extrafields->fetch_name_optionals_label($expe->table_element_line);
$expLine = new ExpeditionLigne($db);
$srcLine = new OrderLine($db);
- $extrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline
//$line->fetch_optionals($line->id);
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
@@ -2464,8 +2460,6 @@ elseif ($id || $ref)
$lines[$i]->fetch_optionals($lines[$i]->id);
- $extrafields->fetch_name_optionals_label($lines[$i]->table_element);
-
print '';
if ($action == 'editline' && $lines[$i]->id == $line_id)
{
@@ -2498,7 +2492,7 @@ elseif ($id || $ref)
* Boutons actions
*/
- if (($user->societe_id == 0) && ($action!='presend'))
+ if (($user->socid == 0) && ($action!='presend'))
{
print '';
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 0c340bc8695..2e61ad47733 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -143,7 +143,12 @@ class Expedition extends CommonObject
*/
public $date_shipping;
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $date_valid;
public $meths;
@@ -1668,44 +1673,44 @@ class Expedition extends CommonObject
/**
* Return label of a status
*
- * @param int $statut Id statut
+ * @param int $status Id statut
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
* @return string Label of status
*/
- public function LibStatut($statut, $mode)
+ public function LibStatut($status, $mode)
{
// phpcs:enable
global $langs;
if ($mode==0)
{
- if ($statut==0) return $langs->trans($this->statuts[$statut]);
- elseif ($statut==1) return $langs->trans($this->statuts[$statut]);
- elseif ($statut==2) return $langs->trans($this->statuts[$statut]);
+ if ($status==0) return $langs->trans($this->statuts[$status]);
+ elseif ($status==1) return $langs->trans($this->statuts[$status]);
+ elseif ($status==2) return $langs->trans($this->statuts[$status]);
}
elseif ($mode==1)
{
- if ($statut==0) return $langs->trans($this->statutshorts[$statut]);
- elseif ($statut==1) return $langs->trans($this->statutshorts[$statut]);
- elseif ($statut==2) return $langs->trans($this->statutshorts[$statut]);
+ if ($status==0) return $langs->trans($this->statutshorts[$status]);
+ elseif ($status==1) return $langs->trans($this->statutshorts[$status]);
+ elseif ($status==2) return $langs->trans($this->statutshorts[$status]);
}
elseif ($mode == 3)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
- elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4');
- elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
+ if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0');
+ elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4');
+ elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6');
}
elseif ($mode == 4)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
+ if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]);
}
elseif ($mode == 5)
{
- if ($statut==0) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
- elseif ($statut==1) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4');
- elseif ($statut==2) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
+ if ($status==0) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut0');
+ elseif ($status==1) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut4');
+ elseif ($status==2) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6');
}
}
@@ -1777,7 +1782,8 @@ class Expedition extends CommonObject
{
$line=new ExpeditionLigne($this->db);
$line->desc=$langs->trans("Description")." ".$xnbp;
- $line->libelle=$langs->trans("Description")." ".$xnbp;
+ $line->libelle=$langs->trans("Description")." ".$xnbp; // deprecated
+ $line->label=$langs->trans("Description")." ".$xnbp;
$line->qty=10;
$line->qty_asked=5;
$line->qty_shipped=4;
@@ -1836,7 +1842,7 @@ class Expedition extends CommonObject
global $langs;
$this->meths = array();
- $sql = "SELECT em.rowid, em.code, em.libelle";
+ $sql = "SELECT em.rowid, em.code, em.libelle as label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
$sql.= " WHERE em.active = 1";
$sql.= " ORDER BY em.libelle ASC";
@@ -1847,7 +1853,7 @@ class Expedition extends CommonObject
while ($obj = $this->db->fetch_object($resql))
{
$label=$langs->trans('SendingMethod'.$obj->code);
- $this->meths[$obj->rowid] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
+ $this->meths[$obj->rowid] = ($label != 'SendingMethod'.$obj->code?$label:$obj->label);
}
}
}
@@ -1867,7 +1873,7 @@ class Expedition extends CommonObject
$this->listmeths = array();
$i=0;
- $sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active";
+ $sql = "SELECT em.rowid, em.code, em.libelle as label, em.description, em.tracking, em.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
if ($id!='') $sql.= " WHERE em.rowid=".$id;
@@ -1879,7 +1885,7 @@ class Expedition extends CommonObject
$this->listmeths[$i]['rowid'] = $obj->rowid;
$this->listmeths[$i]['code'] = $obj->code;
$label=$langs->trans('SendingMethod'.$obj->code);
- $this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
+ $this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->label);
$this->listmeths[$i]['description'] = $obj->description;
$this->listmeths[$i]['tracking'] = $obj->tracking;
$this->listmeths[$i]['active'] = $obj->active;
diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php
index b8e6af1db85..1cd050cb89e 100644
--- a/htdocs/expedition/contact.php
+++ b/htdocs/expedition/contact.php
@@ -42,7 +42,7 @@ $ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'expedition', $id, '');
$object = new Expedition($db);
diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php
index 9faaaf1f88e..0018ba3cd06 100644
--- a/htdocs/expedition/document.php
+++ b/htdocs/expedition/document.php
@@ -46,9 +46,9 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref');
// Security check
-if ($user->societe_id)
+if ($user->socid)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result=restrictedArea($user, 'expedition', $id, '');
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 1840569fd0e..888f7037efb 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -46,7 +46,7 @@ $toselect = GETPOST('toselect', 'array');
// Security check
$expeditionid = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'expedition', $expeditionid, '');
$search_ref_exp = GETPOST("search_ref_exp", 'alpha');
diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php
index 25ccf938963..1ae26471eb8 100644
--- a/htdocs/expedition/note.php
+++ b/htdocs/expedition/note.php
@@ -41,7 +41,7 @@ $action=GETPOST('action', 'alpha');
// Security check
$socid='';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, $origin, $origin_id);
$object = new Expedition($db);
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index a5c9125d844..2bc1e9a23ef 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -53,7 +53,7 @@ $hookmanager->initHooks(array('ordershipmentcard'));
// Security check
$socid=0;
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result=restrictedArea($user, 'commande', $id);
$object = new Commande($db);
@@ -856,7 +856,7 @@ if ($id > 0 || ! empty($ref))
* Boutons Actions
*/
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print '
';
diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php
index b6c3f7355a9..b2aea807b5f 100644
--- a/htdocs/expedition/stats/index.php
+++ b/htdocs/expedition/stats/index.php
@@ -34,10 +34,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
@@ -71,7 +71,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png';
}
@@ -111,7 +111,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenameamount = $dir.'/shipmentsamountinyear-'.$user->id.'-'.$year.'.png';
}
@@ -149,7 +149,7 @@ if (! $mesg)
/*
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/shipmentsaverage-'.$user->id.'-'.$year.'.png';
}
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 7a62903dfe6..ecf1803cb50 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -68,7 +68,7 @@ $childids = $user->getAllChildIds(1);
// Security check
$id=GETPOST("id", 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'expensereport', $id, 'expensereport');
@@ -1506,7 +1506,7 @@ if ($action == 'create')
print '
';
print ''.$langs->trans("ModePaiement").' ';
print '';
- $form->select_types_paiements(2, 'fk_c_paiement');
+ $form->select_types_paiements('', 'fk_c_paiement');
print ' ';
print ' ';
}
@@ -1521,7 +1521,7 @@ if ($action == 'create')
print ' ';
// Private note
- if (empty($user->societe_id)) {
+ if (empty($user->socid)) {
print '';
print '' . $langs->trans('NotePrivate') . ' ';
print '';
@@ -1832,7 +1832,7 @@ else
{
print ' ';
print ''.$langs->trans("ModePaiement").' ';
- print ''.$object->libelle_paiement.' ';
+ print ''.$object->fk_c_paiement.' ';
print ' ';
}
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 485373c5840..42011fafaf9 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -46,6 +46,10 @@ class ExpenseReport extends CommonObject
public $table_element_line = 'expensereport_det';
public $fk_element = 'fk_expensereport';
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'trip';
public $lines=array();
@@ -101,9 +105,6 @@ class ExpenseReport extends CommonObject
// Paiement
public $user_paid_infos;
- /*
- END ACTIONS
- */
/**
* Draft status
@@ -198,7 +199,7 @@ class ExpenseReport extends CommonObject
// List of language codes for status
$this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
$this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
- $this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut5');
+ $this->statuts_logo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5');
}
/**
@@ -514,7 +515,7 @@ class ExpenseReport extends CommonObject
$sql.= " d.fk_user_author, d.fk_user_modif, d.fk_user_validator,";
$sql.= " d.fk_user_valid, d.fk_user_approve,";
$sql.= " d.fk_statut as status, d.fk_c_paiement, d.paid,";
- $sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement
+ $sql.= " dp.libelle as label_payment, dp.code as code_paiement"; // INNER JOIN paiement
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id";
if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'";
@@ -570,15 +571,13 @@ class ExpenseReport extends CommonObject
$this->fk_c_paiement = $obj->fk_c_paiement;
$this->paid = $obj->paid;
- if ($this->fk_statut==5 || $this->fk_statut==6)
+ if ($this->fk_statut == self::STATUS_APPROVED || $this->fk_statut == self::STATUS_CLOSED)
{
$user_valid = new User($this->db);
if ($this->fk_user_valid > 0) $user_valid->fetch($this->fk_user_valid);
$this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname);
}
- $this->libelle_statut = $obj->libelle_statut;
- $this->libelle_paiement = $obj->libelle_paiement;
$this->code_statut = $obj->code_statut;
$this->code_paiement = $obj->code_paiement;
@@ -683,29 +682,15 @@ class ExpenseReport extends CommonObject
*/
public function LibStatut($status, $mode = 0)
{
- // phpcs:enable
- global $langs;
+ // phpcs:enable
+ global $langs;
- if ($mode == 0)
- return $langs->transnoentities($this->statuts[$status]);
+ $labelStatus = $langs->trans($this->statuts[$status]);
+ $labelStatusShort = $langs->trans($this->statuts_short[$status]);
- elseif ($mode == 1)
- return $langs->transnoentities($this->statuts_short[$status]);
+ $statusType = $this->statuts_logo[$status];
- elseif ($mode == 2)
- return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]);
-
- elseif ($mode == 3)
- return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
-
- elseif ($mode == 4)
- return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]);
-
- elseif ($mode == 5)
- return ''.$langs->transnoentities($this->statuts_short[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
-
- elseif ($mode == 6)
- return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
+ return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}
@@ -2351,7 +2336,7 @@ class ExpenseReport extends CommonObject
// phpcs:enable
global $conf, $langs;
- if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
+ if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe
$now=dol_now();
diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php
index 5c72dd18528..156bd329d49 100644
--- a/htdocs/expensereport/class/paymentexpensereport.class.php
+++ b/htdocs/expensereport/class/paymentexpensereport.class.php
@@ -25,8 +25,8 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
-/** \class PaymentExpenseReport
- * \brief Class to manage payments of expense report
+/**
+ * Class to manage payments of expense report
*/
class PaymentExpenseReport extends CommonObject
{
@@ -83,9 +83,9 @@ class PaymentExpenseReport extends CommonObject
*/
public $fk_user_modif;
- //Unknow field
- public $chid;
- public $total;
+ public $type_code;
+ public $type_label;
+
/**
* Constructor
@@ -124,10 +124,10 @@ class PaymentExpenseReport extends CommonObject
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
if (isset($this->note)) $this->note=trim($this->note);
+ if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
- if (! empty($this->fk_expensereport)) $this->chid = $this->fk_expensereport;
$totalamount = 0;
foreach ($this->amounts as $key => $value) // How payment is dispatch
@@ -148,10 +148,10 @@ class PaymentExpenseReport extends CommonObject
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_expensereport (fk_expensereport, datec, datep, amount,";
$sql.= " fk_typepayment, num_payment, note, fk_user_creat, fk_bank)";
- $sql.= " VALUES ($this->chid, '".$this->db->idate($now)."',";
+ $sql.= " VALUES ($this->fk_expensereport, '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->datepaid)."',";
$sql.= " ".$totalamount.",";
- $sql.= " ".$this->fk_typepayment.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
+ $sql.= " ".$this->fk_typepayment.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".$user->id.",";
$sql.= " 0)";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
@@ -188,7 +188,6 @@ class PaymentExpenseReport extends CommonObject
*/
public function fetch($id)
{
- global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.fk_expensereport,";
@@ -198,11 +197,11 @@ class PaymentExpenseReport extends CommonObject
$sql.= " t.amount,";
$sql.= " t.fk_typepayment,";
$sql.= " t.num_payment,";
- $sql.= " t.note,";
+ $sql.= " t.note as note_public,";
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
- $sql.= " pt.code as type_code, pt.libelle as type_libelle,";
+ $sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
@@ -227,13 +226,13 @@ class PaymentExpenseReport extends CommonObject
$this->amount = $obj->amount;
$this->fk_typepayment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
- $this->note = $obj->note;
+ $this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
- $this->type_libelle = $obj->type_libelle;
+ $this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
@@ -476,11 +475,11 @@ class PaymentExpenseReport extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @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
global $langs;
@@ -540,8 +539,7 @@ class PaymentExpenseReport extends CommonObject
$acc->fetch($accountid);
//Fix me field
- $this->total = $this->amount;
- $total = $this->total;
+ $total = $this->amount;
if ($mode == 'payment_expensereport') $amount=$total;
@@ -665,7 +663,7 @@ class PaymentExpenseReport extends CommonObject
$result='';
- if (empty($this->ref)) $this->ref=$this->lib;
+ if (empty($this->ref)) $this->ref=$this->label;
$label = $langs->trans("ShowPayment").': '.$this->ref;
if (!empty($this->id))
diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php
index 6a8bd90f95f..1bf2c0db8da 100644
--- a/htdocs/expensereport/document.php
+++ b/htdocs/expensereport/document.php
@@ -43,7 +43,7 @@ $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'expensereport', $id, 'expensereport');
diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php
index aaffc878046..e893fdf43f4 100644
--- a/htdocs/expensereport/index.php
+++ b/htdocs/expensereport/index.php
@@ -42,7 +42,7 @@ $langs->loadLangs(array('companies', 'users', 'trips'));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'expensereport', '', '');
$sortfield = GETPOST("sortfield", 'alpha');
@@ -165,7 +165,7 @@ $langs->load("boxes");
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as fk_status";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u";
-if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = d.fk_user_author";
// RESTRICT RIGHTS
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
@@ -176,7 +176,7 @@ if (empty($user->rights->expensereport->readall) && empty($user->rights->expense
$sql.= " AND d.fk_user_author IN (".join(',', $childids).")\n";
}
$sql.= ' AND d.entity IN ('.getEntity('expensereport').')';
-if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND d.fk_user_author = ".$socid;
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($max, 0);
@@ -221,7 +221,6 @@ if ($result)
print ''.price($obj->total_ttc).' ';
print ''.dol_print_date($db->jdate($obj->dm), 'day').' ';
print '';
- //print $obj->libelle;
print $expensereportstatic->LibStatut($obj->fk_status, 3);
print ' ';
print '';
diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php
index b9605a92eec..715530e9199 100644
--- a/htdocs/expensereport/info.php
+++ b/htdocs/expensereport/info.php
@@ -33,7 +33,7 @@ $langs->load("trips");
// Security check
$id = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'expensereport', $id, 'expensereport');
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index 5a0bb291596..6f837fb866c 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -53,7 +53,7 @@ $childids = $user->getAllChildIds(1);
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'expensereport', '', '');
$id = GETPOST('id', 'int');
// If we are on the view of a specific user
diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php
index b29e24d4374..a5038b32b0e 100644
--- a/htdocs/expensereport/note.php
+++ b/htdocs/expensereport/note.php
@@ -39,7 +39,7 @@ $action=GETPOST('action', 'alpha');
// Security check
$socid=0;
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'expensereport', $id, 'expensereport');
diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php
index e168c1aa5b8..72b7296ac6b 100644
--- a/htdocs/expensereport/payment/card.php
+++ b/htdocs/expensereport/payment/card.php
@@ -36,7 +36,7 @@ $action=GETPOST('action', 'aZ09');
$confirm=GETPOST('confirm');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
// TODO Add rule to restrict access payment
//$result = restrictedArea($user, 'facture', $id,'');
@@ -162,8 +162,8 @@ print ''.$langs->trans('Numero').' '.$object->num_pa
// Amount
print ' '.$langs->trans('Amount').' '.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).' ';
-// Note
-print ''.$langs->trans('Note').' '.nl2br($object->note).' ';
+// Note public
+print ''.$langs->trans('Note').' '.nl2br($object->note_public).' ';
$disable_delete = 0;
// Bank account
@@ -258,7 +258,7 @@ if ($resql)
print ''.price($objp->amount).' ';
// Remain to pay
- print ''.price($remaintopay).' ';
+ print ''.price($objp->total_ttc - $objp->amount).' ';
// Status
print ''.$expensereport->getLibStatut(4, $objp->amount).' ';
diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php
index 8d1c568332d..7fb79573ab2 100644
--- a/htdocs/expensereport/payment/payment.php
+++ b/htdocs/expensereport/payment/payment.php
@@ -39,9 +39,9 @@ $accountid=GETPOST('accountid', 'int');
// Security check
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
@@ -113,13 +113,13 @@ if ($action == 'add_payment')
// Create a line of payments
$payment = new PaymentExpenseReport($db);
- $payment->chid = $expensereport->id;
+ $payment->fk_expensereport = $expensereport->id;
$payment->datepaid = $datepaid;
$payment->amounts = $amounts; // Tableau de montant
$payment->total = $total;
- $payment->fk_typepayment = $_POST["fk_typepayment"];
- $payment->num_payment = $_POST["num_payment"];
- $payment->note = $_POST["note"];
+ $payment->fk_typepayment = GETPOST("fk_typepayment", 'int');
+ $payment->num_payment = GETPOST("num_payment", 'alphanothtml');
+ $payment->note_public = GETPOST("note_public", 'none');
if (! $error)
{
@@ -239,9 +239,11 @@ if ($action == 'create' || empty($action))
print '
';
- print ' ';
+ print '';
- print '
';
+ dol_fiche_end();
+
+ dol_fiche_head();
print ''."\n";
@@ -274,14 +276,14 @@ if ($action == 'create' || empty($action))
print '';
print ''.$langs->trans("Comments").' ';
- print ' ';
+ print ' ';
print ' ';
print '
';
- print '';
+ dol_fiche_end();
- dol_fiche_end();
+ print ' ';
// List of expenses ereport not already paid completely
$num = 1;
@@ -289,6 +291,7 @@ if ($action == 'create' || empty($action))
print '';
print '';
+ print ''.$langs->trans("ExpenseReport").' ';
print ''.$langs->trans("Amount").' ';
print ''.$langs->trans("AlreadyPaid").' ';
print ''.$langs->trans("RemainderToPay").' ';
@@ -304,6 +307,7 @@ if ($action == 'create' || empty($action))
print ' ';
+ print ''.$expensereport->getNomUrl(1)." ";
print ''.price($objp->total_ttc)." ";
print ''.price($sumpaid)." ";
print ''.price($objp->total_ttc - $sumpaid)." ";
diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php
index 670142836cd..5d6301353db 100644
--- a/htdocs/expensereport/stats/index.php
+++ b/htdocs/expensereport/stats/index.php
@@ -42,12 +42,12 @@ $socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0;
$id = GETPOST('id', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'expensereport', $id, '');
$nowyear=strftime("%Y", dol_now());
@@ -146,7 +146,7 @@ if (! $mesg)
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php
index caead930491..aaf2aec0490 100644
--- a/htdocs/fichinter/card-rec.php
+++ b/htdocs/fichinter/card-rec.php
@@ -52,7 +52,7 @@ $langs->loadLangs(array("interventions","admin","compta","bills"));
// Security check
$id=(GETPOST('fichinterid', 'int')?GETPOST('fichinterid', 'int'):GETPOST('id', 'int'));
$action=GETPOST('action', 'alpha');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$objecttype = 'fichinter_rec';
if ($action == "create" || $action == "add") $objecttype = '';
$result = restrictedArea($user, 'ficheinter', $id, $objecttype);
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 1ed9432ffb0..8bb064ca803 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -74,7 +74,7 @@ $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empt
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -978,7 +978,7 @@ if ($action == 'create')
print ' ';
// Private note
- if (empty($user->societe_id))
+ if (empty($user->socid))
{
print '';
print ''.$langs->trans('NotePrivate').' ';
@@ -1608,7 +1608,7 @@ elseif ($id > 0 || ! empty($ref))
// modified by hook
if (empty($reshook))
{
- if ($user->societe_id == 0)
+ if ($user->socid == 0)
{
if ($action != 'editdescription' && ($action != 'presend')) {
// Validate
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 429341cb490..380204c2b0d 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -160,7 +160,7 @@ class Fichinter extends CommonObject
$sql = "SELECT count(fi.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as fi";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON fi.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@@ -1317,7 +1317,7 @@ class Fichinter extends CommonObject
// phpcs:enable
$this->lines = array();
- $sql = 'SELECT rowid, description, duree, date, rang';
+ $sql = 'SELECT rowid, fk_fichinter, description, duree, date, rang';
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet';
$sql.=' WHERE fk_fichinter = '.$this->id .' ORDER BY rang ASC, date ASC' ;
@@ -1333,6 +1333,7 @@ class Fichinter extends CommonObject
$line = new FichinterLigne($this->db);
$line->id = $objp->rowid;
+ $line->fk_fichinter = $objp->fk_fichinter;
$line->desc = $objp->description;
$line->duration = $objp->duree;
//For invoicing we calculing hours
diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php
index f88653e70eb..f599cccf801 100644
--- a/htdocs/fichinter/class/fichinterrec.class.php
+++ b/htdocs/fichinter/class/fichinterrec.class.php
@@ -42,6 +42,10 @@ class FichinterRec extends Fichinter
public $table_element = 'fichinter_rec';
public $table_element_line = 'fichinter_rec';
public $fk_element = 'fk_fichinter';
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'intervention';
public $title;
@@ -342,12 +346,11 @@ class FichinterRec extends Fichinter
$objp = $this->db->fetch_object($result);
$line = new FichinterLigne($this->db);
- $line->rowid = $objp->rowid;
+ $line->id = $objp->rowid;
$line->label = $objp->custom_label; // Label line
$line->desc = $objp->description; // Description line
$line->product_type = $objp->product_type; // Type of line
$line->product_ref = $objp->product_ref; // Ref product
- $line->libelle = $objp->product_label; // deprecated
$line->product_label = $objp->product_label; // Label product
$line->product_desc = $objp->product_desc; // Description product
$line->fk_product_type = $objp->fk_product_type; // Type of product
diff --git a/htdocs/fichinter/class/fichinterstats.class.php b/htdocs/fichinter/class/fichinterstats.class.php
index d762657caec..98eb218e9ef 100644
--- a/htdocs/fichinter/class/fichinterstats.class.php
+++ b/htdocs/fichinter/class/fichinterstats.class.php
@@ -200,7 +200,7 @@ class FichinterStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, 0 as total, 0 as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
- //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " AND c.rowid = tl.fk_fichinter AND tl.fk_product = product.rowid";
$sql.= " AND c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php
index 1a43bf8e9f8..562a38f7ea8 100644
--- a/htdocs/fichinter/contact.php
+++ b/htdocs/fichinter/contact.php
@@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
$object = new Fichinter($db);
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index f9f67d5a05b..3b6b2bd6299 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -47,7 +47,7 @@ $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php
index 178a7597626..bf20d6b5c12 100644
--- a/htdocs/fichinter/index.php
+++ b/htdocs/fichinter/index.php
@@ -42,10 +42,10 @@ $langs->load("interventions");
// Security check
$socid=GETPOST('socid', 'int');
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
@@ -89,7 +89,7 @@ $sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
$sql.= " AND f.fk_soc = s.rowid";
-if ($user->societe_id) $sql.=' AND f.fk_soc = '.$user->societe_id;
+if ($user->socid) $sql.=' AND f.fk_soc = '.$user->socid;
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY f.fk_statut";
$resql = $db->query($sql);
diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php
index 30aec089ee6..3261ce84d89 100644
--- a/htdocs/fichinter/info.php
+++ b/htdocs/fichinter/info.php
@@ -40,7 +40,7 @@ $id = GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
$object = new Fichinter($db);
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index d45dadf2589..9cee1ec691c 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -59,7 +59,7 @@ $socid=GETPOST('socid', 'int');
// Security check
$id = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
$diroutputmassaction=$conf->ficheinter->dir_output . '/temp/massgeneration/'.$user->id;
diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php
index 954027a99da..2982a0ea8c8 100644
--- a/htdocs/fichinter/note.php
+++ b/htdocs/fichinter/note.php
@@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
$object = new Fichinter($db);
diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php
index 326901728da..02bec47ed86 100644
--- a/htdocs/fichinter/stats/index.php
+++ b/htdocs/fichinter/stats/index.php
@@ -35,10 +35,10 @@ if (! $user->rights->ficheinter->lire) accessforbidden();
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
@@ -77,7 +77,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenamenb = $dir.'/interventionsnbinyear-'.$user->id.'-'.$year.'.png';
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$user->id.'-'.$year.'.png';
@@ -117,7 +117,7 @@ if (! $mesg)
$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenameamount = $dir.'/interventionsamountinyear-'.$user->id.'-'.$year.'.png';
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$user->id.'-'.$year.'.png';
@@ -156,7 +156,7 @@ if (! $mesg)
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/interventionsaverage-'.$user->id.'-'.$year.'.png';
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$user->id.'-'.$year.'.png';
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index de31ae1b624..47f44aff059 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -52,7 +52,7 @@ $cancelbutton = GETPOST('cancel', 'alpha');
// Security check
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
-if ($user->societe_id) $id=$user->societe_id;
+if ($user->socid) $id=$user->socid;
$result = restrictedArea($user, 'societe&fournisseur', $id, '&societe', '', 'rowid');
$object = new Fournisseur($db);
@@ -162,7 +162,7 @@ if ($object->id > 0)
$linkback = ''.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '';
@@ -266,7 +266,7 @@ if ($object->id > 0)
print '
';
print $langs->trans("CustomerRelativeDiscountShort");
print ' ';
- if ($user->rights->societe->creer && !$user->societe_id > 0)
+ if ($user->rights->societe->creer && !$user->socid > 0)
{
print ''.img_edit($langs->trans("Modify")).' ';
}
@@ -280,7 +280,7 @@ if ($object->id > 0)
print ' ';
print $langs->trans("CustomerAbsoluteDiscountShort");
print ' ';
- if ($user->rights->societe->creer && !$user->societe_id > 0)
+ if ($user->rights->societe->creer && !$user->socid > 0)
{
print 'id).'">'.img_edit($langs->trans("Modify")).' ';
}
@@ -706,7 +706,7 @@ if ($object->id > 0)
if ($user->rights->fournisseur->facture->lire)
{
// TODO move to DAO class
- $sql = 'SELECT f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef as df, f.total_ht, f.total_tva, f.total_ttc as amount,f.paye,';
+ $sql = 'SELECT f.rowid, f.libelle as label, f.ref, f.ref_supplier, f.fk_statut, f.datef as df, f.total_ht, f.total_tva, f.total_ttc as amount,f.paye,';
$sql.= ' SUM(pf.amount) as am';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn';
@@ -741,13 +741,14 @@ if ($object->id > 0)
$facturestatic->id=$obj->rowid;
$facturestatic->ref=($obj->ref?$obj->ref:$obj->rowid);
$facturestatic->ref_supplier = $obj->ref_supplier;
- $facturestatic->libelle = $obj->libelle;
+ $facturestatic->libelle = $obj->label; // deprecated
+ $facturestatic->label = $obj->label;
$facturestatic->total_ht = $obj->total_ht;
$facturestatic->total_tva = $obj->total_tva;
$facturestatic->total_ttc = $obj->total_ttc;
print $facturestatic->getNomUrl(1);
print $obj->ref_supplier?' - '.$obj->ref_supplier:'';
- print ($obj->libelle?' - ':'').dol_trunc($obj->libelle, 14);
+ print ($obj->label?' - ':'').dol_trunc($obj->label, 14);
print ' ';
print ''.dol_print_date($db->jdate($obj->df), 'day').' ';
print ''.price($obj->amount).' ';
diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php
index c09c62a4714..37ac4c55e9d 100644
--- a/htdocs/fourn/class/api_supplier_orders.class.php
+++ b/htdocs/fourn/class/api_supplier_orders.class.php
@@ -28,180 +28,180 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
*/
class SupplierOrders extends DolibarrApi
{
- /**
- *
- * @var array $FIELDS Mandatory fields, checked when create and update object
- */
- static $FIELDS = array(
- 'socid'
- );
+ /**
+ *
+ * @var array $FIELDS Mandatory fields, checked when create and update object
+ */
+ static $FIELDS = array(
+ 'socid'
+ );
- /**
- * @var CommandeFournisseur $order {@type CommandeFournisseur}
- */
- public $order;
+ /**
+ * @var CommandeFournisseur $order {@type CommandeFournisseur}
+ */
+ public $order;
- /**
- * Constructor
- */
- public function __construct()
- {
- global $db, $conf;
- $this->db = $db;
- $this->order = new CommandeFournisseur($this->db);
- }
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ global $db, $conf;
+ $this->db = $db;
+ $this->order = new CommandeFournisseur($this->db);
+ }
- /**
- * Get properties of a supplier order object
- *
- * Return an array with supplier order information
- *
- * @param int $id ID of supplier order
- * @return array|mixed data without useless information
- *
- * @throws RestException
- */
- public function get($id)
- {
- if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) {
- throw new RestException(401);
- }
+ /**
+ * Get properties of a supplier order object
+ *
+ * Return an array with supplier order information
+ *
+ * @param int $id ID of supplier order
+ * @return array|mixed data without useless information
+ *
+ * @throws RestException
+ */
+ public function get($id)
+ {
+ if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) {
+ throw new RestException(401);
+ }
- $result = $this->order->fetch($id);
- if ( ! $result ) {
- throw new RestException(404, 'Supplier order not found');
- }
+ $result = $this->order->fetch($id);
+ if ( ! $result ) {
+ throw new RestException(404, 'Supplier order not found');
+ }
- if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
- $this->order->fetchObjectLinked();
- return $this->_cleanObjectDatas($this->order);
- }
+ $this->order->fetchObjectLinked();
+ return $this->_cleanObjectDatas($this->order);
+ }
- /**
- * List orders
- *
- * Get a list of supplier orders
- *
- * @param string $sortfield Sort field
- * @param string $sortorder Sort order
- * @param int $limit Limit for list
- * @param int $page Page number
- * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
- * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused
- * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
- * @return array Array of order objects
- *
- * @throws RestException
- */
- public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
- {
- global $db, $conf;
+ /**
+ * List orders
+ *
+ * Get a list of supplier orders
+ *
+ * @param string $sortfield Sort field
+ * @param string $sortorder Sort order
+ * @param int $limit Limit for list
+ * @param int $page Page number
+ * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
+ * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused
+ * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
+ * @return array Array of order objects
+ *
+ * @throws RestException
+ */
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
+ {
+ global $db, $conf;
- $obj_ret = array();
+ $obj_ret = array();
- // case of external user, $thirdparty_ids param is ignored and replaced by user's socid
- $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids;
+ // case of external user, $thirdparty_ids param is ignored and replaced by user's socid
+ $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids;
- // If the internal user must only see his customers, force searching by him
- $search_sale = 0;
- if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
+ // If the internal user must only see his customers, force searching by him
+ $search_sale = 0;
+ if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
- $sql = "SELECT t.rowid";
- if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
- $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as t";
+ $sql = "SELECT t.rowid";
+ if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
+ $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as t";
- if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
+ if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
- $sql.= ' WHERE t.entity IN ('.getEntity('supplier_order').')';
- if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
- if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
- if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
+ $sql.= ' WHERE t.entity IN ('.getEntity('supplier_order').')';
+ if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
+ if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
+ if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
- // Filter by status
- if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
- if ($status == 'validated') $sql.= " AND t.fk_statut IN (1)";
- if ($status == 'approved') $sql.= " AND t.fk_statut IN (2)";
- if ($status == 'running') $sql.= " AND t.fk_statut IN (3)";
- if ($status == 'received_start') $sql.= " AND t.fk_statut IN (4)";
- if ($status == 'received_end') $sql.= " AND t.fk_statut IN (5)";
- if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (6,7)";
- if ($status == 'refused') $sql.= " AND t.fk_statut IN (9)";
- // Insert sale filter
- if ($search_sale > 0)
- {
- $sql .= " AND sc.fk_user = ".$search_sale;
- }
- // Add sql filters
- if ($sqlfilters)
- {
- if (! DolibarrApi::_checkFilters($sqlfilters))
- {
- throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
- }
- $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
- $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
- }
+ // Filter by status
+ if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
+ if ($status == 'validated') $sql.= " AND t.fk_statut IN (1)";
+ if ($status == 'approved') $sql.= " AND t.fk_statut IN (2)";
+ if ($status == 'running') $sql.= " AND t.fk_statut IN (3)";
+ if ($status == 'received_start') $sql.= " AND t.fk_statut IN (4)";
+ if ($status == 'received_end') $sql.= " AND t.fk_statut IN (5)";
+ if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (6,7)";
+ if ($status == 'refused') $sql.= " AND t.fk_statut IN (9)";
+ // Insert sale filter
+ if ($search_sale > 0)
+ {
+ $sql .= " AND sc.fk_user = ".$search_sale;
+ }
+ // Add sql filters
+ if ($sqlfilters)
+ {
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ }
- $sql.= $db->order($sortfield, $sortorder);
- if ($limit) {
- if ($page < 0)
- {
- $page = 0;
- }
- $offset = $limit * $page;
+ $sql.= $db->order($sortfield, $sortorder);
+ if ($limit) {
+ if ($page < 0)
+ {
+ $page = 0;
+ }
+ $offset = $limit * $page;
- $sql.= $db->plimit($limit + 1, $offset);
- }
+ $sql.= $db->plimit($limit + 1, $offset);
+ }
- $result = $db->query($sql);
- if ($result)
- {
- $i = 0;
- $num = $db->num_rows($result);
- $min = min($num, ($limit <= 0 ? $num : $limit));
- while ($i < $min)
- {
- $obj = $db->fetch_object($result);
- $order_static = new CommandeFournisseur($db);
- if($order_static->fetch($obj->rowid)) {
- $obj_ret[] = $this->_cleanObjectDatas($order_static);
- }
- $i++;
- }
- }
- else {
- throw new RestException(503, 'Error when retrieve supplier order list : '.$db->lasterror());
- }
- if( ! count($obj_ret)) {
- throw new RestException(404, 'No supplier order found');
- }
- return $obj_ret;
- }
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $i = 0;
+ $num = $db->num_rows($result);
+ $min = min($num, ($limit <= 0 ? $num : $limit));
+ while ($i < $min)
+ {
+ $obj = $db->fetch_object($result);
+ $order_static = new CommandeFournisseur($db);
+ if($order_static->fetch($obj->rowid)) {
+ $obj_ret[] = $this->_cleanObjectDatas($order_static);
+ }
+ $i++;
+ }
+ }
+ else {
+ throw new RestException(503, 'Error when retrieve supplier order list : '.$db->lasterror());
+ }
+ if( ! count($obj_ret)) {
+ throw new RestException(404, 'No supplier order found');
+ }
+ return $obj_ret;
+ }
- /**
- * Create supplier order object
- *
- * @param array $request_data Request datas
- * @return int ID of supplier order
- */
- public function post($request_data = null)
- {
- if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
- throw new RestException(401, "Insuffisant rights");
- }
- // Check mandatory fields
- $result = $this->_validate($request_data);
+ /**
+ * Create supplier order object
+ *
+ * @param array $request_data Request datas
+ * @return int ID of supplier order
+ */
+ public function post($request_data = null)
+ {
+ if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
+ throw new RestException(401, "Insuffisant rights");
+ }
+ // Check mandatory fields
+ $result = $this->_validate($request_data);
- foreach($request_data as $field => $value) {
- $this->order->$field = $value;
- }
- if(! array_keys($request_data, 'date')) {
- $this->order->date = dol_now();
- }
- /* We keep lines as an array
+ foreach($request_data as $field => $value) {
+ $this->order->$field = $value;
+ }
+ if(! array_keys($request_data, 'date')) {
+ $this->order->date = dol_now();
+ }
+ /* We keep lines as an array
if (isset($request_data["lines"])) {
$lines = array();
foreach ($request_data["lines"] as $line) {
@@ -210,163 +210,163 @@ class SupplierOrders extends DolibarrApi
$this->order->lines = $lines;
}*/
- if ($this->order->create(DolibarrApiAccess::$user) < 0) {
- throw new RestException(500, "Error creating order", array_merge(array($this->order->error), $this->order->errors));
- }
- return $this->order->id;
- }
+ if ($this->order->create(DolibarrApiAccess::$user) < 0) {
+ throw new RestException(500, "Error creating order", array_merge(array($this->order->error), $this->order->errors));
+ }
+ return $this->order->id;
+ }
- /**
- * Update supplier order
- *
- * @param int $id Id of supplier order to update
- * @param array $request_data Datas
- * @return int
- */
- public function put($id, $request_data = null)
- {
- if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
- throw new RestException(401);
- }
+ /**
+ * Update supplier order
+ *
+ * @param int $id Id of supplier order to update
+ * @param array $request_data Datas
+ * @return int
+ */
+ public function put($id, $request_data = null)
+ {
+ if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
+ throw new RestException(401);
+ }
- $result = $this->order->fetch($id);
- if( ! $result ) {
- throw new RestException(404, 'Supplier order not found');
- }
+ $result = $this->order->fetch($id);
+ if( ! $result ) {
+ throw new RestException(404, 'Supplier order not found');
+ }
- if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
- foreach($request_data as $field => $value) {
- if ($field == 'id') continue;
- $this->order->$field = $value;
- }
+ foreach($request_data as $field => $value) {
+ if ($field == 'id') continue;
+ $this->order->$field = $value;
+ }
- if($this->order->update($id, DolibarrApiAccess::$user))
- return $this->get($id);
+ if($this->order->update($id, DolibarrApiAccess::$user))
+ return $this->get($id);
- return false;
- }
+ return false;
+ }
- /**
- * Delete supplier order
- *
- * @param int $id Supplier order ID
- * @return type
- */
- public function delete($id)
- {
- if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) {
- throw new RestException(401);
- }
- $result = $this->order->fetch($id);
- if ( ! $result) {
- throw new RestException(404, 'Supplier order not found');
- }
+ /**
+ * Delete supplier order
+ *
+ * @param int $id Supplier order ID
+ * @return type
+ */
+ public function delete($id)
+ {
+ if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) {
+ throw new RestException(401);
+ }
+ $result = $this->order->fetch($id);
+ if ( ! $result) {
+ throw new RestException(404, 'Supplier order not found');
+ }
- if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
- if ( $this->order->delete(DolibarrApiAccess::$user) < 0) {
- throw new RestException(500);
- }
+ if ( $this->order->delete(DolibarrApiAccess::$user) < 0) {
+ throw new RestException(500);
+ }
- return array(
- 'success' => array(
- 'code' => 200,
- 'message' => 'Supplier order deleted'
- )
- );
- }
+ return array(
+ 'success' => array(
+ 'code' => 200,
+ 'message' => 'Supplier order deleted'
+ )
+ );
+ }
- /**
- * Validate an order
- *
- * @param int $id Order ID
- * @param int $idwarehouse Warehouse ID
- * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
- *
- * @url POST {id}/validate
- *
- * @return array
- * FIXME An error 403 is returned if the request has an empty body.
- * Error message: "Forbidden: Content type `text/plain` is not supported."
- * Workaround: send this in the body
- * {
- * "idwarehouse": 0,
- * "notrigger": 0
- * }
- */
- public function validate($id, $idwarehouse = 0, $notrigger = 0)
- {
- if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
- throw new RestException(401);
- }
- $result = $this->order->fetch($id);
- if( ! $result ) {
- throw new RestException(404, 'Order not found');
- }
+ /**
+ * Validate an order
+ *
+ * @param int $id Order ID
+ * @param int $idwarehouse Warehouse ID
+ * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
+ *
+ * @url POST {id}/validate
+ *
+ * @return array
+ * FIXME An error 403 is returned if the request has an empty body.
+ * Error message: "Forbidden: Content type `text/plain` is not supported."
+ * Workaround: send this in the body
+ * {
+ * "idwarehouse": 0,
+ * "notrigger": 0
+ * }
+ */
+ public function validate($id, $idwarehouse = 0, $notrigger = 0)
+ {
+ if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
+ throw new RestException(401);
+ }
+ $result = $this->order->fetch($id);
+ if( ! $result ) {
+ throw new RestException(404, 'Order not found');
+ }
- if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
- $result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
- if ($result == 0) {
- throw new RestException(304, 'Error nothing done. May be object is already validated');
- }
- if ($result < 0) {
- throw new RestException(500, 'Error when validating Order: '.$this->order->error);
- }
+ $result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
+ if ($result == 0) {
+ throw new RestException(304, 'Error nothing done. May be object is already validated');
+ }
+ if ($result < 0) {
+ throw new RestException(500, 'Error when validating Order: '.$this->order->error);
+ }
- return array(
- 'success' => array(
- 'code' => 200,
- 'message' => 'Order validated (Ref='.$this->order->ref.')'
- )
- );
- }
+ return array(
+ 'success' => array(
+ 'code' => 200,
+ 'message' => 'Order validated (Ref='.$this->order->ref.')'
+ )
+ );
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
- /**
- * Clean sensible object datas
- *
- * @param Object $object Object to clean
- * @return array Array of cleaned object properties
- */
- protected function _cleanObjectDatas($object)
- {
- // phpcs:enable
- $object = parent::_cleanObjectDatas($object);
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ /**
+ * Clean sensible object datas
+ *
+ * @param Object $object Object to clean
+ * @return array Array of cleaned object properties
+ */
+ protected function _cleanObjectDatas($object)
+ {
+ // phpcs:enable
+ $object = parent::_cleanObjectDatas($object);
- unset($object->rowid);
- unset($object->barcode_type);
- unset($object->barcode_type_code);
- unset($object->barcode_type_label);
- unset($object->barcode_type_coder);
+ unset($object->rowid);
+ unset($object->barcode_type);
+ unset($object->barcode_type_code);
+ unset($object->barcode_type_label);
+ unset($object->barcode_type_coder);
- return $object;
- }
+ return $object;
+ }
- /**
- * Validate fields before create or update object
- *
- * @param array $data Datas to validate
- * @return array
- *
- * @throws RestException
- */
- private function _validate($data)
- {
- $order = array();
- foreach (SupplierOrders::$FIELDS as $field) {
- if (!isset($data[$field]))
- throw new RestException(400, "$field field missing");
- $order[$field] = $data[$field];
- }
- return $order;
- }
+ /**
+ * Validate fields before create or update object
+ *
+ * @param array $data Datas to validate
+ * @return array
+ *
+ * @throws RestException
+ */
+ private function _validate($data)
+ {
+ $order = array();
+ foreach (SupplierOrders::$FIELDS as $field) {
+ if (!isset($data[$field]))
+ throw new RestException(400, "$field field missing");
+ $order[$field] = $data[$field];
+ }
+ return $order;
+ }
}
diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php
index c0473759a6d..711261a161b 100644
--- a/htdocs/fourn/class/fournisseur.class.php
+++ b/htdocs/fourn/class/fournisseur.class.php
@@ -118,7 +118,7 @@ class Fournisseur extends Societe
$sql = "SELECT count(s.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@@ -191,10 +191,10 @@ class Fournisseur extends Societe
$sql = "SELECT s.rowid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fournisseur = 1";
$sql.= " AND s.entity IN (".getEntity('societe').")";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$resql=$this->db->query($sql);
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index a6d4751169e..ab5f2204c83 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -62,7 +62,10 @@ class CommandeFournisseur extends CommonOrder
*/
public $fk_element = 'fk_commande';
- public $picto='order';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
+ public $picto='order';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@@ -439,7 +442,7 @@ class CommandeFournisseur extends CommonOrder
$line->fk_product = $objp->fk_product;
- $line->libelle = $objp->product_label;
+ $line->libelle = $objp->product_label; // deprecated
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc;
@@ -1390,19 +1393,41 @@ class CommandeFournisseur extends CommonOrder
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
+ * @param int $socid Id of thirdparty
* @return int New id of clone
*/
- public function createFromClone(User $user)
+ public function createFromClone(User $user, $socid = 0)
{
- global $hookmanager;
+ global $conf, $user,$hookmanager;
$error=0;
$this->db->begin();
+ // get lines so they will be clone
+ foreach($this->lines as $line)
+ $line->fetch_optionals();
+
// Load source object
$objFrom = clone $this;
+ // Change socid if needed
+ if (! empty($socid) && $socid != $this->socid)
+ {
+ $objsoc = new Societe($this->db);
+
+ if ($objsoc->fetch($socid)>0)
+ {
+ $this->socid = $objsoc->id;
+ $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
+ $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
+ $this->fk_project = 0;
+ $this->fk_delivery_address = 0;
+ }
+
+ // TODO Change product price if multi-prices
+ }
+
$this->id=0;
$this->statut=self::STATUS_DRAFT;
@@ -2349,17 +2374,17 @@ class CommandeFournisseur extends CommonOrder
for ($i = 0; $i < $num; $i++)
{
$prod = new Product($this->db);
- $libelle = '';
+ $label = '';
$ref = '';
if ($prod->fetch($comclient->lines[$i]->fk_product) > 0)
{
- $libelle = $prod->libelle;
- $ref = $prod->ref;
+ $label = $prod->label;
+ $ref = $prod->ref;
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
- $sql .= " (fk_commande,label,description,fk_product, price, qty, tva_tx, localtax1_tx, localtax2_tx, remise_percent, subprice, remise, ref)";
- $sql .= " VALUES (".$idc.", '" . $this->db->escape($libelle) . "','" . $this->db->escape($comclient->lines[$i]->desc) . "'";
+ $sql .= " (fk_commande, label, description, fk_product, price, qty, tva_tx, localtax1_tx, localtax2_tx, remise_percent, subprice, remise, ref)";
+ $sql .= " VALUES (".$idc.", '" . $this->db->escape($label) . "','" . $this->db->escape($comclient->lines[$i]->desc) . "'";
$sql .= ",".$comclient->lines[$i]->fk_product.",'".price2num($comclient->lines[$i]->price)."'";
$sql .= ", '".$comclient->lines[$i]->qty."', ".$comclient->lines[$i]->tva_tx.", ".$comclient->lines[$i]->localtax1_tx.", ".$comclient->lines[$i]->localtax2_tx.", ".$comclient->lines[$i]->remise_percent;
$sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0','".$ref."');";
@@ -2749,7 +2774,7 @@ class CommandeFournisseur extends CommonOrder
$sql = "SELECT count(co.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as co";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@@ -2792,7 +2817,7 @@ class CommandeFournisseur extends CommonOrder
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.fk_statut, c.date_livraison as delivery_date";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@@ -2805,7 +2830,7 @@ class CommandeFournisseur extends CommonOrder
else{
$sql.= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")";
}
- if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
+ if ($user->socid) $sql.=" AND c.fk_soc = ".$user->socid;
$resql=$this->db->query($sql);
if ($resql)
@@ -3586,7 +3611,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
* @param int $notrigger 1=Disable call to triggers
* @return int <0 if KO, >0 if OK
*/
- public function delete($notrigger)
+ public function delete($notrigger = 0)
{
global $user;
@@ -3594,7 +3619,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
$this->db->begin();
- $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->rowid;
+ $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->id;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql=$this->db->query($sql);
diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
index aed9db75a64..b453653c681 100644
--- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
@@ -539,11 +539,11 @@ class CommandeFournisseurDispatch extends CommonObject
/**
* Return label of a status
*
- * @param int $statut Id statut
+ * @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
* @return string Label of status
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -551,33 +551,33 @@ class CommandeFournisseurDispatch extends CommonObject
if ($mode == 0)
{
- return $langs->trans($this->statuts[$statut]);
+ return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 1)
{
- return $langs->trans($this->statutshort[$statut]);
+ return $langs->trans($this->statutshort[$status]);
}
elseif ($mode == 2)
{
- return $langs->trans($this->statuts[$statut]);
+ return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 3)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
- elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4');
- elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8');
+ if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0');
+ elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4');
+ elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut8');
}
elseif ($mode == 4)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]);
+ if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]);
}
elseif ($mode == 5)
{
- if ($statut==0) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
- elseif ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4');
- elseif ($statut==2) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8');
+ if ($status==0) return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut0');
+ elseif ($status==1) return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut4');
+ elseif ($status==2) return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8');
}
}
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 3ea59695819..4cc39f781df 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -63,6 +63,9 @@ class FactureFournisseur extends CommonInvoice
*/
public $fk_element='fk_facture_fourn';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='bill';
/**
@@ -637,6 +640,7 @@ class FactureFournisseur extends CommonInvoice
$this->libelle = $obj->label; // deprecated
$this->label = $obj->label;
$this->paye = $obj->paye;
+ $this->paid = $obj->paye;
$this->amount = $obj->amount;
$this->remise = $obj->remise;
$this->close_code = $obj->close_code;
@@ -2187,12 +2191,12 @@ class FactureFournisseur extends CommonInvoice
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff';
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ' WHERE ff.paye=0';
$sql.= ' AND ff.fk_statut > 0';
$sql.= " AND ff.entity = ".$conf->entity;
- if ($user->societe_id) $sql.=' AND ff.fk_soc = '.$user->societe_id;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
+ if ($user->socid) $sql.=' AND ff.fk_soc = '.$user->socid;
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
$resql=$this->db->query($sql);
if ($resql)
@@ -2490,7 +2494,7 @@ class FactureFournisseur extends CommonInvoice
$sql = "SELECT count(f.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php
index 14d09c20d6e..b18b054a65b 100644
--- a/htdocs/fourn/class/paiementfourn.class.php
+++ b/htdocs/fourn/class/paiementfourn.class.php
@@ -46,6 +46,9 @@ class PaiementFourn extends Paiement
*/
public $table_element='paiementfourn';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'payment';
public $statut; //Status of payment. 0 = unvalidated; 1 = validated
@@ -56,7 +59,7 @@ class PaiementFourn extends Paiement
* Label of payment type
* @var string
*/
- public $type_libelle;
+ public $type_label;
/**
* Code of Payment type
@@ -123,7 +126,7 @@ class PaiementFourn extends Paiement
$this->note = $obj->note;
$this->note_private = $obj->note;
$this->type_code = $obj->paiement_code;
- $this->type_libelle = $obj->paiement_type;
+ $this->type_label = $obj->paiement_type;
$this->statut = $obj->statut;
$error = 1;
}
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 97ce70a8a28..aa3bc8fcbea 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -81,7 +81,7 @@ $datelivraison=dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'),
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -963,7 +963,9 @@ if (empty($reshook))
{
if ($object->id > 0)
{
- $result=$object->createFromClone($user);
+ $orig = clone $object;
+
+ $result=$object->createFromClone($user, $socid);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
@@ -972,6 +974,7 @@ if (empty($reshook))
else
{
setEventMessages($object->error, $object->errors, 'errors');
+ $object = $orig;
$action='';
}
}
@@ -1789,7 +1792,7 @@ elseif (! empty($object->id))
{
// Create an array for form
$formquestion=array(
- //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1)
+ array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.fournisseur=1)'))
);
// Paiement incomplet. On demande si motif = escompte ou autre
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
@@ -2068,7 +2071,7 @@ elseif (! empty($object->id))
print '';
print '';
@@ -2080,29 +2083,33 @@ elseif (! empty($object->id))
print ' ';
// Multicurrency rate
- print '';
- print '';
- print '';
- print ' ';
- if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
- if($action == 'actualizemulticurrencyrate') {
- list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
- }
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
- } else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '';
+ if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
+ {
+ print ' ';
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
+ if($action == 'actualizemulticurrencyrate') {
+ list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
+ }
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ print '';
+ }
}
+ print ' ';
}
- print '';
}
// Bank Account
@@ -2329,7 +2336,7 @@ elseif (! empty($object->id))
* Boutons actions
*/
- if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete')
+ if ($user->socid == 0 && $action != 'editline' && $action != 'delete')
{
print '';
@@ -2891,8 +2898,6 @@ elseif (! empty($object->id))
}
}
-
-
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php
index 4db112bcb0f..63a2935212e 100644
--- a/htdocs/fourn/commande/contact.php
+++ b/htdocs/fourn/commande/contact.php
@@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
$object = new CommandeFournisseur($db);
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index 0884a416d65..0d9782b3683 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -51,8 +51,8 @@ $id = GETPOST("id", 'int');
$ref = GETPOST('ref');
$lineid = GETPOST('lineid', 'int');
$action = GETPOST('action', 'aZ09');
-if ($user->societe_id)
- $socid = $user->societe_id;
+if ($user->socid)
+ $socid = $user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
if (empty($conf->stock->enabled)) {
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index 6ebb83a25dc..8fbe54e8580 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -47,7 +47,7 @@ $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
// Get parameters
diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php
index ec71820ebbb..5a8e0446cea 100644
--- a/htdocs/fourn/commande/index.php
+++ b/htdocs/fourn/commande/index.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
// Security check
$orderid = GETPOST('orderid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande');
$hookmanager = new HookManager($db);
@@ -81,7 +81,7 @@ $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE cf.fk_soc = s.rowid";
$sql.= " AND cf.entity = ".$conf->entity;
-if ($user->societe_id) $sql.=' AND cf.fk_soc = '.$user->societe_id;
+if ($user->socid) $sql.=' AND cf.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY cf.fk_statut";
@@ -117,14 +117,14 @@ if ($resql)
print '
';
print ''.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").' ';
print "\n";
- foreach (array(0,1,2,3,4,5,6) as $statut)
+ foreach (array(0,1,2,3,4,5,6) as $status)
{
- $dataseries[]=array($commandestatic->LibStatut($statut, 1), (isset($vals[$statut])?(int) $vals[$statut]:0));
+ $dataseries[]=array($commandestatic->LibStatut($status, 1), (isset($vals[$status])?(int) $vals[$status]:0));
if (! $conf->use_javascript_ajax)
{
print '';
- print ''.$commandestatic->LibStatut($statut, 0).' ';
- print ''.(isset($vals[$statut])?$vals[$statut]:0).' ';
+ print ''.$commandestatic->LibStatut($status, 0).' ';
+ print ''.(isset($vals[$status])?$vals[$status]:0).' ';
print " \n";
}
}
@@ -168,7 +168,7 @@ $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE cf.fk_soc = s.rowid";
$sql.= " AND s.entity = ".$conf->entity;
-if ($user->societe_id) $sql.=' AND cf.fk_soc = '.$user->societe_id;
+if ($user->socid) $sql.=' AND cf.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY cf.fk_statut";
diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php
index 8b0b17c066b..4f73b373589 100644
--- a/htdocs/fourn/commande/info.php
+++ b/htdocs/fourn/commande/info.php
@@ -53,7 +53,7 @@ $search_agenda_label=GETPOST('search_agenda_label');
// Security check
$socid=0;
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
if (!$user->rights->fournisseur->commande->lire) accessforbidden();
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 4201321913f..f8325ce8b0f 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -91,7 +91,7 @@ $viewstatut=GETPOST('viewstatut');
// Security check
$orderid = GETPOST('orderid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande');
$diroutputmassaction=$conf->fournisseur->commande->dir_output . '/temp/massgeneration/'.$user->id;
diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php
index 61e4029f795..63629af25bb 100644
--- a/htdocs/fourn/commande/note.php
+++ b/htdocs/fourn/commande/note.php
@@ -40,7 +40,7 @@ $ref = GETPOST('ref');
$action = GETPOST('action', 'aZ09');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
$object = new CommandeFournisseur($db);
diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php
index f1b0d3995eb..7005d3029f4 100644
--- a/htdocs/fourn/commande/orderstoinvoice.php
+++ b/htdocs/fourn/commande/orderstoinvoice.php
@@ -139,8 +139,8 @@ if (($action == 'create' || $action == 'add') && ! $error) {
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref') : GETPOST('search_ref');
// Security check
- if ($user->societe_id)
- $socid = $user->societe_id;
+ if ($user->socid)
+ $socid = $user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$usehm = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
@@ -158,17 +158,18 @@ if (($action == 'create' || $action == 'add') && ! $error) {
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
}
if (! $error) {
- $object->ref = GETPOST('ref');
- $object->ref_supplier = GETPOST('ref_supplier');
+ $object->ref = GETPOST('ref', 'nohtml');
+ $object->ref_supplier = GETPOST('ref_supplier', 'alpha');
$object->socid = GETPOST('socid', 'int');
- $object->libelle = GETPOST('libelle');
+ $object->libelle = (GETPOSTISSET('libelle') ? GETPOST('libelle', 'nohtml') : GETPOST('label', 'nohtml'));
+ $object->label = (GETPOSTISSET('libelle') ? GETPOST('libelle', 'nohtml') : GETPOST('label', 'nohtml'));
$object->date = $datefacture;
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public', 'none');
$object->note_private = GETPOST('note_private', 'none');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
- $projectid = GETPOST('projectid');
+ $projectid = GETPOST('projectid', 'int');
if ($projectid > 0)
$object->fk_project = $projectid;
@@ -397,7 +398,7 @@ if ($action == 'create' && !$error) {
print '';
// Private note
- if (empty($user->societe_id)) {
+ if (empty($user->socid)) {
print '';
print '' . $langs->trans('NotePrivate') . ' ';
print '';
diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php
index 99a1c85902a..649c24408a1 100644
--- a/htdocs/fourn/contact.php
+++ b/htdocs/fourn/contact.php
@@ -35,10 +35,10 @@ $langs->load("companies");
llxHeader();
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$sortfield = GETPOST("sortfield", 'alpha');
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 0949b85bd7d..eeed4354ce0 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -95,7 +95,7 @@ if ($id > 0 || ! empty($ref))
// Security check
$socid='';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', $isdraft);
@@ -636,10 +636,10 @@ if (empty($reshook))
$result = $object->fetch(GETPOST('fac_replacement'), 'int');
$object->fetch_thirdparty();
- $object->ref = GETPOST('ref');
+ $object->ref = GETPOST('ref', 'nohtml');
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
$object->socid = GETPOST('socid', 'int');
- $object->libelle = GETPOST('label');
+ $object->libelle = GETPOST('label', 'nohtml');
$object->date = $datefacture;
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public', 'none');
@@ -700,10 +700,11 @@ if (empty($reshook))
$tmpproject = GETPOST('projectid', 'int');
// Creation facture
- $object->ref = $_POST['ref'];
- $object->ref_supplier = $_POST['ref_supplier'];
- $object->socid = $_POST['socid'];
- $object->libelle = $_POST['label'];
+ $object->ref = GETPOST('ref', 'nohtml');
+ $object->ref_supplier = GETPOST('ref_supplier', 'nohtml');
+ $object->socid = GETPOST('socid', 'int');
+ $object->libelle = GETPOST('label', 'nohtml');
+ $object->label = GETPOST('label', 'nohtml');
$object->date = $datefacture;
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public', 'none');
@@ -2556,7 +2557,7 @@ else
print '';
print ' ';
@@ -2568,29 +2569,32 @@ else
print ' ';
// Multicurrency rate
- print '';
- print '';
- print '';
- print ' ';
- if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
- if ($action == 'actualizemulticurrencyrate') {
- list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
- }
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
- } else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '';
+ if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
+ {
+ print ' ';
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
+ if ($action == 'actualizemulticurrencyrate') {
+ list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
+ }
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ print '';
+ }
}
+ print ' ';
}
- print '';
}
// Bank Account
@@ -2785,7 +2789,7 @@ else
}
print '' . price($sign * $objp->amount) . ' ';
print '';
- if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
+ if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0)
{
print 'id.'&action=deletepaiement&paiement_id='.$objp->rowid.'">';
print img_delete();
@@ -3088,13 +3092,13 @@ else
}
// Make payments
- if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
+ if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0)
{
print ''; // must use facid because id is for payment id not invoice
}
// Classify paid
- if ($action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
+ if ($action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0)
{
print '';
diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php
index 2d2f9006632..18f64d15734 100644
--- a/htdocs/fourn/facture/contact.php
+++ b/htdocs/fourn/facture/contact.php
@@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$object = new FactureFournisseur($db);
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index d8cf1ecda27..087325e3de0 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -46,7 +46,7 @@ $confirm=GETPOST('confirm', 'alpha');
$ref = GETPOST('ref', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
// Get parameters
diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php
index 78abccdc250..0a10d58764a 100644
--- a/htdocs/fourn/facture/impayees.php
+++ b/htdocs/fourn/facture/impayees.php
@@ -39,10 +39,10 @@ $socid=GETPOST('socid', 'int');
$option = GETPOST('option');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$sortfield = GETPOST("sortfield", 'alpha');
diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php
index 6b4af5dd290..8f10fd94dc4 100644
--- a/htdocs/fourn/facture/info.php
+++ b/htdocs/fourn/facture/info.php
@@ -40,7 +40,7 @@ $id = GETPOST("facid", 'int')?GETPOST("facid", 'int'):GETPOST("id", 'int');
$ref = GETPOST("ref", 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$object = new FactureFournisseur($db);
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 7c8a78cf8ce..b13e283ea65 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -60,11 +60,11 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'supplier
$socid = GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action='';
$_GET["action"] = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$mode=GETPOST("mode");
diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php
index 03a4dda960e..a7200495e96 100644
--- a/htdocs/fourn/facture/note.php
+++ b/htdocs/fourn/facture/note.php
@@ -40,7 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$object = new FactureFournisseur($db);
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 38136aa3b64..1dc10406a24 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -78,9 +78,9 @@ $multicurrency_amounts=array();
$multicurrency_amountsresttopay=array();
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$object = new PaiementFourn($db);
diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php
index 94ef53f2372..59ad242fa05 100644
--- a/htdocs/fourn/facture/rapport.php
+++ b/htdocs/fourn/facture/rapport.php
@@ -30,16 +30,16 @@ $langs->loadLangs(array('bills'));
// Security check
$socid='';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$action=GETPOST('action', 'aZ09');
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$dir = $conf->fournisseur->facture->dir_output.'/payments';
diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php
index a7107f0a5c8..3615051fa2f 100644
--- a/htdocs/fourn/index.php
+++ b/htdocs/fourn/index.php
@@ -32,7 +32,7 @@ $langs->loadLangs(array("suppliers", "orders", "companies"));
// Security check
$socid = GETPOST("socid", 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $socid, '');
diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php
index 8b65d8be7c0..3977c6ad4be 100644
--- a/htdocs/fourn/paiement/card.php
+++ b/htdocs/fourn/paiement/card.php
@@ -197,7 +197,7 @@ if ($result > 0)
print ' ';
// Payment mode
- $labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
+ $labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_label;
print ''.$langs->trans('PaymentMode').' '.$labeltype;
print $object->num_paiement?' - '.$object->num_paiement:'';
print ' ';
@@ -342,7 +342,7 @@ if ($result > 0)
print '';
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
- if ($user->societe_id == 0 && $object->statut == 0 && $action == '')
+ if ($user->socid == 0 && $object->statut == 0 && $action == '')
{
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
@@ -351,7 +351,7 @@ if ($result > 0)
}
}
}
- if ($user->societe_id == 0 && $action == '')
+ if ($user->socid == 0 && $action == '')
{
if ($user->rights->fournisseur->facture->supprimer)
{
diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php
index b7119e3ae67..860cbde73ba 100644
--- a/htdocs/fourn/product/list.php
+++ b/htdocs/fourn/product/list.php
@@ -54,7 +54,7 @@ if (! $sortfield) $sortfield="p.ref"; // Set here default search field
if (! $sortorder) $sortorder="ASC";
$fourn_id = GETPOST('fourn_id', 'intcomma');
-if ($user->societe_id) $fourn_id=$user->societe_id;
+if ($user->socid) $fourn_id=$user->socid;
$catid = GETPOST('catid', 'intcomma');
diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php
index deee321187b..7f9a7fb11ab 100644
--- a/htdocs/fourn/recap-fourn.php
+++ b/htdocs/fourn/recap-fourn.php
@@ -32,10 +32,10 @@ $langs->loadLangs(array('bills', 'companies'));
// Security check
$socid = GETPOST("socid", 'int');
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
@@ -62,7 +62,7 @@ if ($socid > 0)
$head = societe_prepare_head($societe);
dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($societe, 'socid', '', ($user->socid?0:1), 'rowid', 'nom');
dol_fiche_end();
if (! empty($conf->fournisseur->enabled) && $user->rights->facture->lire)
diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php
index 32d8ed44bb4..354fa5c0921 100644
--- a/htdocs/ftp/index.php
+++ b/htdocs/ftp/index.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
$langs->loadLangs(array('ftp', 'companies', 'other'));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'ftp', '');
// Get parameters
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 605a101ad54..1fedae6a61e 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -48,10 +48,6 @@ $id=GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha');
$fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
-// Protection if external user
-if ($user->societe_id) $socid=$user->societe_id;
-$result = restrictedArea($user, 'holiday', $id, 'holiday');
-
// Load translation files required by the page
$langs->loadLangs(array("holiday","mails"));
@@ -65,14 +61,15 @@ if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
$error = 0;
$object = new Holiday($db);
+
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
-if ($id > 0)
+if (($id > 0) || $ref)
{
- $object->fetch($id);
+ $object->fetch($id, $ref);
// Check current user can read this leave request
$canread = 0;
@@ -92,6 +89,10 @@ $candelete = 0;
if (! empty($user->rights->holiday->delete)) $candelete=1;
if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete=1;
+// Protection if external user
+if ($user->socid) $socid=$user->socid;
+$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
+
/*
* Actions
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index f8e01289740..37d38ea69eb 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -54,6 +54,9 @@ class Holiday extends CommonObject
*/
public $fk_element = 'fk_holiday';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'holiday';
/**
@@ -1217,68 +1220,40 @@ class Holiday extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Returns the label of a statut
+ * Returns the label of a status
*
- * @param int $statut id statut
+ * @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
* @param integer $startdate Date holiday should start
* @return string Label
*/
- public function LibStatut($statut, $mode = 0, $startdate = '')
+ public function LibStatut($status, $mode = 0, $startdate = '')
{
- // phpcs:enable
- global $langs;
-
- if ($mode == 0)
+ // phpcs:enable
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
- if ($statut == 1) return $langs->trans('DraftCP');
- elseif ($statut == 2) return $langs->trans('ToReviewCP');
- elseif ($statut == 3) return $langs->trans('ApprovedCP');
- elseif ($statut == 4) return $langs->trans('CancelCP');
- elseif ($statut == 5) return $langs->trans('RefuseCP');
- }
- elseif ($mode == 2)
- {
- $pictoapproved='statut6';
- if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
- if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0').' '.$langs->trans('DraftCP'); // Draft
- elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1').' '.$langs->trans('ToReviewCP'); // Waiting approval
- elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved).' '.$langs->trans('ApprovedCP');
- elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5').' '.$langs->trans('CancelCP');
- elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5').' '.$langs->trans('RefuseCP');
- }
- elseif ($mode == 3)
- {
- $pictoapproved='statut6';
- if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
- if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0');
- elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1');
- elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved);
- elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5');
- elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5');
- }
- elseif ($mode == 5)
- {
- $pictoapproved='statut6';
- if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
- if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft
- elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval
- elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved);
- elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5');
- elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5');
- }
- elseif ($mode == 6)
- {
- $pictoapproved='statut6';
- if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
- if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft
- elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval
- elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved);
- elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5');
- elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5');
+ global $langs;
+ //$langs->load("mymodule");
+ $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('DraftCP');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP');
+ $this->labelStatus[self::STATUS_APPROVED] = $langs->trans('ApprovedCP');
+ $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('CancelCP');
+ $this->labelStatus[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
+ $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('DraftCP');
+ $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP');
+ $this->labelStatusShort[self::STATUS_APPROVED] = $langs->trans('ApprovedCP');
+ $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('CancelCP');
+ $this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
}
- else return $statut;
+ $statusType = 'status6';
+ if (! empty($startdate) && $startdate > dol_now()) $statusType = 'status4';
+ if ($status == self::STATUS_DRAFT) $statusType = 'status0';
+ if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
+ if ($status == self::STATUS_CANCELED) $statusType = 'status5';
+ if ($status == self::STATUS_REFUSED) $statusType = 'status5';
+
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
@@ -2197,7 +2172,7 @@ class Holiday extends CommonObject
// phpcs:enable
global $conf, $langs;
- if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
+ if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe
$now=dol_now();
diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php
index 9add71da395..3419d663e30 100644
--- a/htdocs/holiday/define_holiday.php
+++ b/htdocs/holiday/define_holiday.php
@@ -53,7 +53,7 @@ if (! $sortorder) $sortorder="ASC";
// Protection if external user
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
// If the user does not have perm to read the page
if (!$user->rights->holiday->read) accessforbidden();
@@ -173,6 +173,10 @@ llxHeader('', $langs->trans('CPTitreMenu'));
$typeleaves=$holiday->getTypes(1, 1);
+$result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user.
+if ($result < 0) {
+ setEventMessages($holiday->error, $holiday->errors, 'errors');
+}
print '
';
@@ -189,21 +193,14 @@ print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');
print ''.$langs->trans('LastUpdateCP').': '."\n";
$lastUpdate = $holiday->getConfCP('lastUpdate');
-if ($lastUpdate)
-{
- $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
- $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
- print ''.dol_print_date($db->jdate($holiday->getConfCP('lastUpdate')), 'dayhour', 'tzuser').' ';
- print ' '.$langs->trans("MonthOfLastMonthlyUpdate").': '.$yearLastUpdate.'-'.$monthLastUpdate.' '."\n";
+if ($lastUpdate) {
+ print ''.dol_print_date($db->jdate($lastUpdate), 'dayhour').' ';
+ print ' '.$langs->trans("MonthOfLastMonthlyUpdate").': '.$langs->trans('Month'.substr($lastUpdate, 4, 2)).' '.substr($lastUpdate, 0, 4).' '."\n";
+} else {
+ print $langs->trans('None');
}
-else print $langs->trans('None');
print "
\n";
-$result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user.
-if ($result < 0)
-{
- setEventMessages($holiday->error, $holiday->errors, 'errors');
-}
$filters = '';
diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php
index 02e29774e93..bbf6cac4c87 100644
--- a/htdocs/holiday/document.php
+++ b/htdocs/holiday/document.php
@@ -45,7 +45,7 @@ $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'holiday', $id, 'holiday');
// Get parameters
diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php
index b86dd2864b5..8b30c03a1a9 100644
--- a/htdocs/holiday/list.php
+++ b/htdocs/holiday/list.php
@@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
$langs->loadLangs(array('users', 'holiday', 'hrm'));
// Protection if external user
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
$action = GETPOST('action', 'aZ09'); // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@@ -59,9 +59,9 @@ $childids = $user->getAllChildIds(1);
// Security check
$socid=0;
-if ($user->societe_id > 0) // Protection if external user
+if ($user->socid > 0) // Protection if external user
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
$result = restrictedArea($user, 'holiday', '', '');
@@ -121,6 +121,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
+ 'cp.ref'=>'Ref',
'cp.description'=>'Description',
'uu.lastname'=>'EmployeeLastname',
'uu.firstname'=>'EmployeeFirstname',
@@ -289,10 +290,7 @@ $sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pou
// Search all
if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
// Ref
-if(!empty($search_ref))
-{
- $sql.= " AND cp.rowid = ".(int) $db->escape($search_ref);
-}
+if (!empty($search_ref)) $sql.= natural_search("cp.ref", $search_ref);
// Start date
$sql.= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
// End date
diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php
index 1d490cc8da3..c09771e47a3 100644
--- a/htdocs/holiday/month_report.php
+++ b/htdocs/holiday/month_report.php
@@ -35,9 +35,9 @@ $langs->loadLangs(array("holiday"));
// Security check
$socid=0;
-if ($user->societe_id > 0) // Protection if external user
+if ($user->socid > 0) // Protection if external user
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
$result = restrictedArea($user, 'holiday', $id, '');
diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php
index 13d4cb7d23a..9e5f0ad0cba 100644
--- a/htdocs/holiday/view_log.php
+++ b/htdocs/holiday/view_log.php
@@ -60,7 +60,7 @@ $pagenext = $page + 1;
// Protection if external user
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
// Si l'utilisateur n'a pas le droit de lire cette page
if(!$user->rights->holiday->read_all) accessforbidden();
diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php
index 863f519231d..20c80d07981 100644
--- a/htdocs/hrm/class/establishment.class.php
+++ b/htdocs/hrm/class/establishment.class.php
@@ -55,7 +55,10 @@ class Establishment extends CommonObject
*/
public $ismultientitymanaged = 1;
- public $picto='building';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
+ public $picto='building';
/**
* @var int ID
diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php
index 9d9d2fcd632..5f390ab1d45 100644
--- a/htdocs/hrm/index.php
+++ b/htdocs/hrm/index.php
@@ -46,7 +46,7 @@ $langs->loadLangs(array('users', 'holidays', 'trips', 'boxes'));
$socid=GETPOST("socid", "int");
// Protection if external user
-if ($user->societe_id > 0) accessforbidden();
+if ($user->socid > 0) accessforbidden();
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
@@ -180,7 +180,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
$sql.= " WHERE u.rowid = x.fk_user";
$sql.= " AND x.entity = ".$conf->entity;
if (empty($user->rights->holiday->read_all)) $sql.=' AND x.fk_user IN ('.join(',', $childids).')';
- //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
//if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid;
$sql.= $db->order("x.tms", "DESC");
$sql.= $db->plimit($max, 0);
@@ -248,93 +248,22 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
}
print '
';
print '
';
+ print ' ';
}
else dol_print_error($db);
}
-// Last expense report (old module)
-if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
-{
- $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
- $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE u.rowid = d.fk_user";
- $sql.= " AND d.entity = ".$conf->entity;
- if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')';
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid;
- $sql.= $db->order("d.tms", "DESC");
- $sql.= $db->plimit($max, 0);
-
- $result = $db->query($sql);
- if ($result)
- {
- $var=false;
- $num = $db->num_rows($result);
-
- $i = 0;
-
- print '';
- print '
';
- print '';
- print ''.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).' ';
- print ''.$langs->trans("FeesKilometersOrAmout").' ';
- print ''.$langs->trans("DateModificationShort").' ';
- print ' ';
- print ' ';
- if ($num)
- {
- $total_ttc = $totalam = $total = 0;
-
- $deplacementstatic=new Deplacement($db);
- $userstatic=new User($db);
- while ($i < $num && $i < $max)
- {
- $obj = $db->fetch_object($result);
-
- $deplacementstatic->ref=$obj->rowid;
- $deplacementstatic->id=$obj->rowid;
-
- $userstatic->id=$obj->uid;
- $userstatic->lastname=$obj->lastname;
- $userstatic->firstname=$obj->firstname;
- $userstatic->login=$obj->login;
- $userstatic->email=$obj->email;
- $userstatic->statut=$obj->statut;
- $userstatic->photo=$obj->photo;
-
- print '';
- print ''.$deplacementstatic->getNomUrl(1).' ';
- print ''.$userstatic->getNomUrl(-1).' ';
- print ''.$obj->km.' ';
- print ''.dol_print_date($db->jdate($obj->dm), 'day').' ';
- print ''.$deplacementstatic->LibStatut($obj->fk_statut, 3).' ';
- print ' ';
-
- $i++;
- }
- }
- else
- {
- print ''.$langs->trans("None").' ';
- }
- print '
';
- print '
';
- }
- else dol_print_error($db);
-}
-
-// Last expense report (new module)
+// Latest expense report
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
{
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u";
- //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = x.fk_user_author";
$sql.= " AND x.entity = ".$conf->entity;
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND x.fk_user_author IN ('.join(',', $childids).')';
- //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
//if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid;
$sql.= $db->order("x.tms", "DESC");
$sql.= $db->plimit($max, 0);
@@ -342,7 +271,6 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
$result = $db->query($sql);
if ($result)
{
- $var=false;
$num = $db->num_rows($result);
$i = 0;
diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php
index f674daddddc..2ce0139f517 100644
--- a/htdocs/imports/index.php
+++ b/htdocs/imports/index.php
@@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/imports/class/import.class.php';
// Load translation files required by the page
$langs->load("exports");
-if (! $user->societe_id == 0)
+if (! $user->socid == 0)
accessforbidden();
$import=new Import($db);
diff --git a/htdocs/index.php b/htdocs/index.php
index 504f77d113e..37ea818817a 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -115,7 +115,7 @@ $boxstatFromHook = '';
// Load translation files required by page
$langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts'));
-if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
+if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{
$object=new stdClass();
$parameters=array();
@@ -437,7 +437,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of transactions to conciliate
- if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id) {
+ if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid) {
include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
$board = new Account($db);
$nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
@@ -447,14 +447,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of cheque to send
- if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
+ if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php';
$board = new RemiseCheque($db);
$dashboardlines['RemiseCheque'] = $board->load_board($user);
}
// Number of foundation members
- if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->societe_id) {
+ if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) {
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
$board = new Adherent($db);
$dashboardlines['Adherent'] = $board->load_board($user);
@@ -887,7 +887,7 @@ $boxlist.=$resultboxes['boxlista'];
$boxlist.= '';
-if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
+if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{
// Remove allready present info in new dash board
if(!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0){
diff --git a/htdocs/install/check.php b/htdocs/install/check.php
index 8b11814c33b..27df27f8c1c 100644
--- a/htdocs/install/check.php
+++ b/htdocs/install/check.php
@@ -389,7 +389,7 @@ else
// Show title
if (! empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ! empty($conf->global->MAIN_VERSION_LAST_INSTALL))
{
- print $langs->trans("VersionLastUpgrade").': '.(empty($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_INSTALL:$conf->global->MAIN_VERSION_LAST_UPGRADE).' ';
+ print $langs->trans("VersionLastUpgrade").': '.(empty($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_INSTALL:$conf->global->MAIN_VERSION_LAST_UPGRADE).' - ';
print $langs->trans("VersionProgram").': '.DOL_VERSION.' ';
//print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired"));
print ' ';
@@ -397,18 +397,17 @@ else
}
else print " \n";
- print $langs->trans("InstallEasy")." ";
- print $langs->trans("ChooseYourSetupMode");
-
- print ' ';
+ //print $langs->trans("InstallEasy")." ";
+ print ''.$langs->trans("ChooseYourSetupMode").'... ';
$foundrecommandedchoice=0;
$available_choices = array();
$notavailable_choices = array();
- // Show first install line
- $choice = "\n".''.$langs->trans("FreshInstall").' ';
+ // Show line of first install choice
+ $choice = ''."\n";
+ $choice .= ''.$langs->trans("FreshInstall").' ';
$choice .= ' ';
$choice .= '';
$choice .= $langs->trans("FreshInstallDesc");
@@ -429,15 +428,16 @@ else
}
else
{
- $choice .= $langs->trans("InstallNotAllowed");
+ $choice .= ($foundrecommandedchoice ? '' : '').$langs->trans("InstallNotAllowed").($foundrecommandedchoice ? ' ' : '');
}
- $choice .= ' ';
+ $choice .= ''."\n";
$choice .= ' '."\n";
+ $positionkey = ($foundrecommandedchoice ? 999 : 0);
if ($allowinstall) {
- $available_choices[] = $choice;
+ $available_choices[$positionkey] = $choice;
} else {
- $notavailable_choices[] = $choice;
+ $notavailable_choices[$positionkey] = $choice;
}
// Show upgrade lines
@@ -508,7 +508,8 @@ else
}
}
- $choice .= "\n".'';
+ $choice .= "\n".''."\n";
+ $choice .= ' ';
$choice .= ''.$langs->trans("Upgrade").' '.$newversionfrom.$newversionfrombis.' -> '.$newversionto.' ';
$choice .= '';
$choice .= $langs->trans("UpgradeDesc");
@@ -541,7 +542,7 @@ else
}
if ($disabled)
{
- $choice .= ''.$langs->trans("NotAvailable").' ';
+ $choice .= ''.$langs->trans("NotYetAvailable").' ';
}
else
{
@@ -556,9 +557,9 @@ else
$choice .= ' '."\n";
if ($allowupgrade) {
- $available_choices[] = $choice;
+ $available_choices[$count] = $choice;
} else {
- $notavailable_choices[] = $choice;
+ $notavailable_choices[$count] = $choice;
}
}
@@ -570,6 +571,7 @@ else
}
// Array of install choices
+ krsort($available_choices, SORT_NATURAL);
print"\n";
print '';
foreach ($available_choices as $choice) {
diff --git a/htdocs/install/default.css b/htdocs/install/default.css
index 0e1e23f8f2c..7a3bb7b3290 100644
--- a/htdocs/install/default.css
+++ b/htdocs/install/default.css
@@ -82,6 +82,9 @@ div.soustitre {
.minwidth400imp { min-width: 400px !important; }
.minwidth500imp { min-width: 500px !important; }
+tr.trlineforchoice {
+ height: 4em;
+}
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
diff --git a/htdocs/install/doctemplates/boms/template_bom.odt b/htdocs/install/doctemplates/boms/template_bom.odt
new file mode 100644
index 00000000000..9eea32e4197
Binary files /dev/null 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 3df02cdc470..a343215c611 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
@@ -46,9 +46,13 @@ UPDATE llx_c_units SET scale = -3, active = 0 WHERE code IN ('L');
UPDATE llx_c_units SET label = 'VolumeUnitm3' WHERE code IN ('M3');
UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
+ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity);
+
-- 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;
@@ -142,9 +146,13 @@ ALTER TABLE llx_stock_mouvement ADD COLUMN fk_projet INTEGER NOT NULL DEFAULT 0
ALTER TABLE llx_oauth_token ADD COLUMN fk_soc integer DEFAULT NULL after token;
-ALTER TABLE llx_mailing ADD COLUMN tms timestamp;
-ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp;
+ALTER TABLE llx_adherent_type ADD COLUMN duration varchar(6) DEFAULT NULL after morphy;
+
+https://www.royalmail.com/track-your-item#/
+https://www.royalmail.com/track-your-item#/
+https://www.royalmail.com/track-your-item#/
+https://www.royalmail.com/track-your-item#/
ALTER TABLE llx_projet ADD COLUMN usage_opportunity integer DEFAULT 0;
ALTER TABLE llx_projet ADD COLUMN usage_task integer DEFAULT 1;
ALTER TABLE llx_projet CHANGE COLUMN bill_time usage_bill_time integer DEFAULT 0; -- rename existing field
@@ -472,3 +480,5 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',410);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',411);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',412);
+
+ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL;
diff --git a/htdocs/install/mysql/tables/llx_adherent_type.sql b/htdocs/install/mysql/tables/llx_adherent_type.sql
index 5a2dee3b12b..1de63a52c1f 100644
--- a/htdocs/install/mysql/tables/llx_adherent_type.sql
+++ b/htdocs/install/mysql/tables/llx_adherent_type.sql
@@ -30,6 +30,7 @@ create table llx_adherent_type
statut smallint NOT NULL DEFAULT 0,
libelle varchar(50) NOT NULL,
morphy varchar(3) NOT NULL,
+ duration varchar(6) NOT NULL DEFAULT NULL,
subscription varchar(3) NOT NULL DEFAULT 'yes',
vote varchar(3) NOT NULL DEFAULT 'yes',
note text,
diff --git a/htdocs/install/mysql/tables/llx_comment.sql b/htdocs/install/mysql/tables/llx_comment.sql
index d881c84c0e3..22b2c40b9f1 100644
--- a/htdocs/install/mysql/tables/llx_comment.sql
+++ b/htdocs/install/mysql/tables/llx_comment.sql
@@ -22,6 +22,7 @@ CREATE TABLE llx_comment (
tms timestamp,
description text NOT NULL,
fk_user_author integer DEFAULT NULL,
+ fk_user_modif integer DEFAULT NULL,
fk_element integer DEFAULT NULL,
element_type varchar(50) DEFAULT NULL,
entity integer DEFAULT 1,
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/install/mysql/tables/llx_product_fournisseur_price_extrafields.key.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.key.sql
new file mode 100644
index 00000000000..b0d9345b604
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.key.sql
@@ -0,0 +1,20 @@
+-- ===================================================================
+-- Copyright (C) 2011 Laurent Destailleur
+--
+-- 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 .
+--
+-- ===================================================================
+
+
+ALTER TABLE llx_product_fournisseur_price_extrafields ADD INDEX idx_product_fournisseur_price_extrafields (fk_object);
diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.sql
new file mode 100644
index 00000000000..51d5499e825
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.sql
@@ -0,0 +1,24 @@
+-- ============================================================================
+-- Copyright (C) 2011 Laurent Destailleur
+--
+-- 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 .
+--
+-- ============================================================================
+
+Create Table llx_product_fournisseur_price_extrafields (
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp,
+ fk_object integer NOT NULL,
+ import_key varchar(14) -- import key
+) ENGINE=innodb;
\ No newline at end of file
diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php
index 517b5843f30..b46e9713983 100644
--- a/htdocs/install/repair.php
+++ b/htdocs/install/repair.php
@@ -1297,7 +1297,7 @@ if ($ok && GETPOST('clean_perm_table', 'alpha'))
{
$listofmods.=($listofmods?',':'')."'".$val."'";
}
- $sql = 'SELECT id, libelle, module from '.MAIN_DB_PREFIX.'rights_def WHERE module not in ('.$listofmods.') AND id > 100000';
+ $sql = 'SELECT id, libelle as label, module from '.MAIN_DB_PREFIX.'rights_def WHERE module not in ('.$listofmods.') AND id > 100000';
$resql = $db->query($sql);
if ($resql)
{
@@ -1310,7 +1310,7 @@ if ($ok && GETPOST('clean_perm_table', 'alpha'))
$obj=$db->fetch_object($resql);
if ($obj->id > 0)
{
- print 'Found line with id '.$obj->id.', label "'.$obj->libelle.'" of module "'.$obj->module.'" to delete';
+ print ' Found line with id '.$obj->id.', label "'.$obj->label.'" of module "'.$obj->module.'" to delete';
if (GETPOST('clean_perm_table', 'alpha') == 'confirmed')
{
$sqldelete = 'DELETE FROM '.MAIN_DB_PREFIX.'rights_def WHERE id = '.$obj->id;
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 29b452e76ba..232cee40440 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -64,7 +64,10 @@ $error = 0;
// Ne fonctionne que si on est pas en safe_mode.
$err=error_reporting();
error_reporting(0);
-@set_time_limit(300);
+if (! empty($conf->global->MAIN_OVERRIDE_TIME_LIMIT))
+ @set_time_limit((int) $conf->global->MAIN_OVERRIDE_TIME_LIMIT);
+else
+ @set_time_limit(600);
error_reporting($err);
$setuplang=GETPOST("selectlang", 'aZ09', 3)?GETPOST("selectlang", 'aZ09', 3):'auto';
diff --git a/htdocs/langs/de_DE/products.lang b/htdocs/langs/de_DE/products.lang
index 6b163a857c8..13c61b3fa67 100644
--- a/htdocs/langs/de_DE/products.lang
+++ b/htdocs/langs/de_DE/products.lang
@@ -341,3 +341,4 @@ ErrorDestinationProductNotFound=Zielprodukt nicht gefunden
ErrorProductCombinationNotFound=Produktvariante nicht gefunden
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
ProductsPricePerCustomer=Product prices per customers
+ProductSupplierExtraFields=Ergänzende Attribute (Lieferantenpreise)
\ No newline at end of file
diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang
index 5edc8d62033..a810c61c8f4 100644
--- a/htdocs/langs/en_US/donations.lang
+++ b/htdocs/langs/en_US/donations.lang
@@ -17,6 +17,7 @@ DonationStatusPromiseNotValidatedShort=Draft
DonationStatusPromiseValidatedShort=Validated
DonationStatusPaidShort=Received
DonationTitle=Donation receipt
+DonationDate=Donation date
DonationDatePayment=Payment date
ValidPromess=Validate promise
DonationReceipt=Donation receipt
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 8bd954b306b..6e3ba31d36c 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -184,6 +184,7 @@ Hide=Hide
ShowCardHere=Show card
Search=Search
SearchOf=Search
+SearchMenuShortCut=Ctrl + shift + f
Valid=Valid
Approve=Approve
Disapprove=Disapprove
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 1f8399d939a..d14aa8a3c71 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -6,7 +6,7 @@ ModuleBuilderDesc2=Path where modules are generated/edited (first directory for
ModuleBuilderDesc3=Generated/editable modules found: %s
ModuleBuilderDesc4=A module is detected as 'editable' when the file %s exists in root of module directory
NewModule=New module
-NewObject=New object
+NewObjectInModulebuilder=New object
ModuleKey=Module key
ObjectKey=Object key
ModuleInitialized=Module initialized
@@ -66,8 +66,8 @@ ReadmeFile=Readme file
ChangeLog=ChangeLog file
TestClassFile=File for PHP Unit Test class
SqlFile=Sql file
-PageForLib=File for PHP library
-PageForObjLib=File for PHP library dedicated to object
+PageForLib=File for the common PHP library
+PageForObjLib=File for the PHP library dedicated to object
SqlFileExtraFields=Sql file for complementary attributes
SqlFileKey=Sql file for keys
SqlFileKeyExtraFields=Sql file for keys of complementary attributes
@@ -124,4 +124,14 @@ UseSpecificEditorURL = Use a specific editor URL
UseSpecificFamily = Use a specific family
UseSpecificAuthor = Use a specific author
UseSpecificVersion = Use a specific initial version
-ModuleMustBeEnabled=The module/application must be enabled first
\ No newline at end of file
+ModuleMustBeEnabled=The module/application must be enabled first
+IncludeRefGeneration=The reference of object must be generated automatically
+IncludeRefGenerationHelp=Check this if you want to include code to manage the generation automatically of the reference
+IncludeDocGeneration=I want to generate some documents from the object
+IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record.
+ShowOnCombobox=Show value into combobox
+KeyForTooltip=Key for tooltip
+CSSClass=CSS Class
+NotEditable=Not editable
+ForeignKey=Foreign key
+TypeOfFieldsHelp=Type of fields: varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
\ No newline at end of file
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/products.lang b/htdocs/langs/en_US/products.lang
index b66d501f3ce..1ca335da637 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -347,3 +347,4 @@ ErrorDestinationProductNotFound=Destination product not found
ErrorProductCombinationNotFound=Product variant not found
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
ProductsPricePerCustomer=Product prices per customers
+ProductSupplierExtraFields=Additional Attributes (Supplier Prices)
\ No newline at end of file
diff --git a/htdocs/langs/en_US/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang
index 756461488cc..aa61848fc9d 100644
--- a/htdocs/langs/en_US/receiptprinter.lang
+++ b/htdocs/langs/en_US/receiptprinter.lang
@@ -26,7 +26,7 @@ PROFILE_P822D=P822D Profile
PROFILE_STAR=Star Profile
PROFILE_DEFAULT_HELP=Default Profile suitable for Epson printers
PROFILE_SIMPLE_HELP=Simple Profile No Graphics
-PROFILE_EPOSTEP_HELP=Epos Tep Profile Help
+PROFILE_EPOSTEP_HELP=Epos Tep Profile
PROFILE_P822D_HELP=P822D Profile No Graphics
PROFILE_STAR_HELP=Star Profile
DOL_ALIGN_LEFT=Left align text
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/livraison/card.php b/htdocs/livraison/card.php
index bf407b8fc90..3f6c6b493b1 100644
--- a/htdocs/livraison/card.php
+++ b/htdocs/livraison/card.php
@@ -56,7 +56,7 @@ $backtopage=GETPOST('backtopage', 'alpha');
// Security check
$id = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'expedition', $id, 'livraison', 'livraison');
$object = new Livraison($db);
@@ -559,7 +559,7 @@ else
$entrepot = new Entrepot($db);
$entrepot->fetch($object->entrepot_id);
print ' '.$langs->trans("Warehouse").' ';
- print ''.$entrepot->libelle.' ';
+ print ''.$entrepot->label.' ';
print ' ';
}
@@ -706,7 +706,7 @@ else
* Boutons actions
*/
- if ($user->societe_id == 0)
+ if ($user->socid == 0)
{
print '';
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index 428015a96f4..c962d1d352e 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -64,10 +64,16 @@ class Livraison extends CommonObject
public $ref_customer;
public $date_delivery; // Date really received
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
public $date_valid;
public $model_pdf;
+
/**
* Constructor
*
@@ -823,44 +829,44 @@ class Livraison extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @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 Label
*/
- public function LibStatut($statut, $mode)
+ public function LibStatut($status, $mode)
{
// phpcs:enable
global $langs;
if ($mode==0)
{
- if ($statut==-1) return $langs->trans('StatusDeliveryCanceled');
- elseif ($statut==0) return $langs->trans('StatusDeliveryDraft');
- elseif ($statut==1) return $langs->trans('StatusDeliveryValidated');
+ if ($status==-1) return $langs->trans('StatusDeliveryCanceled');
+ elseif ($status==0) return $langs->trans('StatusDeliveryDraft');
+ elseif ($status==1) return $langs->trans('StatusDeliveryValidated');
}
elseif ($mode==1)
{
- if ($statut==-1) return $langs->trans($this->statuts[$statut]);
- elseif ($statut==0) return $langs->trans($this->statuts[$statut]);
- elseif ($statut==1) return $langs->trans($this->statuts[$statut]);
+ if ($status==-1) return $langs->trans($this->statuts[$status]);
+ elseif ($status==0) return $langs->trans($this->statuts[$status]);
+ elseif ($status==1) return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 3)
{
- if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
- if ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
- if ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
+ if ($status==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
+ if ($status==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
+ if ($status==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
}
elseif ($mode == 4)
{
- if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5').' '.$langs->trans('StatusDeliveryCanceled');
- elseif ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0').' '.$langs->trans('StatusDeliveryDraft');
- elseif ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4').' '.$langs->trans('StatusDeliveryValidated');
+ if ($status==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5').' '.$langs->trans('StatusDeliveryCanceled');
+ elseif ($status==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0').' '.$langs->trans('StatusDeliveryDraft');
+ elseif ($status==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4').' '.$langs->trans('StatusDeliveryValidated');
}
elseif ($mode == 6)
{
- if ($statut==-1) return $langs->trans('StatusDeliveryCanceled').' '.img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
- elseif ($statut==0) return $langs->trans('StatusDeliveryDraft').' '.img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
- elseif ($statut==1) return $langs->trans('StatusDeliveryValidated').' '.img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
+ if ($status==-1) return $langs->trans('StatusDeliveryCanceled').' '.img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
+ elseif ($status==0) return $langs->trans('StatusDeliveryDraft').' '.img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
+ elseif ($status==1) return $langs->trans('StatusDeliveryValidated').' '.img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
}
}
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index 066399320d8..7cf592a354c 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -44,7 +44,7 @@ $projectid = GETPOST('projectid', 'int');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'loan', $id, '', '');
$object = new Loan($db);
diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php
index c8e241186d2..66fdfbc25a2 100644
--- a/htdocs/loan/class/loan.class.php
+++ b/htdocs/loan/class/loan.class.php
@@ -41,6 +41,9 @@ class Loan extends CommonObject
*/
public $table_element='loan';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'bill';
/**
@@ -63,7 +66,13 @@ class Loan extends CommonObject
public $account_capital;
public $account_insurance;
public $account_interest;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $date_modification;
public $date_validation;
@@ -402,12 +411,12 @@ class Loan extends CommonObject
/**
* Return label for given status
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
- public function LibStatut($statut, $mode = 0, $alreadypaid = -1)
+ public function LibStatut($status, $mode = 0, $alreadypaid = -1)
{
// phpcs:enable
global $langs;
@@ -415,38 +424,38 @@ class Loan extends CommonObject
if ($mode == 0 || $mode == 1)
{
- if ($statut == 0) return $langs->trans("Unpaid");
- elseif ($statut == 1) return $langs->trans("Paid");
+ if ($status == 0) return $langs->trans("Unpaid");
+ elseif ($status == 1) return $langs->trans("Paid");
}
elseif ($mode == 2)
{
- if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
- elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
- elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
+ if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
+ elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
+ elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
elseif ($mode == 3)
{
- if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
- elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
- elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
+ if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
+ elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
+ elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6');
}
elseif ($mode == 4)
{
- if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
- elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
- elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
+ if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
+ elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
+ elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
elseif ($mode == 5)
{
- if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
- elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
- elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
+ if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
+ elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
+ elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
elseif ($mode == 6)
{
- if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
- elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
- elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
+ if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
+ elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
+ elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
else return "Error, mode/status not found";
diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php
index c9a8fd9354e..c5335496313 100644
--- a/htdocs/loan/class/loanschedule.class.php
+++ b/htdocs/loan/class/loanschedule.class.php
@@ -94,6 +94,10 @@ class LoanSchedule extends CommonObject
*/
public $total;
+ public $type_code;
+ public $type_label;
+
+
/**
* Constructor
*
@@ -213,7 +217,7 @@ class LoanSchedule extends CommonObject
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
- $sql.= " pt.code as type_code, pt.libelle as type_libelle,";
+ $sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
@@ -245,7 +249,7 @@ class LoanSchedule extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
- $this->type_libelle = $obj->type_libelle;
+ $this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php
index c938fe92c80..eb0508c3768 100644
--- a/htdocs/loan/class/paymentloan.class.php
+++ b/htdocs/loan/class/paymentloan.class.php
@@ -90,6 +90,10 @@ class PaymentLoan extends CommonObject
*/
public $fk_user_modif;
+ public $type_code;
+ public $type_label;
+
+
/**
* Constructor
*
@@ -208,7 +212,7 @@ class PaymentLoan extends CommonObject
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
- $sql.= " pt.code as type_code, pt.libelle as type_libelle,";
+ $sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
@@ -242,7 +246,7 @@ class PaymentLoan extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
- $this->type_libelle = $obj->type_libelle;
+ $this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
@@ -545,8 +549,6 @@ class PaymentLoan extends CommonObject
$result='';
- if (empty($this->ref)) $this->ref=$this->lib;
-
if (!empty($this->id))
{
$link = '
';
diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php
index 0cbcec2f209..a4bed07949e 100644
--- a/htdocs/loan/document.php
+++ b/htdocs/loan/document.php
@@ -40,7 +40,7 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'loan', $id, '', '');
// Get parameters
diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php
index b4fb8851ad0..618345518ed 100644
--- a/htdocs/loan/info.php
+++ b/htdocs/loan/info.php
@@ -38,7 +38,7 @@ $action=GETPOST('action', 'aZ09');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'loan', $id, '', '');
diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php
index 7af7d55fb43..c77d6b1c855 100644
--- a/htdocs/loan/list.php
+++ b/htdocs/loan/list.php
@@ -32,7 +32,7 @@ $langs->loadLangs(array("loan","compta","banks","bills"));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'loan', '', '', '');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php
index 29b9df4bf70..1f937e6fe77 100644
--- a/htdocs/loan/payment/card.php
+++ b/htdocs/loan/payment/card.php
@@ -33,7 +33,7 @@ $langs->loadLangs(array("bills","banks","companies","loan"));
$id=GETPOST("id", 'int');
$action=GETPOST('action', 'aZ09');
$confirm=GETPOST('confirm');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
@@ -271,7 +271,7 @@ print '';
/*
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
- if ($user->societe_id == 0 && $payment->statut == 0 && $_GET['action'] == '')
+ if ($user->socid == 0 && $payment->statut == 0 && $_GET['action'] == '')
{
if ($user->rights->facture->paiement)
{
diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php
index 6742b0b1c04..742cf5ea5cf 100644
--- a/htdocs/loan/payment/payment.php
+++ b/htdocs/loan/payment/payment.php
@@ -38,9 +38,9 @@ $last=GETPOST('last');
// Security check
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$loan = new Loan($db);
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 0a225bb3aaf..efbe1a03a5e 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1020,7 +1020,7 @@ $heightforframes=50;
// Init menu manager
if (! defined('NOREQUIREMENU'))
{
- if (empty($user->societe_id)) // If internal user or not defined
+ if (empty($user->socid)) // If internal user or not defined
{
$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
}
@@ -1048,7 +1048,7 @@ if (! defined('NOREQUIREMENU'))
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
}
}
- $menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
+ $menumanager = new MenuManager($db, empty($user->socid)?0:1);
$menumanager->loadMenu();
}
@@ -1984,7 +1984,7 @@ function top_menu_bookmark()
*/
function top_menu_search()
{
- global $langs, $conf, $db, $user;
+ global $langs, $conf, $db, $user, $hookmanager;
$html = '';
diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php
index b8f530660f1..a25528f58fb 100644
--- a/htdocs/margin/customerMargins.php
+++ b/htdocs/margin/customerMargins.php
@@ -36,7 +36,7 @@ $socid = GETPOST('socid', 'int');
$TSelectedProducts = GETPOST('products', 'array');
$TSelectedCats = GETPOST('categories', 'array');
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'societe', '', '');
$result = restrictedArea($user, 'margins');
diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php
index a4aed7f668a..cbc134c0b66 100644
--- a/htdocs/margin/productMargins.php
+++ b/htdocs/margin/productMargins.php
@@ -40,7 +40,7 @@ $TSelectedCats=GETPOST('categories', 'array');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
$result=restrictedArea($user, 'margins');
diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php
index 0ad3f2f645b..d9677ffa4da 100644
--- a/htdocs/margin/tabs/productMargins.php
+++ b/htdocs/margin/tabs/productMargins.php
@@ -36,7 +36,7 @@ $confirm=GETPOST('confirm', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
$object = new Product($db);
@@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref))
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref');
print '
';
diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php
index c5d1f0d1e0b..1edd5349467 100644
--- a/htdocs/margin/tabs/thirdpartyMargins.php
+++ b/htdocs/margin/tabs/thirdpartyMargins.php
@@ -30,7 +30,7 @@ $langs->loadLangs(array("companies", "bills", "products", "margins"));
// Security check
$socid = GETPOST('socid', 'int');
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'societe', '', '');
@@ -90,7 +90,7 @@ if ($socid > 0)
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 0bb48af3b46..3879efa2030 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2004-2019 Laurent Destailleur
* Copyright (C) 2018-2019 Nicolas ZABOURI
*
* This program is free software; you can redistribute it and/or modify
@@ -480,10 +480,15 @@ if ($dirins && $action == 'initcss' && !empty($module))
'Mon module'=>$modulename,
'mon module'=>$modulename,
'htdocs/modulebuilder/template'=>strtolower($modulename),
- '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':''),
);
dolReplaceInFile($destfile, $arrayreplacement);
+
+ // Update descriptor file to uncomment file
+ $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
+ $arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/css/'.strtolower($module).'.css.php', '/').'\'/' => '\'/'.strtolower($module).'/css/'.strtolower($module).'.css.php\'');
+ dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
}
else
{
@@ -518,6 +523,11 @@ if ($dirins && $action == 'initjs' && !empty($module))
);
dolReplaceInFile($destfile, $arrayreplacement);
+
+ // Update descriptor file to uncomment file
+ $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
+ $arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/js/'.strtolower($module).'.js.php', '/').'\'/' => '\'/'.strtolower($module).'/js/'.strtolower($module).'.js.php\'');
+ dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
}
else
{
@@ -635,6 +645,14 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module))
$result = dol_delete_file($filetodelete);
if (dol_is_dir_empty($dirtodelete)) dol_delete_dir($dirtodelete);
+
+ // Update descriptor file to comment file
+ if (in_array($tab, array('css', 'js')))
+ {
+ $srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
+ $arrayreplacement = array('/^\s*\''.preg_quote('/'.$relativefilename, '/').'\',*/m'=>' // \'/'.$relativefilename.'\',');
+ dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
+ }
}
}
@@ -792,6 +810,26 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
//'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php',
);
+ if (GETPOST('includerefgeneration', 'aZ09'))
+ {
+ dol_mkdir($destdir.'/core/modules/'.strtolower($module));
+
+ $filetogenerate += array(
+ 'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php',
+ 'core/modules/mymodule/mod_myobject_standard.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_standard.php',
+ 'core/modules/mymodule/modules_myobject.php'=>'core/modules/'.strtolower($module).'/modules_'.strtolower($objectname).'.php',
+ );
+ }
+ if (GETPOST('includedocgeneration', 'aZ09'))
+ {
+ dol_mkdir($destdir.'/core/modules/'.strtolower($module));
+ dol_mkdir($destdir.'/core/modules/'.strtolower($module).'/doc');
+
+ $filetogenerate += array(
+ 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($module).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
+ );
+ }
+
foreach($filetogenerate as $srcfile => $destfile)
{
$result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0);
@@ -810,8 +848,21 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
}
}
- //if (! $error) // If there is error copying 1 file, we still have to make the replacement
- //{
+ // Edit the class 'class/'.strtolower($objectname).'.class.php'
+ if (GETPOST('includerefgeneration', 'aZ09')) {
+ // Replace 'visible'=>1, 'noteditable'=>0, 'default'=>''
+ $arrayreplacement = array('/\'visible\'=>1,\s*\'noteditable\'=>0,\s*\'default\'=>\'\'/' => "'visible'=>4, 'noteditable'=>1, 'default'=>'(PROV)'");
+ //var_dump($arrayreplacement);exit;
+ //var_dump($destdir.'/class/'.strtolower($objectname).'.class.php');exit;
+ dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1);
+ }
+
+ // Edit the setup file and the card page
+ if (GETPOST('includedocgeneration', 'aZ09')) {
+ // TODO
+ // dolReplaceInFile();
+ }
+
// Scan for object class files
$listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$');
@@ -884,15 +935,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
// Add module descriptor to list of files to replace "MyObject' string with real name of object.
$filetogenerate[]='core/modules/mod'.$module.'.class.php';
-
- // TODO
}
- //}
}
if (! $error)
{
- // Edit PHP files
+ // Edit PHP files to make replacement
foreach($filetogenerate as $destfile)
{
$phpfileval['fullname'] = $destdir.'/'.$destfile;
@@ -937,6 +985,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
if (! $error)
{
setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null);
+ $tabobj = $objectname;
}
}
@@ -1105,7 +1154,7 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey)
}
}
-if ($dirins && $action == 'confirm_delete')
+if ($dirins && $action == 'confirm_deletemodule')
{
if (preg_match('/[^a-z0-9_]/i', $module))
{
@@ -1132,8 +1181,6 @@ if ($dirins && $action == 'confirm_delete')
}
}
- //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule');
- //exit;
$action = '';
$module = 'deletemodule';
}
@@ -1155,26 +1202,30 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
$dir = $dirins.'/'.$modulelowercase;
// Delete some files
- $filetogenerate = array(
- 'myobject_card.php'=>strtolower($objectname).'_card.php',
- 'myobject_note.php'=>strtolower($objectname).'_note.php',
- 'myobject_document.php'=>strtolower($objectname).'_document.php',
- 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
- 'myobject_list.php'=>strtolower($objectname).'_list.php',
- 'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php',
- 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
- 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
- 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
- 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
- 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
- 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
- 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
- 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
- 'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php'
+ $filetodelete = array(
+ 'myobject_card.php'=>strtolower($objectname).'_card.php',
+ 'myobject_note.php'=>strtolower($objectname).'_note.php',
+ 'myobject_document.php'=>strtolower($objectname).'_document.php',
+ 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
+ 'myobject_list.php'=>strtolower($objectname).'_list.php',
+ 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
+ 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
+ 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
+ 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
+ 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
+ 'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql',
+ 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
+ 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
+ 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
+ 'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php',
+ 'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php',
+ 'core/modules/mymodule/mod_myobject_standard.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_standard.php',
+ 'core/modules/mymodule/modules_myobject.php'=>'core/modules/'.strtolower($module).'/modules_'.strtolower($objectname).'.php',
+ 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($module).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
);
$resultko = 0;
- foreach($filetogenerate as $filetodelete)
+ foreach($filetodelete as $filetodelete)
{
$resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1);
if (! $resulttmp) $resultko++;
@@ -1190,8 +1241,6 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
}
}
- //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule');
- //exit;
$action = '';
$tabobj = 'deleteobject';
}
@@ -1418,6 +1467,7 @@ if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >=2 ||
// Search modules to edit
print ''."\n";
$listofmodules=array();
+$i=0;
foreach($dirsrootforscan as $dirread)
{
$dirsincustom=dol_dir_list($dirread, 'directories');
@@ -1475,8 +1525,12 @@ foreach($dirsrootforscan as $dirread)
if (empty($newdircustom)) $newdircustom=img_warning();
// If dirread was forced to somewhere else, by using URL
// htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product
- print $langs->trans("DirScanned").' : '.$dirread.' ';
+ if (empty($i)) print $langs->trans("DirScanned").' : ';
+ else print ', ';
+ print ''.$dirread.' ';
+ $i++;
}
+print ' ';
//var_dump($listofmodules);
$message='';
@@ -1508,7 +1562,7 @@ if ($message)
}
//print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).' ';
-$infomodulesfound = ''.$form->textwithpicto($langs->trans("ModuleBuilderDesc3", count($listofmodules)), $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'
';
+$infomodulesfound = ''.$form->textwithpicto(''.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).' ', $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'
';
// Load module descriptor
@@ -1583,16 +1637,17 @@ if ($module == 'initmodule')
print $langs->trans("EnterNameOfModuleDesc").' ';
print ' ';
- print ' ';
+ print ' ';
- print ' ';
+ print ' ';
print '';
}
elseif ($module == 'deletemodule')
{
+ print ''."\n";
print '';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print $langs->trans("EnterNameOfModuleToDeleteDesc").' ';
@@ -1623,23 +1678,23 @@ elseif (! empty($module))
$linktoenabledisable='';
if (! empty($conf->global->$const_name)) // If module is already activated
{
- $linktoenabledisable.='numero.'&action=reset&value=mod' . $module . $param . '">';
- $linktoenabledisable.=img_picto($langs->trans("Activated"), 'switch_on');
+ $linktoenabledisable.=' numero.'&action=reset&value=mod' . $module . $param . '">';
+ $linktoenabledisable.=img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1);
$linktoenabledisable.=' ';
}
else
{
- $linktoenabledisable.='numero.'&action=set&value=mod' . $module . $param . '">';
- $linktoenabledisable.=img_picto($langs->trans("Disabled"), 'switch_off');
+ $linktoenabledisable.=' numero.'&action=set&value=mod' . $module . $param . '">';
+ $linktoenabledisable.=img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', 1);
$linktoenabledisable.=" \n";
}
- if (! empty($conf->$modulelowercase->enabled))
+ if (empty($conf->$modulelowercase->enabled))
{
- $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive");
+ $modulestatusinfo=$form->textwithpicto($langs->trans("ModuleIsNotActive", $urltomodulesetup), '', -1, 'help');
}
else
{
- $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup);
+ $modulestatusinfo=$form->textwithpicto($langs->trans("ModuleIsLive"), $langs->trans("Warning"), -1, 'warning');
}
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:'');
@@ -1719,13 +1774,8 @@ elseif (! empty($module))
// Link to enable / disable
print $modulestatusinfo;
- print ' '.$linktoenabledisable;
- print ' ';
+ print ' '.$linktoenabledisable.' ';
- if (realpath($dirread.'/'.$modulelowercase) != $dirread.'/'.$modulelowercase)
- {
- print ''.$langs->trans("RealPathOfModule").' : '.realpath($dirread.'/'.$modulelowercase).' ';
- }
print ' ';
if ($tab == 'description')
@@ -1738,21 +1788,28 @@ elseif (! empty($module))
{
dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2
- print ''.$langs->trans("ModuleBuilderDesc".$tab).' ';
+ print ''.$langs->trans("ModuleBuilderDesc".$tab).' ';
+ $infoonmodulepath = '';
+ if (realpath($dirread.'/'.$modulelowercase) != $dirread.'/'.$modulelowercase)
+ {
+ $infoonmodulepath = ''.$langs->trans("RealPathOfModule").' : '.realpath($dirread.'/'.$modulelowercase).' ';
+ print ' '.$infoonmodulepath;
+ }
+ print ' ';
print '';
@@ -1913,8 +1970,8 @@ elseif (! empty($module))
{
$pathtofile = $modulelowercase.'/langs/'.$langfile['relativename'];
print ' '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
}
print '
';
@@ -1965,9 +2022,12 @@ elseif (! empty($module))
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' ';
+ print ' '.$langs->trans("LanguageFile").' : ';
+ if (! is_array($dicts) || empty($dicts)) print ''.$langs->trans("NoDictionaries").' ';
+ else print ''.$dicts['langs'].' ';
print ' ';
- print ' '.$langs->trans("LanguageFile").' : '.$dicts['langs'].' ';
print load_fiche_titre($langs->trans("ListOfDictionariesEntries"), '', '');
@@ -2092,7 +2152,7 @@ elseif (! empty($module))
$dir = $dirread.'/'.$modulelowercase.'/class';
$head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject';
- $head3[$h][1] = $langs->trans("NewObject");
+ $head3[$h][1] = ''.$langs->trans("NewObjectInModulebuilder").' ';
$head3[$h][2] = 'newobject';
$h++;
@@ -2144,7 +2204,9 @@ elseif (! empty($module))
print ''.$langs->trans("EnterNameOfObjectDesc").' ';
- print ' ';
+ print ' ';
+ print ' '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).' ';
+ print ' '.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).' ';
print ' ';
print ' ';
print ' ';
@@ -2152,7 +2214,6 @@ elseif (! empty($module))
print $langs->trans("or");
print ' ';
print ' ';
- print ' ';
//print ' ';
print $langs->trans("InitStructureFromExistingTable");
print ' ';
@@ -2415,7 +2476,7 @@ elseif (! empty($module))
print load_fiche_titre($langs->trans("ObjectProperties"), '', '');
-
+ print ''."\n";
print '';
print '
';
print '';
@@ -2425,16 +2486,22 @@ elseif (! empty($module))
print '';
print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey"));
print ' ';
- print ''.$langs->trans("Type").'';
+ print ' '.$form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelp")).' ';
print ''.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).' ';
print ''.$form->textwithpicto($langs->trans("NotNull"), $langs->trans("NotNullDesc")).' ';
print ''.$langs->trans("DefaultValue").' ';
print ''.$langs->trans("DatabaseIndex").' ';
+ print ''.$langs->trans("ForeignKey").' ';
print ''.$langs->trans("Position").' ';
print ''.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).' ';
print ''.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).' ';
- print ''.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).' ';
+ print ''.$langs->trans("NotEditable").' ';
print ''.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).' ';
+ print ''.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).' ';
+ print ''.$langs->trans("CSSClass").' ';
+ print ''.$langs->trans("KeyForTooltip").' ';
+ print ''.$langs->trans("ShowOnCombobox").' ';
+ //print ''.$langs->trans("Disabled").' ';
print ''.$langs->trans("Comment").' ';
print ' ';
print ' ';
@@ -2455,11 +2522,17 @@ elseif (! empty($module))
print ' ';
print ' ';
print ' ';
+ print ' ';
print ' ';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ //print ' ';
print ' ';
print '';
print ' ';
@@ -2486,13 +2559,19 @@ elseif (! empty($module))
$proptype=$propval['type'];
$proparrayofkeyval=$propval['arrayofkeyval'];
$propnotnull=$propval['notnull'];
- $propsearchall=$propval['searchall'];
$propdefault=$propval['default'];
$propindex=$propval['index'];
+ $propforeignkey=$propval['foreignkey'];
$propposition=$propval['position'];
$propenabled=$propval['enabled'];
$propvisible=$propval['visible'];
+ $propnoteditable=$propval['noteditable'];
+ $propsearchall=$propval['searchall'];
$propisameasure=$propval['isameasure'];
+ $propcss=$propval['css'];
+ $prophelp=$propval['help'];
+ $propshowoncombobox=$propval['showoncombobox'];
+ //$propdisabled=$propval['disabled'];
$propcomment=$propval['comment'];
print ' ';
@@ -2503,7 +2582,7 @@ elseif (! empty($module))
print '';
print $proplabel;
print ' ';
- print '';
+ print ' ';
print $proptype;
print ' ';
print '';
@@ -2520,6 +2599,9 @@ elseif (! empty($module))
print ' ';
print $propindex?'1':'';
print ' ';
+ print '';
+ print $propforeignkey?$propforeignkey:'';
+ print ' ';
print '';
print $propposition;
print ' ';
@@ -2530,16 +2612,34 @@ elseif (! empty($module))
print $propvisible?$propvisible:'';
print '';
print '';
- print $propisameasure?$propisameasure:'';
+ print $propnoteditable?$propnoteditable:'';
print ' ';
print '';
print $propsearchall?'1':'';
print ' ';
+ print '';
+ print $propisameasure?$propisameasure:'';
+ print ' ';
+ print '';
+ print $propcss?$propcss:'';
+ print ' ';
+ print '';
+ print $prophelp?$prophelp:'';
+ print ' ';
+ print '';
+ print $propshowoncombobox?$propshowoncombobox:'';
+ print ' ';
+ /*print '';
+ print $propdisabled?$propdisabled:'';
+ print ' ';*/
print '';
print $propcomment;
print ' ';
print '';
- print ''.img_delete().' ';
+ if ($propname != 'rowid')
+ {
+ print ''.img_delete().' ';
+ }
print ' ';
print ' ';
@@ -2666,7 +2766,7 @@ elseif (! empty($module))
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
print ' ';
@@ -2806,7 +2906,7 @@ elseif (! empty($module))
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
print ' ';
@@ -2903,7 +3003,7 @@ elseif (! empty($module))
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
print '';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
print '';
@@ -2912,8 +3012,8 @@ elseif (! empty($module))
if (dol_is_file($dirins.'/'.$pathtohook))
{
print ''.$pathtohook.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
}
else
{
@@ -2970,8 +3070,8 @@ elseif (! empty($module))
print '';
print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
}
}
@@ -3026,8 +3126,8 @@ elseif (! empty($module))
if (dol_is_file($dirins.'/'.$pathtohook))
{
print ''.$pathtohook.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
}
else
{
@@ -3078,8 +3178,8 @@ elseif (! empty($module))
if (dol_is_file($dirins.'/'.$pathtohook))
{
print ''.$pathtohook.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
}
else
{
@@ -3134,9 +3234,8 @@ elseif (! empty($module))
$pathtofile = $widget['relpath'];
print ' '.$langs->trans("WidgetFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
}
}
@@ -3221,8 +3320,8 @@ elseif (! empty($module))
$pathtofile = $clifile['relpath'];
print ' '.$langs->trans("CLIFile").' : '.$pathtofile.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
}
}
@@ -3273,7 +3372,7 @@ elseif (! empty($module))
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
print ' ';
@@ -3402,8 +3501,8 @@ elseif (! empty($module))
if (preg_match('/\.md$/i', $spec['name'])) $format='markdown';
print '';
print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
}
}
diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php
index bc3b6c4050c..d7a810ac2cd 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'
@@ -290,14 +290,56 @@ class MyModuleApi extends DolibarrApi
protected function _cleanObjectDatas($object)
{
// phpcs:enable
- $object = parent::_cleanObjectDatas($object);
+ $object = parent::_cleanObjectDatas($object);
- /*unset($object->note);
- unset($object->address);
- unset($object->barcode_type);
- unset($object->barcode_type_code);
- unset($object->barcode_type_label);
- unset($object->barcode_type_coder);*/
+ unset($object->rowid);
+ unset($object->canvas);
+
+ /*unset($object->name);
+ unset($object->lastname);
+ unset($object->firstname);
+ unset($object->civility_id);
+ unset($object->statut);
+ unset($object->state);
+ unset($object->state_id);
+ unset($object->state_code);
+ unset($object->region);
+ unset($object->region_code);
+ unset($object->country);
+ unset($object->country_id);
+ unset($object->country_code);
+ unset($object->barcode_type);
+ unset($object->barcode_type_code);
+ unset($object->barcode_type_label);
+ unset($object->barcode_type_coder);
+ unset($object->total_ht);
+ unset($object->total_tva);
+ unset($object->total_localtax1);
+ unset($object->total_localtax2);
+ unset($object->total_ttc);
+ unset($object->fk_account);
+ unset($object->comments);
+ unset($object->note);
+ unset($object->mode_reglement_id);
+ unset($object->cond_reglement_id);
+ unset($object->cond_reglement);
+ unset($object->shipping_method_id);
+ unset($object->fk_incoterms);
+ unset($object->label_incoterms);
+ unset($object->location_incoterms);
+ */
+
+ // If object has lines, remove $db property
+ if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
+ $nboflines = count($object->lines);
+ for ($i=0; $i < $nboflines; $i++)
+ {
+ $this->_cleanObjectDatas($object->lines[$i]);
+
+ unset($object->lines[$i]->lines);
+ unset($object->lines[$i]->note);
+ }
+ }
return $object;
}
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 41d0af33d46..4cefbc159a0 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -68,21 +68,21 @@ class MyObject extends CommonObject
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key.
* 'enabled' is a condition when the field must be managed.
+ * 'position' is the sort order of field.
+ * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
- * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
- * 'position' is the sort order of field.
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
* 'help' is a string visible as a tooltip on field
- * 'comment' is not used. You can store here any text of your choice. It is not used by application.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
- * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
+ * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
+ * 'comment' is not used. You can store here any text of your choice. It is not used by application.
*/
// BEGIN MODULEBUILDER PROPERTIES
@@ -91,13 +91,13 @@ class MyObject extends CommonObject
*/
public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
- 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'notnull'=> 1, 'default'=>'(PROV)', 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
+ 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
- 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
+ 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1),
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
@@ -656,22 +656,22 @@ class MyObject extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- if (empty($this->labelstatus) || empty($this->labelstatusshort))
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
//$langs->load("mymodule");
- $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
- $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
- $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
- $this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('Draft');
- $this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
- $this->labelstatusshort[self::STATUS_CANCELED] = $langs->trans('Disabled');
+ $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
+ $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
+ $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft');
+ $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
+ $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Disabled');
}
$statusType = 'status'.$status;
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
- return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php
index 854e7f37bd5..43970122919 100644
--- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php
@@ -26,6 +26,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
public $enabled=0;
public $require_module=array();
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='mymodule@mymodule';
/**
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 6b522a45364..86eb50aff9e 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -382,6 +382,8 @@ class modMyModule extends DolibarrModules
*/
public function init($options = '')
{
+ global $conf, $langs;
+
$result=$this->_load_tables('/mymodule/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')
@@ -394,7 +396,36 @@ class modMyModule 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, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled');
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled');
+ // Permissions
+ $this->remove($options);
+
$sql = array();
+
+ // ODT template
+ /*
+ $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
+ $dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule';
+ $dest=$dirodt.'/template_myobjects.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($this->const[0][2])."' AND type = 'mymodule' AND entity = ".$conf->entity,
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','mymodule',".$conf->entity.")"
+ );
+ */
+
return $this->_init($sql, $options);
}
diff --git a/htdocs/modulebuilder/template/core/modules/myobject/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
similarity index 99%
rename from htdocs/modulebuilder/template/core/modules/myobject/doc/doc_generic_myobject_odt.modules.php
rename to htdocs/modulebuilder/template/core/modules/mymodule/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/mymodule/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/modulebuilder/template/core/modules/myobject/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php
similarity index 100%
rename from htdocs/modulebuilder/template/core/modules/myobject/mod_myobject_advanced.php
rename to htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php
diff --git a/htdocs/modulebuilder/template/core/modules/myobject/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php
similarity index 100%
rename from htdocs/modulebuilder/template/core/modules/myobject/mod_myobject_standard.php
rename to htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php
diff --git a/htdocs/modulebuilder/template/core/modules/myobject/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
similarity index 100%
rename from htdocs/modulebuilder/template/core/modules/myobject/modules_myobject.php
rename to htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
diff --git a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php
new file mode 100644
index 00000000000..c0b2e073ad0
--- /dev/null
+++ b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php
@@ -0,0 +1,58 @@
+
+ *
+ * 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 .
+ */
+
+// Protection to avoid direct call of template
+if (empty($conf) || ! is_object($conf))
+{
+ print "Error, template page can't be called as URL";
+ exit;
+}
+
+
+print "\n";
+
+
+global $user;
+global $noMoreLinkedObjectBlockAfter;
+
+$langs = $GLOBALS['langs'];
+$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
+
+// Load translation files required by the page
+$langs->load("mymodule");
+
+$total=0; $ilink=0;
+foreach($linkedObjectBlock as $key => $objectlink)
+{
+ $ilink++;
+
+ $trclass='oddeven';
+ if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
+ ?>
+
+ trans("MyObject"); ?>
+ getNomUrl(1); ?>
+
+ date, 'day'); ?>
+
+ getLibStatut(7); ?>
+ id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
+
+ \n";
diff --git a/htdocs/modulebuilder/template/core/tpl/mytemplate.tpl.php b/htdocs/modulebuilder/template/core/tpl/mytemplate.tpl.php
deleted file mode 100644
index 8e871e7f416..00000000000
--- a/htdocs/modulebuilder/template/core/tpl/mytemplate.tpl.php
+++ /dev/null
@@ -1,35 +0,0 @@
-.
- */
-
-/**
- * \file core/tpl/mytemplate.tpl.php
- * \ingroup mymodule
- * \brief Example template.
- *
- * Put detailed description here.
- */
-
-// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
-{
- print "Error, template page can't be called as URL";
- exit;
-}
-
-
-/** Your code here. */
-echo "Hello world!";
diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php
index 2b681e817f8..d97af3cc99e 100644
--- a/htdocs/modulebuilder/template/mymoduleindex.php
+++ b/htdocs/modulebuilder/template/mymoduleindex.php
@@ -50,10 +50,10 @@ $action=GETPOST('action', 'alpha');
// Securite acces client
if (! $user->rights->mymodule->read) accessforbidden();
$socid=GETPOST('socid', 'int');
-if (isset($user->societe_id) && $user->societe_id > 0)
+if (isset($user->socid) && $user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$max=5;
diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php
index 8abb3623909..f75e7d352f1 100644
--- a/htdocs/modulebuilder/template/myobject_agenda.php
+++ b/htdocs/modulebuilder/template/myobject_agenda.php
@@ -61,14 +61,9 @@ if (GETPOST('actioncode', 'array'))
}
else
{
- $actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
+ $actioncode = GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
-$search_agenda_label=GETPOST('search_agenda_label');
-
-// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
-//$result = restrictedArea($user, 'mymodule', $id);
+$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@@ -79,10 +74,10 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='a.datep,a.id';
-if (! $sortorder) $sortorder='DESC';
+if (! $sortorder) $sortorder='DESC,DESC';
// Initialize technical objects
-$object=new MyObject($db);
+$object = new MyObject($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('myobjectagenda','globalcard')); // Note that conf->hooks_modules contains array
@@ -93,13 +88,19 @@ $extrafields->fetch_name_optionals_label($object->table_element);
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity] . "/" . $object->id;
+// Security check - Protection if external user
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
+//$result = restrictedArea($user, 'mymodule', $object->id);
+
+$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
/*
- * Actions
+ * Actions
*/
-$parameters=array('id'=>$socid);
+$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -126,8 +127,6 @@ if (empty($reshook))
* View
*/
-$contactstatic = new Contact($db);
-
$form = new Form($db);
if ($object->id > 0)
@@ -159,7 +158,7 @@ if ($object->id > 0)
{
$langs->load("projects");
$morehtmlref.=' '.$langs->trans('Project') . ' ';
- if ($user->rights->mymodule->creer)
+ if ($permissiontoadd)
{
if ($action != 'classify')
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index fcf8b1f8a06..111e190bcf3 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -100,16 +100,16 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
-$permissionnote = $user->rights->mymodule->write; // Used by the include of actions_setnotes.inc.php
-$permissiondellink = $user->rights->mymodule->write; // Used by the include of actions_dellink.inc.php
-$permissionedit = $user->rights->mymodule->write; // Used by the include of actions_lineupdown.inc.php
-$permissiontoadd = $user->rights->mymodule->write; // Used by the include of actions_addupdatedelete.inc.php
-$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
+$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
+$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
+$permissionedit = $user->rights->mymodule->myobject->write; // Used by the include of actions_lineupdown.inc.php
+$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
+$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && $object->status == 0);
@@ -319,8 +319,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref='';
/*
// Ref bis
- $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', null, null, '', 1);
+ $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->myobject->creer, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->myobject->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
@@ -328,7 +328,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
$langs->load("projects");
$morehtmlref.='
'.$langs->trans('Project') . ' ';
- if ($user->rights->mymodule->write)
+ if ($permissiontoadd)
{
if ($action != 'classify')
$morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
@@ -451,13 +451,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '
id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ' '."\n";
// Back to draft
- if (! empty($user->rights->mymodule->write) && $object->status == BOM::STATUS_VALIDATED)
+ if (! empty($user->rights->mymodule->myobject->write) && $object->status == BOM::STATUS_VALIDATED)
{
print '
' . $langs->trans("SetToDraft") . ' ';
}
// Modify
- if (! empty($user->rights->mymodule->write))
+ if (! empty($user->rights->mymodule->myobject->write))
{
print '
id.'&action=edit">'.$langs->trans("Modify").' '."\n";
}
@@ -467,13 +467,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Clone
- if (! empty($user->rights->mymodule->write))
+ if (! empty($user->rights->mymodule->myobject->write))
{
print '
' . $langs->trans("ToClone") . ' '."\n";
}
/*
- if ($user->rights->mymodule->write)
+ if ($user->rights->mymodule->myobject->write)
{
if ($object->status == 1)
{
@@ -487,7 +487,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
*/
// Delete (need delete permission, or if draft, just need create/modify permission)
- if (! empty($user->rights->mymodule->delete) || (! empty($object->fields['status']) && $object->status == $object::STATUS_DRAFT && ! empty($user->rights->mymodule->write)))
+ if (! empty($user->rights->mymodule->myobject->delete) || (! empty($object->fields['status']) && $object->status == $object::STATUS_DRAFT && ! empty($user->rights->mymodule->myobject->write)))
{
print '
id.'&action=delete">'.$langs->trans('Delete').' '."\n";
}
@@ -512,11 +512,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Documents
/*$objref = dol_sanitizeFileName($object->ref);
- $relativepath = $comref . '/' . $comref . '.pdf';
+ $relativepath = $objref . '/' . $objref . '.pdf';
$filedir = $conf->mymodule->dir_output . '/' . $objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
- $genallowed = $user->rights->mymodule->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->mymodule->create; // If you can create/edit, you can remove a file on card
+ $genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content
+ $delallowed = $user->rights->mymodule->myobject->create; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('mymodule', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
*/
@@ -536,23 +536,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
- $somethingshown = $formactions->showactions($object, 'myobject', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
+ $somethingshown = $formactions->showactions($object, 'myobject', (is_object($object->thirdparty)?$object->thirdparty->id:0), 1, '', $MAXEVENT, '', $morehtmlright);
print '
';
}
//Select mail models is same action as presend
/*
- if (GETPOST('modelselected')) $action = 'presend';
+ if (GETPOST('modelselected')) $action = 'presend';
- // Presend form
- $modelmail='inventory';
- $defaulttopic='InformationMessage';
- $diroutput = $conf->product->dir_output.'/inventory';
- $trackid = 'stockinv'.$object->id;
+ // Presend form
+ $modelmail='myobject';
+ $defaulttopic='InformationMessage';
+ $diroutput = $conf->mymodule->dir_output;
+ $trackid = 'myobject'.$object->id;
- include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
- */
+ include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
+ */
}
// End of page
diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php
index 8deb44b9009..9d0954d277e 100644
--- a/htdocs/modulebuilder/template/myobject_document.php
+++ b/htdocs/modulebuilder/template/myobject_document.php
@@ -80,10 +80,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:$conf->entity] . "/myobject/" . dol_sanitizeFileName($object->ref);
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $object->id);
+$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
+
/*
@@ -146,9 +148,9 @@ if ($object->id)
dol_fiche_end();
$modulepart = 'mymodule';
- //$permission = $user->rights->mymodule->create;
+ //$permission = $user->rights->mymodule->myobject->write;
$permission = 1;
- //$permtoedit = $user->rights->mymodule->create;
+ //$permtoedit = $user->rights->mymodule->myobject->write;
$permtoedit = 1;
$param = '&id=' . $object->id;
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index 525fa879562..08fbcbaa98e 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -112,9 +112,9 @@ if (! $sortorder) $sortorder="ASC";
// Security check
if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled');
$socid=0;
-if ($user->societe_id > 0) // Protection if external user
+if ($user->socid > 0) // Protection if external user
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'mymodule', $id, '');
@@ -153,6 +153,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+$permtoread = $user->rights->mymodule->myobject->read;
+$permtowrite = $user->rights->mymodule->myobject->write;
+$permtodelete = $user->rights->mymodule->myobject->delete;
/*
@@ -190,8 +193,6 @@ if (empty($reshook))
// Mass actions
$objectclass='MyObject';
$objectlabel='MyObject';
- $permtoread = $user->rights->mymodule->read;
- $permtodelete = $user->rights->mymodule->delete;
$uploaddir = $conf->mymodule->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -346,7 +347,7 @@ $arrayofmassactions = array(
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
-if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=' '.$langs->trans("Delete");
+if ($permtodelete) $arrayofmassactions['predelete']=' '.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@@ -360,7 +361,7 @@ print ' ';
print ' ';
print ' ';
-$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->mymodule->write);
+$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permtowrite);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
@@ -593,8 +594,8 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
$urlsource.=str_replace('&', '&', $param);
$filedir=$diroutputmassaction;
- $genallowed=$user->rights->mymodule->read;
- $delallowed=$user->rights->mymodule->write;
+ $genallowed=$permtoread;
+ $delallowed=$permtowrite;
print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}
diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php
index c8dbc5d3140..89a8ed5513b 100644
--- a/htdocs/modulebuilder/template/myobject_note.php
+++ b/htdocs/modulebuilder/template/myobject_note.php
@@ -59,16 +59,16 @@ $hookmanager->initHooks(array('myobjectnote','globalcard')); // Note that co
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity] . "/" . $object->id;
-$permissionnote=1;
-//$permissionnote=$user->rights->mymodule->creer; // Used by the include of actions_setnotes.inc.php
+$permissionnote=$user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
+$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
@@ -113,7 +113,7 @@ if ($id > 0 || ! empty($ref))
{
$langs->load("projects");
$morehtmlref.=' '.$langs->trans('Project') . ' ';
- if ($user->rights->mymodule->creer)
+ if ($permissiontoadd)
{
if ($action != 'classify')
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
diff --git a/htdocs/mrp/ChangeLog.md b/htdocs/mrp/ChangeLog.md
deleted file mode 100644
index 416bad1d559..00000000000
--- a/htdocs/mrp/ChangeLog.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# CHANGELOG MRP FOR DOLIBARR ERP CRM
-
-## 1.0
-Initial version
-
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..2cff993a05f 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;
@@ -121,7 +121,13 @@ class Mo extends CommonObject
public $fk_soc;
public $note_public;
public $note_private;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $tms;
public $fk_user_creat;
public $fk_user_modif;
@@ -546,21 +552,21 @@ class Mo extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- if (empty($this->labelstatus))
+ if (empty($this->labelStatus))
{
global $langs;
//$langs->load("mrp");
- $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
- $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Validated');
- $this->labelstatus[self::STATUS_INPROGRESS] = $langs->trans('InProgress');
- $this->labelstatus[self::STATUS_PRODUCED] = $langs->trans('StatusMOProduced');
- $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
+ $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated');
+ $this->labelStatus[self::STATUS_INPROGRESS] = $langs->trans('InProgress');
+ $this->labelStatus[self::STATUS_PRODUCED] = $langs->trans('StatusMOProduced');
+ $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
}
$statusType = 'status'.$status;
//if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
- return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode);
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php
index 742d94109e2..36847b71035 100644
--- a/htdocs/mrp/index.php
+++ b/htdocs/mrp/index.php
@@ -163,7 +163,7 @@ if ($resql)
print '';
print ''.$staticbom->getNomUrl(1, 32).' ';
print ''.dol_print_date($db->jdate($obj->datem), 'dayhour').' ';
- print ''.$staticbom->getLibStatut(5).' ';
+ print ''.$staticbom->getLibStatut(3).' ';
print ' ';
$i++;
}
@@ -216,7 +216,7 @@ if ($resql)
print '';
print ''.$staticmo->getNomUrl(1, 32).' ';
print ''.dol_print_date($db->jdate($obj->datem), 'dayhour').' ';
- print ''.$staticmo->getLibStatut(5).' ';
+ print ''.$staticmo->getLibStatut(3).' ';
print ' ';
$i++;
}
@@ -235,8 +235,11 @@ else
print '';
-$parameters = array('type' => $type, 'user' => $user);
-$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, null); // Note that $action and $object may have been modified by hook
+$parameters = array(
+ //'type' => $type,
+ 'user' => $user,
+);
+$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters);
// End of page
llxFooter();
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/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php
index a86d062c5e4..884bc234cbf 100644
--- a/htdocs/mrp/mo_agenda.php
+++ b/htdocs/mrp/mo_agenda.php
@@ -54,8 +54,8 @@ else
$search_agenda_label=GETPOST('search_agenda_label');
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mrp', $id);
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
index 0ecbefc32a7..07b6be426f3 100644
--- a/htdocs/mrp/mo_card.php
+++ b/htdocs/mrp/mo_card.php
@@ -88,8 +88,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == Mo::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php
index 3732754a62f..2c4d1b36c99 100644
--- a/htdocs/mrp/mo_document.php
+++ b/htdocs/mrp/mo_document.php
@@ -41,8 +41,8 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mrp', $id);
// Get parameters
diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php
index 96f19540a95..b91affe403f 100644
--- a/htdocs/mrp/mo_list.php
+++ b/htdocs/mrp/mo_list.php
@@ -98,9 +98,9 @@ if (! $sortorder) $sortorder="ASC";
// Security check
if (empty($conf->mrp->enabled)) accessforbidden('Module not enabled');
$socid=0;
-if ($user->societe_id > 0) // Protection if external user
+if ($user->socid > 0) // Protection if external user
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'mrp', $id, '');
diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php
index f815dfbaef6..aeb4630168d 100644
--- a/htdocs/mrp/mo_note.php
+++ b/htdocs/mrp/mo_note.php
@@ -47,8 +47,8 @@ $hookmanager->initHooks(array('monote','globalcard')); // Note that conf->ho
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mrp', $id);
// Load object
diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index 70de7155f39..345bfe3f8dd 100644
--- a/htdocs/mrp/mo_production.php
+++ b/htdocs/mrp/mo_production.php
@@ -88,8 +88,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == Mo::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php
index 786ed7220b5..b1cdeac1f36 100644
--- a/htdocs/opensurvey/class/opensurveysondage.class.php
+++ b/htdocs/opensurvey/class/opensurveysondage.class.php
@@ -44,6 +44,9 @@ class Opensurveysondage extends CommonObject
*/
public $table_element='opensurvey_sondage';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'opensurvey';
public $id_sondage;
diff --git a/htdocs/product/admin/product_supplier_extrafields.php b/htdocs/product/admin/product_supplier_extrafields.php
new file mode 100644
index 00000000000..149178ead36
--- /dev/null
+++ b/htdocs/product/admin/product_supplier_extrafields.php
@@ -0,0 +1,132 @@
+
+ * Copyright (C) 2003 Jean-Louis Bergamo
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2012 Marcos García
+ * Copyright (C) 2012 Regis Houssin
+ * Copyright (C) 2019 Tim Otte
+ *
+ * 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/product/admin/product_supplier_extrafields.php
+ * \ingroup product
+ * \brief Page to setup extra fields of products
+ */
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array('companies', 'admin', 'products'));
+
+$extrafields = new ExtraFields($db);
+$form = new Form($db);
+
+// List of supported format
+$tmptype2label=ExtraFields::$type2label;
+$type2label=array('');
+foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
+
+$action=GETPOST('action', 'alpha');
+$attrname=GETPOST('attrname', 'alpha');
+$elementtype='product_fournisseur_price'; //Must be the $element of the class that manage extrafield
+
+if (!$user->admin) accessforbidden();
+
+
+/*
+ * Actions
+ */
+
+require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
+
+
+
+/*
+ * View
+ */
+
+$title = $langs->trans('ProductServiceSetup');
+$textobject = $langs->trans("ProductsAndServices");
+if (empty($conf->product->enabled))
+{
+ $title = $langs->trans('ServiceSetup');
+ $textobject = $langs->trans('Services');
+}
+elseif (empty($conf->service->enabled))
+{
+ $title = $langs->trans('ProductSetup');
+ $textobject = $langs->trans('Products');
+}
+
+//$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
+$help_url='';
+llxHeader('', $title, $help_url);
+
+
+$linkback=''.$langs->trans("BackToModuleList").' ';
+print load_fiche_titre($title, $linkback, 'title_setup');
+
+
+$head = product_admin_prepare_head();
+
+dol_fiche_head($head, 'supplierAttributes', $textobject, -1, 'product');
+
+require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
+
+dol_fiche_end();
+
+
+// Buttons
+if ($action != 'create' && $action != 'edit')
+{
+ print '";
+}
+
+
+/* ************************************************************************** */
+/* */
+/* Creation of an optional field */
+/* */
+/* ************************************************************************** */
+
+if ($action == 'create')
+{
+ print '
';
+ print load_fiche_titre($langs->trans('NewAttribute'));
+
+ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
+}
+
+/* ************************************************************************** */
+/* */
+/* Edition of an optional field */
+/* */
+/* ************************************************************************** */
+if ($action == 'edit' && ! empty($attrname))
+{
+ print " ";
+ print load_fiche_titre($langs->trans("FieldEdition", $attrname));
+
+ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php
index a264171f529..c6585f5e590 100644
--- a/htdocs/product/agenda.php
+++ b/htdocs/product/agenda.php
@@ -50,7 +50,7 @@ $search_agenda_label=GETPOST('search_agenda_label');
// Security check
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-if ($user->societe_id) $id=$user->societe_id;
+if ($user->socid) $id=$user->socid;
$result=restrictedArea($user, 'produit|service', $id, 'product&product');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
@@ -132,7 +132,7 @@ if ($id > 0 || $ref)
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php
index 594fd6c1b9b..dc7fea3fc0e 100644
--- a/htdocs/product/canvas/product/tpl/card_view.tpl.php
+++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php
@@ -37,7 +37,7 @@ $linkback = 'next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
-if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
?>
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index fa131e1df6e..79511df9640 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -78,7 +78,7 @@ $confirm=GETPOST('confirm', 'alpha');
$socid=GETPOST('socid', 'int');
$duration_value = GETPOST('duration_value', 'int');
$duration_unit = GETPOST('duration_unit', 'alpha');
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$object = new Product($db);
$object->type = $type; // so test later to fill $usercancxxx is correct
@@ -1650,7 +1650,7 @@ else
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php
index d6066b1a03a..947e4292c1a 100644
--- a/htdocs/product/class/api_products.class.php
+++ b/htdocs/product/class/api_products.class.php
@@ -450,12 +450,13 @@ class Products extends DolibarrApi
* Get prices per customer for a product
*
* @param int $id ID of product
+ * @param string $thirdparty_id Thirdparty id to filter orders of (example '1') {@pattern /^[0-9,]*$/i}
*
* @return mixed
*
* @url GET {id}/selling_multiprices/per_customer
*/
- public function getCustomerPricesPerCustomer($id)
+ public function getCustomerPricesPerCustomer($id, $thirdparty_id = '')
{
global $conf;
@@ -472,12 +473,20 @@ class Products extends DolibarrApi
throw new RestException(404, 'Product not found');
}
- if ($result < 0) {
- throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors));
+ if ($result > 0) {
+ require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
+ $prodcustprice = new Productcustomerprice($this->db);
+ $filter = array();
+ $filter['t.fk_product'] .= $id;
+ if ($thirdparty_id) $filter['t.fk_soc'] .= $thirdparty_id;
+ $result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
}
- throw new RestException(501, 'Feature not yet available');
- //return $result;
+ if ( empty($prodcustprice->lines)) {
+ throw new RestException(404, 'Prices not found');
+ }
+
+ return $prodcustprice->lines;
}
/**
@@ -573,7 +582,7 @@ class Products extends DolibarrApi
{
global $db, $conf;
$obj_ret = array();
- $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
+ $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
$sql = "SELECT t.rowid, t.ref, t.ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX."product as t";
if ($category > 0) {
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 2ba78b32945..de14a5621a2 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -325,7 +325,12 @@ class Product extends CommonObject
public $imgWidth;
public $imgHeight;
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $date_modification;
//! Id du fournisseur
@@ -2087,14 +2092,17 @@ class Product extends CommonObject
}
$resql = $this->db->query($sql);
- if ($resql ) {
+ if ($resql) {
+
+ unset($this->oldcopy);
+
if ($this->db->num_rows($resql) > 0) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext;
- $this->label = $obj->label;
+ $this->label = $obj->label;
$this->description = $obj->description;
$this->url = $obj->url;
$this->note_private = $obj->note_private;
@@ -4380,17 +4388,17 @@ 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)
{
// phpcs:enable
global $conf, $langs;
- $labelstatut = $labelstatutShort = '';
+ $labelStatus = $labelStatusShort = '';
$langs->load('products');
if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch");
@@ -4420,51 +4428,50 @@ 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){
- $labelstatut = $langs->trans('ProductStatusNotOnSellShort');
- $labelstatutShort = $langs->trans('ProductStatusNotOnSell');
+ if($type==0) {
+ $labelStatus = $langs->trans('ProductStatusNotOnSellShort');
+ $labelStatusShort = $langs->trans('ProductStatusNotOnSell');
}
- elseif($type == 1){
- $labelstatut = $langs->trans('ProductStatusNotOnBuyShort');
- $labelstatutShort = $langs->trans('ProductStatusNotOnBuy');
+ elseif($type == 1) {
+ $labelStatus = $langs->trans('ProductStatusNotOnBuyShort');
+ $labelStatusShort = $langs->trans('ProductStatusNotOnBuy');
}
- elseif($type == 2){
- $labelstatut = $langs->trans('ProductStatusNotOnBatch');
- $labelstatutShort = $langs->trans('ProductStatusNotOnBatchShort');
+ elseif($type == 2) {
+ $labelStatus = $langs->trans('ProductStatusNotOnBatch');
+ $labelStatusShort = $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){
- $labelstatut = $langs->trans('ProductStatusOnSellShort');
- $labelstatutShort = $langs->trans('ProductStatusOnSell');
+ if ($type==0) {
+ $labelStatus = $langs->trans('ProductStatusOnSellShort');
+ $labelStatusShort = $langs->trans('ProductStatusOnSell');
}
- elseif($type == 1){
- $labelstatut = $langs->trans('ProductStatusOnBuyShort');
- $labelstatutShort = $langs->trans('ProductStatusOnBuy');
+ elseif ($type == 1) {
+ $labelStatus = $langs->trans('ProductStatusOnBuyShort');
+ $labelStatusShort = $langs->trans('ProductStatusOnBuy');
}
- elseif($type == 2){
- $labelstatut = $langs->trans('ProductStatusOnBatch');
- $labelstatutShort = $langs->trans('ProductStatusOnBatchShort');
+ elseif ($type == 2) {
+ $labelStatus = $langs->trans('ProductStatusOnBatch');
+ $labelStatusShort = $langs->trans('ProductStatusOnBatchShort');
}
}
- if($mode>6){
+ if ($mode > 6) {
return dolGetStatus($langs->trans('Unknown'), '', '', 'status0', 0);
- }
- else{
- return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode);
+ } else {
+ return dolGetStatus($labelStatus, $labelStatusShort, '', $statuttrans, $mode);
}
}
/**
- * Retourne le libelle du finished du produit
+ * Retour label of nature of product
*
- * @return string Libelle
+ * @return string Label
*/
public function getLibFinished()
{
diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php
index a3517c593f1..8fb3420df49 100644
--- a/htdocs/product/composition/card.php
+++ b/htdocs/product/composition/card.php
@@ -45,7 +45,7 @@ $key=GETPOST('key');
$parent=GETPOST('parent');
// Security check
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
@@ -205,7 +205,7 @@ if ($id > 0 || ! empty($ref))
$linkback = ' '.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 0);
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index f62ea66fd48..ef508c9a200 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -48,7 +48,7 @@ $confirm= GETPOST('confirm', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -215,7 +215,7 @@ if ($object->id)
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index ef0d1bc1c85..f0bedbcd7f5 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -8,7 +8,8 @@
* Copyright (C) 2014 Ion Agorria
* Copyright (C) 2015 Alexandre Spangaro
* Copyright (C) 2016 Ferran Marcet
- * Copyright (C) 2019 Frédéric France
+ * Copyright (C) 2019 Frédéric France
+ * Copyright (C) 2019 Tim Otte
*
* 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
@@ -33,6 +34,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_expression.class.php';
@@ -53,6 +55,8 @@ $cost_price=GETPOST('cost_price', 'alpha');
$backtopage=GETPOST('backtopage', 'alpha');
$error=0;
+$extrafields = new ExtraFields($db);
+
// If socid provided by ajax company selector
if (! empty($_REQUEST['search_fourn_id']))
{
@@ -64,7 +68,7 @@ if (! empty($_REQUEST['search_fourn_id']))
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
if (empty($user->rights->fournisseur->lire)) accessforbidden();
@@ -138,6 +142,7 @@ if (empty($reshook))
$action = '';
$result=$object->remove_product_fournisseur_price($rowid);
if($result > 0){
+ $db->query("DELETE FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = $rowid");
setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs');
}else{
$error++;
@@ -146,7 +151,7 @@ if (empty($reshook))
}
}
- if ($action == 'updateprice')
+ if ($action == 'save_price')
{
$id_fourn=GETPOST("id_fourn");
if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn");
@@ -257,6 +262,36 @@ if (empty($reshook))
if (isset($_POST['ref_fourn_price_id']))
$object->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
+ $extralabels=$extrafields->fetch_name_optionals_label("product_fournisseur_price");
+ $extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");
+
+ $sql = "";
+ $resql = $db->query("SELECT * FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $object->product_fourn_price_id);
+ // Insert a new extrafields row, if none exists
+ if ($db->num_rows($resql) != 1) {
+
+ $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields (fk_object, ";
+ foreach ($extrafield_values as $key => $value) {
+ $sql .= str_replace('options_', '', $key) . ', ';
+ }
+ $sql = substr($sql, 0, strlen($sql)-2) . ") VALUES (" . $object->product_fourn_price_id . ", ";
+ foreach ($extrafield_values as $key => $value) {
+ $sql .= '"' . $value . '", ';
+ }
+ $sql = substr($sql, 0, strlen($sql)-2) . ')';
+ }
+ // else update the existing one
+ else {
+ $sql = "UPDATE " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields SET ";
+ foreach ($extrafield_values as $key => $value) {
+ $sql .= str_replace('options_', '', $key) . ' = "' . $value . '", ';
+ }
+ $sql = substr($sql, 0, strlen($sql)-2) . ' WHERE fk_object = ' . $object->product_fourn_price_id;
+ }
+
+ // Execute the sql command from above
+ $db->query($sql);
+
$newprice = price2num(GETPOST("price", "alpha"));
if ($conf->multicurrency->enabled)
@@ -362,7 +397,7 @@ if ($id > 0 || $ref)
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
@@ -402,7 +437,7 @@ if ($id > 0 || $ref)
// Form to add or update a price
- if (($action == 'add_price' || $action == 'updateprice' ) && $usercancreate)
+ if (($action == 'add_price' || $action == 'update_price' ) && $usercancreate)
{
$langs->load("suppliers");
@@ -418,7 +453,7 @@ if ($id > 0 || $ref)
print '';
print ' ';
- print ' ';
+ print ' ';
dol_fiche_head();
@@ -730,6 +765,25 @@ SCRIPT;
print '';
}
+ $extrafields->fetch_name_optionals_label("product_fournisseur_price");
+ $extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
+ // Extrafields
+ $resql = $db->query("SELECT * FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $rowid);
+ if ($db->num_rows($resql) != 1) {
+ foreach ($extralabels as $key => $value) {
+ if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
+ print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '') . '>' . $langs->trans($value) . ' ' . $extrafields->showInputField($key, '', '', '', '', '', 0, 'product_fournisseur_price') . ' ';
+ }
+ }
+ } else {
+ $resql = $db->fetch_object($resql);
+ foreach ($extralabels as $key => $value) {
+ if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
+ print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '') . '>' . $langs->trans($value) . ' ' . $extrafields->showInputField($key, $resql->{$key}, '', '', '', '', 0, 'product_fournisseur_price') . ' ';
+ }
+ }
+ }
+
if (is_object($hookmanager))
{
$parameters=array('id_fourn'=>$id_fourn,'prod_id'=>$object->id);
@@ -754,7 +808,7 @@ SCRIPT;
print "\n\n";
- if ($action != 'add_price' && $action != 'updateprice')
+ if ($action != 'add_price' && $action != 'update_price')
{
$parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@@ -817,6 +871,17 @@ SCRIPT;
print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center ');
}
print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right ');
+
+ // fetch optionals attributes and labels
+ $extrafields->fetch_name_optionals_label("product_fournisseur_price");
+ $extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
+ foreach ($extralabels as $key => $value) {
+ // Show field if not hidden
+ if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
+ print_liste_field_titre($value, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ }
+ }
+
if (is_object($hookmanager))
{
$parameters=array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id);
@@ -938,6 +1003,23 @@ SCRIPT;
print dol_print_date(($productfourn->fourn_date_modification ? $productfourn->fourn_date_modification : $productfourn->date_modification), "dayhour");
print '';
+ // Extrafields
+ $resql = $db->query("SELECT * FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $productfourn->product_fourn_price_id);
+ if ($db->num_rows($resql) != 1) {
+ foreach ($extralabels as $key => $value) {
+ if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
+ print "
";
+ }
+ }
+ } else {
+ $resql = $db->fetch_object($resql);
+ foreach ($extralabels as $key => $value) {
+ if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
+ print '
' . $extrafields->showOutputField($key, $resql->{$key}) . " ";
+ }
+ }
+ }
+
if (is_object($hookmanager))
{
$parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$object->id);
@@ -948,7 +1030,7 @@ SCRIPT;
print '
';
if ($usercancreate)
{
- print ''.img_edit()." ";
+ print ''.img_edit()." ";
print ' ';
print ''.img_picto($langs->trans("Remove"), 'delete').' ';
}
diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index a92d2cd071a..87e5eb6d2fb 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -95,6 +95,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
print '';
print ' ';
+ print '';
print '
';
$i=0;
foreach($listofsearchfields as $key => $value)
@@ -107,6 +108,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
$i++;
}
print '
';
+ print '
';
print ' ';
print ' ';
}
@@ -266,7 +268,7 @@ print '';
/*
- * Last modified products
+ * Latest modified products
*/
$max=15;
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,";
@@ -299,11 +301,11 @@ if ($result)
print '
';
print '
';
- $colnb=4;
+ $colnb=2;
if (empty($conf->global->PRODUIT_MULTIPRICES)) $colnb++;
print ''.$transRecordedType.' ';
- print ''.$langs->trans("FullList").'';
+ print ' '.$langs->trans("FullList").'';
print ' ';
while ($i < $num)
@@ -359,10 +361,10 @@ if ($result)
else print price($objp->price).' '.$langs->trans("HT");
print '';
}
- print '';
+ print ' ';
print $product_static->LibStatut($objp->tosell, 3, 0);
print " ";
- print '';
+ print ' ';
print $product_static->LibStatut($objp->tobuy, 3, 1);
print " ";
print "\n";
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index 639b04cdbcc..2659d325676 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -72,8 +72,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php
index 775ffcf3e5c..4434f82fbcf 100644
--- a/htdocs/product/inventory/class/inventory.class.php
+++ b/htdocs/product/inventory/class/inventory.class.php
@@ -396,16 +396,16 @@ class Inventory extends CommonObject
// phpcs:enable
global $langs;
- if (empty($this->labelstatus))
+ if (empty($this->labelStatus))
{
global $langs;
//$langs->load("mrp");
- $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
- $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
- $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
+ $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
+ $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
}
- return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', 'status'.$status, $mode);
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', 'status'.$status, $mode);
}
/**
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index df67fbd0940..4ee108595e6 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -72,8 +72,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index 0362a3767c3..9a20f00341b 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -68,9 +68,9 @@ if (! $sortorder) $sortorder="ASC";
// Security check
$socid=0;
-if ($user->societe_id > 0) // Protection if external user
+if ($user->socid > 0) // Protection if external user
{
- //$socid = $user->societe_id;
+ //$socid = $user->socid;
accessforbidden();
}
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
diff --git a/htdocs/product/note.php b/htdocs/product/note.php
index c9a8bc6b1f9..d5593acfb78 100644
--- a/htdocs/product/note.php
+++ b/htdocs/product/note.php
@@ -40,7 +40,7 @@ $action = GETPOST('action', 'aZ09');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
$object = new Product($db);
@@ -98,7 +98,7 @@ if ($id > 0 || ! empty($ref))
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php
index a25ba2808d5..c50ca3538aa 100644
--- a/htdocs/product/popuprop.php
+++ b/htdocs/product/popuprop.php
@@ -36,7 +36,7 @@ $langs->load('propal');
$type=GETPOST("type", "int");
// Security check
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index e8e332d95b5..f6820bc37bc 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -62,7 +62,7 @@ $search_soc = GETPOST('search_soc');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid = $user->societe_id;
+if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
if ($id > 0 || ! empty($ref))
@@ -706,7 +706,7 @@ $linkback = ''.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', '', '', '', 0, '', '', 1);
dol_fiche_end();
}
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 58d65810772..e819110c344 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -40,7 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$socid='';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -104,7 +104,7 @@ if ($id > 0 || ! empty($ref))
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index 56746cb33bc..ae3b642355a 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -39,8 +39,8 @@ $ref = GETPOST('ref', 'alpha');
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$socid = '';
-if (! empty($user->societe_id))
- $socid = $user->societe_id;
+if (! empty($user->socid))
+ $socid = $user->socid;
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -109,7 +109,7 @@ if ($id > 0 || ! empty($ref)) {
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index f779ced92ee..8a14c3f19a4 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -37,7 +37,7 @@ $ref = GETPOST('ref', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref))
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index d14eba99fae..6c5379d1ddb 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha');
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$socid='';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -122,7 +122,7 @@ if ($id > 0 || ! empty($ref))
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index 78ee704293d..70643e9c996 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha');
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$socid = '';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -105,7 +105,7 @@ if ($id > 0 || ! empty($ref))
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
@@ -127,7 +127,7 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->fournisseur->facture->lire)
{
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, d.rowid, d.total_ht as line_total_ht,";
- $sql .= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.libelle, f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut as statut, d.qty";
+ $sql .= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.libelle as label, f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut as statut, d.qty";
if (! $user->rights->societe->client->voir && ! $socid)
$sql .= ", sc.fk_soc, sc.fk_user ";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
@@ -221,7 +221,8 @@ if ($id > 0 || ! empty($ref))
$supplierinvoicestatic->id = $objp->facid;
$supplierinvoicestatic->ref = $objp->ref;
$supplierinvoicestatic->ref_supplier = $objp->ref_supplier;
- $supplierinvoicestatic->libelle = $objp->libelle;
+ $supplierinvoicestatic->libelle = $objp->label;
+ $supplierinvoicestatic->label = $objp->label;
$supplierinvoicestatic->total_ht = $objp->total_ht;
$supplierinvoicestatic->total_ttc = $objp->total_ttc;
$supplierinvoicestatic->total_tva = $objp->total_tva;
diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php
index 0b8ae599809..4c58a6fb982 100644
--- a/htdocs/product/stats/propal.php
+++ b/htdocs/product/stats/propal.php
@@ -40,7 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$socid='';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -105,7 +105,7 @@ if ($id > 0 || ! empty($ref))
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php
index fbab22a0d2f..0dc19a47691 100644
--- a/htdocs/product/stats/supplier_proposal.php
+++ b/htdocs/product/stats/supplier_proposal.php
@@ -40,7 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$socid='';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -105,7 +105,7 @@ if ($id > 0 || ! empty($ref))
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 94012c1b9cf..22f7cc03b63 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -378,7 +378,7 @@ else
$morehtmlref.='';
$shownav = 1;
- if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index 35b433c5a28..361497189f9 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -44,26 +44,20 @@ class Entrepot extends CommonObject
*/
public $table_element='entrepot';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='stock';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
/**
- * Warehouse closed, inactive
+ * @var string Label
+ * @deprecated
*/
- const STATUS_CLOSED = 0;
-
- /**
- * Warehouse open and operations for customer shipping, supplier dispatch, internal stock transfers/corrections allowed.
- */
- const STATUS_OPEN_ALL = 1;
-
- /**
- * Warehouse open and operations for stock transfers/corrections allowed (not for customer shipping and supplier dispatch).
- */
- const STATUS_OPEN_INTERNAL = 2;
-
public $libelle;
+ public $label;
+
/**
* @var string description
*/
@@ -118,6 +112,21 @@ class Entrepot extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
);
+ /**
+ * Warehouse closed, inactive
+ */
+ const STATUS_CLOSED = 0;
+
+ /**
+ * Warehouse open and operations for customer shipping, supplier dispatch, internal stock transfers/corrections allowed.
+ */
+ const STATUS_OPEN_ALL = 1;
+
+ /**
+ * Warehouse open and operations for stock transfers/corrections allowed (not for customer shipping and supplier dispatch).
+ */
+ const STATUS_OPEN_INTERNAL = 2;
+
/**
* Constructor
@@ -443,7 +452,7 @@ class Entrepot extends CommonObject
$this->id = $obj->rowid;
$this->fk_parent = $obj->fk_parent;
$this->ref = $obj->label;
- $this->label = $obj->label; // deprecated
+ $this->label = $obj->label;
$this->libelle = $obj->label; // deprecated
$this->description = $obj->description;
$this->statut = $obj->statut;
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index 3848a592f21..dbd0354cea3 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -45,6 +45,9 @@ class Productlot extends CommonObject
*/
public $table_element = 'product_lot';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='barcode';
/**
@@ -501,11 +504,11 @@ class Productlot extends CommonObject
/**
* Return label of a given status
*
- * @param int $statut Status
+ * @param int $status Status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label of status
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php
index e4786ae5a5a..496d4b4f109 100644
--- a/htdocs/product/stock/index.php
+++ b/htdocs/product/stock/index.php
@@ -61,12 +61,13 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
print '';
print ' ';
+ print '
";
}
@@ -85,6 +86,7 @@ if ($result)
$i = 0;
+ print '
';
print '
';
print ''.$langs->trans("Warehouses").' ';
@@ -105,6 +107,7 @@ if ($result)
$db->free($result);
}
print "
";
+ print '
';
}
else
{
@@ -137,6 +140,7 @@ if ($resql)
{
$num = $db->num_rows($resql);
+ print '
';
print '
';
print "";
print ''.$langs->trans("LastMovements", min($num, $max)).' ';
@@ -185,6 +189,7 @@ if ($resql)
$db->free($resql);
print "
";
+ print '
';
}
//print '
';
diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php
index 3314fcf642c..692fe17a83d 100644
--- a/htdocs/product/stock/info.php
+++ b/htdocs/product/stock/info.php
@@ -60,7 +60,7 @@ $morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu;
$morehtmlref.='
';
$shownav = 1;
-if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php
index 5324ef80243..0f4e5476fd2 100644
--- a/htdocs/product/stock/massstockmove.php
+++ b/htdocs/product/stock/massstockmove.php
@@ -35,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$langs->loadLangs(array('products', 'stocks', 'orders', 'productbatch'));
// Security check
-if ($user->societe_id) {
- $socid = $user->societe_id;
+if ($user->socid) {
+ $socid = $user->socid;
}
$result=restrictedArea($user, 'produit|service');
diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php
index b04b8b8a220..5f4e1b97aa6 100644
--- a/htdocs/product/stock/movement_card.php
+++ b/htdocs/product/stock/movement_card.php
@@ -444,7 +444,7 @@ $formproduct=new FormProduct($db);
if (!empty($conf->projet->enabled)) $formproject=new FormProjets($db);
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
-$sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,";
+$sql.= " e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu,";
$sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql.= " m.batch, m.price,";
$sql.= " m.type_mouvement,";
@@ -567,7 +567,7 @@ if ($resql)
$morehtmlref.='';
$shownav = 1;
- if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
@@ -978,7 +978,8 @@ if ($resql)
$productlot->sellby= $objp->sellby;
$warehousestatic->id=$objp->entrepot_id;
- $warehousestatic->libelle=$objp->stock;
+ $warehousestatic->libelle=$objp->warehouse_ref; // deprecated
+ $warehousestatic->label=$objp->warehouse_ref;
$warehousestatic->lieu=$objp->lieu;
$arrayofuniqueproduct[$objp->rowid]=$objp->produit;
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index 5303fa78a6c..85f40a9d214 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -549,7 +549,7 @@ if ($resql)
$morehtmlref.='';
$shownav = 1;
- if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
@@ -986,7 +986,7 @@ if ($resql)
$warehousestatic->id=$objp->entrepot_id;
$warehousestatic->ref=$objp->warehouse_ref;
- $warehousestatic->libelle=$objp->warehouse_ref;
+ $warehousestatic->libelle=$objp->warehouse_ref; // deprecated
$warehousestatic->label=$objp->warehouse_ref;
$warehousestatic->lieu=$objp->lieu;
$warehousestatic->fk_parent = $objp->fk_parent;
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 060bcc57960..3428b75f395 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -76,7 +76,7 @@ if (!empty($batchnumber)) {
}
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit&stock', $id, 'product&product', '', '', $fieldid);
@@ -548,7 +548,7 @@ if ($id > 0 || $ref)
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php
index 00299c94459..c7f9a5ae8fa 100644
--- a/htdocs/product/stock/productlot_card.php
+++ b/htdocs/product/stock/productlot_card.php
@@ -53,7 +53,7 @@ if (empty($action) && empty($id) && empty($ref)) $action='list';
// Protection if external user
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
//accessforbidden();
}
@@ -318,7 +318,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$linkback = '' . $langs->trans("BackToList") . ' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch');
diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php
index ed4aea8c010..5fb9cc23bca 100644
--- a/htdocs/product/stock/productlot_document.php
+++ b/htdocs/product/stock/productlot_document.php
@@ -48,7 +48,7 @@ $confirm= GETPOST('confirm', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : '');
$fieldtype = 'rowid';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -132,7 +132,7 @@ if ($object->id)
$linkback = '' . $langs->trans("BackToList") . ' ';
$shownav = 1;
- if ($user->societe_id && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch');
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index fbbec95f2df..3be66f6acfe 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -67,9 +67,9 @@ if (! $sortorder) $sortorder="ASC";
// Protection if external user
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
//accessforbidden();
}
@@ -216,7 +216,9 @@ $sql.= " p.ref as product_ref,";
$sql.= " p.label as product_label,";
$sql.= " p.tobatch";
// Add fields for extrafields
-foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
+}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index 3536088cab5..168ed5e54f9 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -38,8 +38,8 @@ require_once './lib/replenishment.lib.php';
$langs->loadLangs(array('products', 'stocks', 'orders'));
// Security check
-if ($user->societe_id) {
- $socid = $user->societe_id;
+if ($user->socid) {
+ $socid = $user->socid;
}
$result=restrictedArea($user, 'produit|service');
diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php
index 2f0714737ee..27834923a0e 100644
--- a/htdocs/product/stock/replenishorders.php
+++ b/htdocs/product/stock/replenishorders.php
@@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array('products', 'stocks', 'orders'));
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service');
$sall = GETPOST('search_all', 'alphanohtml');
diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php
index 054947183ab..19a23e1e9d2 100644
--- a/htdocs/product/traduction.php
+++ b/htdocs/product/traduction.php
@@ -42,7 +42,7 @@ $cancel=GETPOST('cancel', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
@@ -203,7 +203,7 @@ dol_fiche_head($head, 'translation', $titre, 0, $picto);
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
-if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 1);
diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php
index 7a8e3ff2591..cf1249aa9eb 100644
--- a/htdocs/projet/activity/index.php
+++ b/htdocs/projet/activity/index.php
@@ -36,7 +36,7 @@ if ($search_project_user == $user->id) $mine = 1;
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid=$user->societe_id;
+if ($user->socid > 0) $socid=$user->socid;
//$result = restrictedArea($user, 'projet', $projectid);
if (!$user->rights->projet->lire) accessforbidden();
@@ -111,6 +111,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
print '';
print ' ';
+ print '';
print '
';
$i=0;
foreach($listofsearchfields as $key => $value)
@@ -123,6 +124,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
$i++;
}
print '
';
+ print '
';
print ' ';
print ' ';
}
@@ -130,6 +132,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
/* Affichage de la liste des projets d'aujourd'hui */
+print '';
print '
';
print '';
print ''.$langs->trans('ActivityOnProjectToday').' ';
@@ -179,12 +182,14 @@ print ''.$langs->trans('Total').' ';
print ''.convertSecondToTime($total, 'allhourmin').' ';
print " \n";
print "
";
+print '
';
print '';
/* Affichage de la liste des projets d'hier */
+print '
';
print '
';
print '';
print ''.$langs->trans('ActivityOnProjectYesterday').' ';
@@ -234,6 +239,7 @@ print ''.$langs->trans('Total').' ';
print ''.convertSecondToTime($total, 'allhourmin').' ';
print " \n";
print "
";
+print '
';
@@ -243,6 +249,7 @@ if ($db->type != 'pgsql')
print '
';
// Affichage de la liste des projets de la semaine
+ print '
';
print '
';
print '';
print ''.$langs->trans("ActivityOnProjectThisWeek").' ';
@@ -291,7 +298,7 @@ if ($db->type != 'pgsql')
print ''.$langs->trans('Total').' ';
print ''.convertSecondToTime($total, 'allhourmin').' ';
print " \n";
- print "
";
+ print "
";
}
*/
@@ -299,6 +306,7 @@ if ($db->type != 'pgsql')
/* Affichage de la liste des projets du mois */
if (! empty($conf->global->PROJECT_TASK_TIME_MONTH))
{
+ print '
';
print '
';
print '';
print ''.$langs->trans("ActivityOnProjectThisMonth").': '.dol_print_date($now, "%B %Y").' ';
@@ -343,11 +351,13 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH))
print ''.convertSecondToTime($total, 'allhourmin').' ';
print " \n";
print "
";
+ print '
';
}
/* Affichage de la liste des projets de l'annee */
if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
{
+ print '
';
print '
';
print '';
print ''.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).' ';
@@ -393,6 +403,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
print ''.convertSecondToTime($total, 'allhourmin').' ';
print " \n";
print "
";
+ print '
';
}
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA))
@@ -467,6 +478,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S
//print load_fiche_titre($langs->trans("TasksOnOpenedProject"),'','').'
';
+ print '
';
print '
';
print '';
//print ''.$langs->trans('TaskRessourceLinks').' ';
@@ -566,6 +578,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S
}
print "
";
+ print '
';
$db->free($resql);
diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php
index b07b41c1b88..77dcaa641d2 100644
--- a/htdocs/projet/activity/perday.php
+++ b/htdocs/projet/activity/perday.php
@@ -56,7 +56,7 @@ $hookmanager->initHooks(array('timesheetperdaycard'));
// Security check
$socid=0;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
-//if ($user->societe_id > 0) $socid=$user->societe_id;
+//if ($user->socid > 0) $socid=$user->socid;
$result = restrictedArea($user, 'projet', $projectid);
$now=dol_now();
diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php
index e51b2e4b404..8af733394bf 100644
--- a/htdocs/projet/activity/perweek.php
+++ b/htdocs/projet/activity/perweek.php
@@ -56,7 +56,7 @@ $hookmanager->initHooks(array('timesheetperweekcard'));
// Security check
$socid=0;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
-// if ($user->societe_id > 0) $socid=$user->societe_id;
+// if ($user->socid > 0) $socid=$user->socid;
$result = restrictedArea($user, 'projet', $projectid);
$now=dol_now();
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index f15499d4682..5b3d69777b7 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -71,7 +71,7 @@ if ($id > 0 || ! empty($ref))
// Security check
$socid=GETPOST('socid', 'int');
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $object->id, 'projet&project');
// fetch optionals attributes and labels
@@ -509,7 +509,7 @@ if ($action == 'create' && $user->rights->projet->creer)
dol_fiche_head();
- print '
';
+ print '';
$defaultref='';
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index a873b53dbc0..e049945f235 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -60,6 +60,9 @@ class Project extends CommonObject
*/
public $ismultientitymanaged = 1;
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'projectpub';
/**
@@ -1453,7 +1456,7 @@ class Project extends CommonObject
// Security check
$socid=0;
- if ($user->societe_id > 0) $socid = $user->societe_id;
+ if ($user->socid > 0) $socid = $user->socid;
$tasksarray=$taskstatic->getTasksArray(0, 0, $fromid, $socid, 0);
@@ -1533,7 +1536,7 @@ class Project extends CommonObject
// Security check
$socid=0;
- if ($user->societe_id > 0) $socid = $user->societe_id;
+ if ($user->socid > 0) $socid = $user->socid;
$tasksarray=$taskstatic->getTasksArray(0, 0, $this->id, $socid, 0);
@@ -1764,7 +1767,7 @@ class Project extends CommonObject
global $conf, $langs;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
- //$socid=$user->societe_id;
+ //$socid=$user->socid;
$projectsListId = null;
if (! $user->rights->projet->all->lire) $projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1);
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 1bd044bc985..dcc4c18c497 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -47,6 +47,9 @@ class Task extends CommonObject
*/
public $fk_element='fk_task';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'task';
/**
@@ -1839,11 +1842,11 @@ class Task extends CommonObject
/**
* Return status label for an object
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
// list of Statut of the task
@@ -1862,59 +1865,59 @@ class Task extends CommonObject
if ($mode == 0)
{
- return $langs->trans($this->statuts[$statut]);
+ return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 1)
{
- return $langs->trans($this->statuts_short[$statut]);
+ return $langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 2)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
- elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5').' '.$langs->trans($this->statuts_short[$statut]);
+ if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]);
+ elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 3)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
- elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1');
- elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3');
- elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
- elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
- elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5');
+ if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
+ elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1');
+ elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3');
+ elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
+ elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
+ elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5');
}
elseif ($mode == 4)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5').' '.$langs->trans($this->statuts[$statut]);
+ if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts[$status]);
}
elseif ($mode == 5)
{
- /*if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
- elseif ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1');
- elseif ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3');
- elseif ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
- elseif ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
- elseif ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5');
+ /*if ($status==0) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0');
+ elseif ($status==1) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1');
+ elseif ($status==2) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut3');
+ elseif ($status==3) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6');
+ elseif ($status==4) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6');
+ elseif ($status==5) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5');
*/
//else return $this->progress.' %';
return ' ';
}
elseif ($mode == 6)
{
- /*if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
- elseif ($statut==1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1');
- elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3');
- elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
- elseif ($statut==4) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
- elseif ($statut==5) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5');
+ /*if ($status==0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0');
+ elseif ($status==1) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1');
+ elseif ($status==2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut3');
+ elseif ($status==3) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6');
+ elseif ($status==4) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6');
+ elseif ($status==5) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5');
*/
//else return $this->progress.' %';
return ' ';
@@ -1966,7 +1969,7 @@ class Task extends CommonObject
global $conf, $langs;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
- //$socid=$user->societe_id;
+ //$socid=$user->socid;
$projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
@@ -2039,7 +2042,7 @@ class Task extends CommonObject
// phpcs:enable
global $user;
- $mine=0; $socid=$user->societe_id;
+ $mine=0; $socid=$user->socid;
$projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $mine, 1, $socid);
diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php
index b535b0f6ada..064f4a12729 100644
--- a/htdocs/projet/comment.php
+++ b/htdocs/projet/comment.php
@@ -49,7 +49,7 @@ $planned_workload=((GETPOST('planned_workloadhour', 'int')!='' || GETPOST('plann
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (! $user->rights->projet->lire) accessforbidden();
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index a1735e20ad6..82eb598190b 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -47,7 +47,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $id, 'projet&project');
$hookmanager->initHooks(array('projectcontactcard','globalcard'));
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index 10c7a140df7..f77419f2e75 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -42,7 +42,7 @@ $mine = (GETPOST('mode', 'alpha') == 'mine' ? 1 : 0);
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result=restrictedArea($user, 'projet', $id, 'projet&project');
$object = new Project($db);
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 5f74a971f87..14dccfedb8d 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -100,7 +100,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob
// Security check
$socid=$object->socid;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $object->id, 'projet&project');
$hookmanager->initHooks(array('projectOverview'));
diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php
index 57be29b1bb2..725d99fb673 100644
--- a/htdocs/projet/ganttview.php
+++ b/htdocs/projet/ganttview.php
@@ -46,7 +46,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $id, 'projet&project');
// Load translation files required by the page
diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php
index 7d75544ef93..0987a47e507 100644
--- a/htdocs/projet/graph_opportunities.inc.php
+++ b/htdocs/projet/graph_opportunities.inc.php
@@ -55,20 +55,20 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$listofstatus=array_keys($listofoppstatus);
foreach ($listofstatus as $status)
{
- $labelstatus = '';
+ $labelStatus = '';
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
- if ($code) $labelstatus = $langs->trans("OppStatus".$code);
- if (empty($labelstatus)) $labelstatus=$listofopplabel[$status];
+ if ($code) $labelStatus = $langs->trans("OppStatus".$code);
+ if (empty($labelStatus)) $labelStatus=$listofopplabel[$status];
- //$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
- //$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%';
+ //$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
+ //$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%';
- $dataseries[]=array($labelstatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0));
+ $dataseries[]=array($labelStatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0));
if (! $conf->use_javascript_ajax)
{
print '';
- print ''.$labelstatus.' ';
+ print ''.$labelStatus.' ';
print ''.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).' ';
print " \n";
}
diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php
index c16d42ae97c..a2526171b9b 100644
--- a/htdocs/projet/index.php
+++ b/htdocs/projet/index.php
@@ -45,7 +45,7 @@ if ($search_project_user == $user->id) $mine = 1;
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (!$user->rights->projet->lire) accessforbidden();
$sortfield = GETPOST("sortfield", 'alpha');
@@ -171,7 +171,7 @@ print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppst
print '';
-// Last modified projects
+// Latest modified projects
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.tms as datem,";
$sql.= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
@@ -243,7 +243,7 @@ if ($resql)
}
print '';
print '
'.dol_print_date($db->jdate($obj->datem), 'day').' ';
- print '
'.$projectstatic->LibStatut($obj->fk_statut, 5).' ';
+ print '
'.$projectstatic->LibStatut($obj->fk_statut, 3).' ';
print '';
$i++;
}
diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php
index 207bd245d08..ff361e75d3d 100644
--- a/htdocs/projet/info.php
+++ b/htdocs/projet/info.php
@@ -62,7 +62,7 @@ $search_agenda_label=GETPOST('search_agenda_label');
// Security check
$id = GETPOST("id", 'int');
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result=restrictedArea($user, 'projet', $id, '');
if (!$user->rights->projet->lire) accessforbidden();
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index 2c311de7792..6cbe9d68127 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -48,7 +48,7 @@ $title = $langs->trans("Projects");
// Security check
$socid = (is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 );
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if ($socid > 0)
{
$soc = new Societe($db);
diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php
index ef324bb63bb..73c9d39d64d 100644
--- a/htdocs/projet/note.php
+++ b/htdocs/projet/note.php
@@ -43,7 +43,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $id, 'projet&project');
$permissionnote=$user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php
diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php
index f8480f8f322..a7e6bf510b3 100644
--- a/htdocs/projet/stats/index.php
+++ b/htdocs/projet/stats/index.php
@@ -38,10 +38,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
$year = GETPOST('year')>0?GETPOST('year'):$nowyear;
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 2395f5f0bd1..0bffd50ce62 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -80,7 +80,7 @@ $extrafields->fetch_name_optionals_label($taskstatic->table_element);
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $id, 'projet&project');
$diroutputmassaction=$conf->projet->dir_output . '/tasks/temp/massgeneration/'.$user->id;
diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php
index d9a251b3c53..31211e59dbf 100644
--- a/htdocs/projet/tasks/comment.php
+++ b/htdocs/projet/tasks/comment.php
@@ -49,7 +49,7 @@ $planned_workload=((GETPOST('planned_workloadhour', 'int')!='' || GETPOST('plann
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (! $user->rights->projet->lire) accessforbidden();
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index b09d8345177..aa94d413fc9 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -42,7 +42,7 @@ $project_ref=GETPOST('project_ref', 'alpha');
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
//$result = restrictedArea($user, 'projet', $id, 'projet_task');
if (! $user->rights->projet->lire) accessforbidden();
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 52795f7a249..1944de13f61 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -46,7 +46,7 @@ $project_ref = GETPOST('project_ref', 'alpha');
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
//$result=restrictedArea($user,'projet',$id,'');
if (!$user->rights->projet->lire) accessforbidden();
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index e13b7092b26..8718806004b 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -83,7 +83,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (!$user->rights->projet->lire) accessforbidden();
$diroutputmassaction=$conf->projet->dir_output . '/tasks/temp/massgeneration/'.$user->id;
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index de2707bf734..42dbaa48cc2 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -40,7 +40,7 @@ $project_ref = GETPOST('project_ref', 'alpha');
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (!$user->rights->projet->lire) accessforbidden();
//$result = restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification
diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php
index c94a412be9c..c9e8bc335e7 100644
--- a/htdocs/projet/tasks/stats/index.php
+++ b/htdocs/projet/tasks/stats/index.php
@@ -38,10 +38,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
$year = GETPOST('year')>0?GETPOST('year'):$nowyear;
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 78431f983a4..0bc07537ccf 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -48,7 +48,7 @@ $planned_workload=((GETPOST('planned_workloadhour', 'int')!='' || GETPOST('plann
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (! $user->rights->projet->lire) accessforbidden();
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 3dc54cc2223..24e5d067186 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -68,7 +68,7 @@ $search_valuebilled=GETPOST('search_valuebilled', 'int');
// Security check
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
if (!$user->rights->projet->lire) accessforbidden();
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index 5fd655f73ac..7cd935c4d2c 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -560,7 +560,6 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE))
else
{
$adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE);
- //print $adht->libelle;
print '
';
}
// Moral/Physic attribute
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/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php
index ce93ec020c3..0bde25460e3 100644
--- a/htdocs/public/ticket/create_ticket.php
+++ b/htdocs/public/ticket/create_ticket.php
@@ -348,7 +348,7 @@ llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss
print '
';
if ($action != "infos_success") {
- $formticket->withfromsocid = isset($socid) ? $socid : $user->societe_id;
+ $formticket->withfromsocid = isset($socid) ? $socid : $user->socid;
$formticket->withtitletopic = 1;
$formticket->withcompany = 0;
$formticket->withusercreate = 1;
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 832fd4fc70d..2e9dbe5f57b 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -72,7 +72,7 @@ $line_id = GETPOST('lineid', 'int')?GETPOST('lineid', 'int'):'';
// Security check
$socid='';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
if ($origin == 'reception') $result=restrictedArea($user, $origin, $id);
else {
@@ -820,7 +820,7 @@ if ($action == 'create')
print "";
// Note Private
- if ($object->note_private && ! $user->societe_id)
+ if ($object->note_private && ! $user->socid)
{
print '
'.$langs->trans("NotePrivate").' ';
print '';
@@ -2019,7 +2019,7 @@ elseif ($id || $ref)
* Boutons actions
*/
- if (($user->societe_id == 0) && ($action!='presend'))
+ if (($user->socid == 0) && ($action!='presend'))
{
print '';
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index dd819adff0a..48a35412987 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -48,7 +48,11 @@ class Reception extends CommonObject
public $table_element="reception";
public $table_element_line="commande_fournisseur_dispatch";
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
- public $picto = 'reception';
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
+ public $picto = 'reception';
public $socid;
public $ref_supplier;
@@ -80,8 +84,14 @@ class Reception extends CommonObject
* @var int
*/
public $date_reception;
- public $date_creation;
- public $date_valid;
+
+ /**
+ * @var integer|string date_creation
+ */
+ public $date_creation;
+
+
+ public $date_valid;
public $meths;
public $listmeths; // List of carriers
@@ -1136,44 +1146,44 @@ class Reception extends CommonObject
/**
* Return label of a status
*
- * @param int $statut Id statut
+ * @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
* @return string Label of status
*/
- public function LibStatut($statut, $mode)
+ public function LibStatut($status, $mode)
{
// phpcs:enable
global $langs;
if ($mode==0)
{
- if ($statut==0) return $langs->trans($this->statuts[$statut]);
- elseif ($statut==1) return $langs->trans($this->statuts[$statut]);
- elseif ($statut==2) return $langs->trans($this->statuts[$statut]);
+ if ($status==0) return $langs->trans($this->statuts[$status]);
+ elseif ($status==1) return $langs->trans($this->statuts[$status]);
+ elseif ($status==2) return $langs->trans($this->statuts[$status]);
}
elseif ($mode==1)
{
- if ($statut==0) return $langs->trans('StatusReceptionDraftShort');
- elseif ($statut==1) return $langs->trans('StatusReceptionValidatedShort');
- elseif ($statut==2) return $langs->trans('StatusReceptionProcessedShort');
+ if ($status==0) return $langs->trans('StatusReceptionDraftShort');
+ elseif ($status==1) return $langs->trans('StatusReceptionValidatedShort');
+ elseif ($status==2) return $langs->trans('StatusReceptionProcessedShort');
}
elseif ($mode == 3)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
- elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4');
- elseif ($statut==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6');
+ if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0');
+ elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4');
+ elseif ($status==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6');
}
elseif ($mode == 4)
{
- if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
- elseif ($statut==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6').' '.$langs->trans('StatusReceptionProcessed');
+ if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
+ elseif ($status==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6').' '.$langs->trans('StatusReceptionProcessed');
}
elseif ($mode == 5)
{
- if ($statut==0) return $langs->trans('StatusReceptionDraftShort').' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
- elseif ($statut==1) return $langs->trans('StatusReceptionValidatedShort').' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4');
- elseif ($statut==2) return $langs->trans('StatusReceptionProcessedShort').' '.img_picto($langs->trans('StatusReceptionProcessedShort'), 'statut6');
+ if ($status==0) return $langs->trans('StatusReceptionDraftShort').' '.img_picto($langs->trans($this->statuts[$status]), 'statut0');
+ elseif ($status==1) return $langs->trans('StatusReceptionValidatedShort').' '.img_picto($langs->trans($this->statuts[$status]), 'statut4');
+ elseif ($status==2) return $langs->trans('StatusReceptionProcessedShort').' '.img_picto($langs->trans('StatusReceptionProcessedShort'), 'statut6');
}
}
diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php
index c49eec5c82d..da074c420b5 100644
--- a/htdocs/reception/contact.php
+++ b/htdocs/reception/contact.php
@@ -44,7 +44,7 @@ $ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'reception', $id, '');
$object = new Reception($db);
diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php
index 17b5cd03c06..5844365b56f 100644
--- a/htdocs/reception/index.php
+++ b/htdocs/reception/index.php
@@ -58,11 +58,12 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
print '
';
print ' ';
+ print '
\n";
}
/*
@@ -93,6 +94,7 @@ if ($resql)
$num = $db->num_rows($resql);
if ($num)
{
+ print '';
print '
';
print '';
print ''.$langs->trans("ReceptionsToValidate").' ';
@@ -116,7 +118,7 @@ if ($resql)
print '';
$i++;
}
- print "
";
+ print "
";
}
}
@@ -143,6 +145,7 @@ if ($resql)
$langs->load("orders");
$i = 0;
+ print '';
print '
';
print '';
print ''.$langs->trans("SuppliersOrdersToProcess").' ';
@@ -172,7 +175,7 @@ if ($resql)
print '';
$i++;
}
- print "
";
+ print "
";
}
}
@@ -203,6 +206,7 @@ if ( $resql )
if ($num)
{
$i = 0;
+ print '';
print '
';
print '';
print ''.$langs->trans("SuppliersOrdersInProcess").' ';
@@ -231,7 +235,7 @@ if ( $resql )
print '';
$i++;
}
- print "
";
+ print "
";
}
}
else dol_print_error($db);
@@ -263,6 +267,7 @@ if ($resql)
if ($num)
{
$i = 0;
+ print '';
print '
';
print '';
print ''.$langs->trans("LastReceptions", $num).' ';
@@ -289,7 +294,7 @@ if ($resql)
print '';
$i++;
}
- print "
";
+ print "
";
}
$db->free($resql);
}
diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php
index 1a201a4bfd0..a2d2f494fc3 100644
--- a/htdocs/reception/list.php
+++ b/htdocs/reception/list.php
@@ -42,7 +42,7 @@ $toselect = GETPOST('toselect', 'array');
// Security check
$receptionid = GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'reception', $receptionid, '');
$diroutputmassaction=$conf->reception->dir_output . '/temp/massgeneration/'.$user->id;
@@ -473,7 +473,7 @@ foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/', '', $key);
- $typ=$extrafields->attribute_type[$tmpkey];
+ $typ=$extrafields->attributes[$object->table_element]['type'][$tmpkey];
$mode=0;
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php
index cbc1185aaab..5a2e8745cb7 100644
--- a/htdocs/reception/note.php
+++ b/htdocs/reception/note.php
@@ -48,7 +48,7 @@ $action=GETPOST('action', 'alpha');
// Security check
$socid='';
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, $origin, $origin_id);
$object = new Reception($db);
diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php
index 76315ccce03..06304a2afb8 100644
--- a/htdocs/reception/stats/index.php
+++ b/htdocs/reception/stats/index.php
@@ -35,10 +35,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
@@ -74,7 +74,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenamenb = $dir.'/receptionsnbinyear-'.$user->id.'-'.$year.'.png';
}
@@ -114,7 +114,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenameamount = $dir.'/receptionsamountinyear-'.$user->id.'-'.$year.'.png';
}
@@ -152,7 +152,7 @@ if (! $mesg)
/*
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/receptionsaverage-'.$user->id.'-'.$year.'.png';
}
diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php
index 0f2e79ef86f..803190ec699 100644
--- a/htdocs/resource/agenda.php
+++ b/htdocs/resource/agenda.php
@@ -37,6 +37,13 @@ require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
// Load translation files required by the page
$langs->load("companies");
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'alpha');
+$cancel = GETPOST('cancel', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+
if (GETPOST('actioncode', 'array'))
{
$actioncode=GETPOST('actioncode', 'array', 3);
@@ -48,21 +55,6 @@ else
}
$search_agenda_label=GETPOST('search_agenda_label');
-// Security check
-$id = GETPOST('id', 'int');
-$ref = GETPOST('ref', 'alpha');
-if ($user->societe_id) $id=$user->societe_id;
-// Protection if external user
-if ($user->socid > 0)
-{
- accessforbidden();
-}
-
-if( ! $user->rights->resource->read)
-{
- accessforbidden();
-}
-
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
@@ -74,9 +66,20 @@ $pagenext = $page + 1;
if (! $sortfield) $sortfield='a.datep,a.id';
if (! $sortorder) $sortorder='DESC,DESC';
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new DolResource($db);
+$object->fetch($id, $ref);
+
+// Initialize technical objects
+//$object=new MyObject($db);
+$extrafields = new ExtraFields($db);
$hookmanager->initHooks(array('agendaresource'));
+// Security check
+if( ! $user->rights->resource->read)
+{
+ accessforbidden();
+}
+
/*
* Actions
@@ -110,10 +113,9 @@ if (empty($reshook))
*/
$contactstatic = new Contact($db);
-
$form = new Form($db);
-if ($id > 0 || $ref)
+if ($object->id > 0)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -121,9 +123,6 @@ if ($id > 0 || $ref)
$langs->load("companies");
$picto = 'resource';
- $object = new Dolresource($db);
- $result = $object->fetch($id);
-
$title=$langs->trans("Agenda");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/productnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref." - ".$title;
llxHeader('', $title);
@@ -138,13 +137,15 @@ if ($id > 0 || $ref)
$linkback = ''.$langs->trans("BackToList").' ';
- $shownav = 1;
- if ($user->societe_id && ! in_array('resource', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ $morehtmlref='';
+ $morehtmlref.='
';
- dol_banner_tab($object, 'id', $linkback, $shownav, 'id');
+ $shownav = 1;
+ if ($user->socid && ! in_array('resource', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '';
@@ -153,11 +154,9 @@ if ($id > 0 || $ref)
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
- print ' ';
-
- $param='&id='.$id;
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
+ $param='&id='.$object->id.'&socid='.$socid;
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
print_barre_liste($langs->trans("ActionsOnResource"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1);
diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php
index 2b4092671dc..f52da4934b0 100644
--- a/htdocs/resource/card.php
+++ b/htdocs/resource/card.php
@@ -63,9 +63,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
-/*******************************************************************
- * ACTIONS
- ********************************************************************/
+/*
+ * Actions
+ */
$hookmanager->initHooks(array('resource', 'resource_card','globalcard'));
$parameters=array('resource_id'=>$id);
@@ -211,18 +211,17 @@ if (empty($reshook))
}
-/***************************************************
-* VIEW
-*
-* Put here all code to build page
-****************************************************/
+/*
+ * View
+ */
+
$title = $langs->trans($action == 'create' ? 'AddResource' : 'ResourceSingular');
llxHeader('', $title, '');
$form = new Form($db);
$formresource = new FormResource($db);
-if ($action == 'create' || $object->fetch($id) > 0)
+if ($action == 'create' || $object->fetch($id, $ref) > 0)
{
if ($action == 'create')
{
diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php
index c85f040f896..db64c635fd5 100644
--- a/htdocs/resource/class/dolresource.class.php
+++ b/htdocs/resource/class/dolresource.class.php
@@ -39,7 +39,10 @@ class Dolresource extends CommonObject
*/
public $table_element='resource';
- public $picto = 'resource';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
+ public $picto = 'resource';
public $resource_id;
public $resource_type;
diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php
index 872078ac51d..3e2a004e194 100644
--- a/htdocs/resource/contact.php
+++ b/htdocs/resource/contact.php
@@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'resource', $id, 'resource');
$object = new DolResource($db);
diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php
index fef78e8088c..e023134b9f5 100644
--- a/htdocs/resource/document.php
+++ b/htdocs/resource/document.php
@@ -44,7 +44,7 @@ $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'resource', $id, 'resource');
@@ -82,7 +82,7 @@ $form = new Form($db);
llxHeader('', $langs->trans("Resource"));
-if ($object->id)
+if ($object->id > 0)
{
$object->fetch_thirdparty();
@@ -100,7 +100,7 @@ if ($object->id)
}
- $linkback = '' . $langs->trans("BackToList") . ' ';
+ $linkback = '' . $langs->trans("BackToList") . ' ';
$morehtmlref='';
diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php
index a0c1a724ed8..2ab64799f1d 100644
--- a/htdocs/resource/element_resource.php
+++ b/htdocs/resource/element_resource.php
@@ -357,7 +357,7 @@ else
}
$morehtmlref.='
';
- dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', '');
+ dol_banner_tab($act, 'element_id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', '');
print '';
@@ -453,7 +453,7 @@ else
dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), -1, 'company');
- dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '&element='.$element);
+ dol_banner_tab($socstatic, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom', '', '&element='.$element);
print '
';
@@ -557,7 +557,7 @@ else
dol_fiche_head($head, 'resources', $titre, -1, $picto);
$shownav = 1;
- if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($product, 'ref', '', $shownav, 'ref', 'ref', '', '&element='.$element);
dol_fiche_end();
diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php
index 0f003f05eb6..ae1b4ffb7f7 100644
--- a/htdocs/resource/list.php
+++ b/htdocs/resource/list.php
@@ -71,7 +71,7 @@ foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/', '', $key);
- $typ=$extrafields->attribute_type[$tmpkey];
+ $typ=$extrafields->attributes[$object->table_element]['type'][$tmpkey];
if ($val != '') {
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
diff --git a/htdocs/resource/note.php b/htdocs/resource/note.php
index 8c7f106285f..322088ef317 100644
--- a/htdocs/resource/note.php
+++ b/htdocs/resource/note.php
@@ -37,7 +37,7 @@ $ref = GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'resource', $id, 'resource');
$object = new DolResource($db);
diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php
index 32edd342cb8..4e9b9dac118 100644
--- a/htdocs/salaries/card.php
+++ b/htdocs/salaries/card.php
@@ -48,7 +48,7 @@ $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOS
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'salaries', '', '', '');
$object = new PaymentSalary($db);
diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php
index a7b92d63efb..7bd9a14a718 100644
--- a/htdocs/salaries/document.php
+++ b/htdocs/salaries/document.php
@@ -45,7 +45,7 @@ $confirm = GETPOST('confirm', 'alpha');
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'salaries', '', '', '');
diff --git a/htdocs/salaries/info.php b/htdocs/salaries/info.php
index 5ba53c45665..a96db0cbd5f 100644
--- a/htdocs/salaries/info.php
+++ b/htdocs/salaries/info.php
@@ -36,7 +36,7 @@ $action=GETPOST('action', 'aZ09');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'salaries', '', '', '');
diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php
index 816b734ea23..02a729cb16c 100644
--- a/htdocs/salaries/list.php
+++ b/htdocs/salaries/list.php
@@ -33,7 +33,7 @@ $langs->loadLangs(array("compta","salaries","bills","hrm"));
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'salaries', '', '', '');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php
index a301dc927a1..38a568d5fc0 100644
--- a/htdocs/salaries/stats/index.php
+++ b/htdocs/salaries/stats/index.php
@@ -38,7 +38,7 @@ $id = GETPOST('id', 'int');
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'salaries', '', '', '');
$nowyear=strftime("%Y", dol_now());
diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php
index 231174a0afa..ae2622d7f93 100644
--- a/htdocs/societe/agenda.php
+++ b/htdocs/societe/agenda.php
@@ -47,7 +47,7 @@ $search_agenda_label=GETPOST('search_agenda_label');
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $socid, '&societe');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
@@ -117,7 +117,7 @@ if ($socid > 0)
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php
index 28f2ec7306b..aafcd8ffc69 100644
--- a/htdocs/societe/canvas/actions_card_common.class.php
+++ b/htdocs/societe/canvas/actions_card_common.class.php
@@ -266,7 +266,7 @@ abstract class ActionsCardCommon
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', '', 0, 'company');
$this->tpl['showend']=dol_get_fiche_end();
- $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
+ $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom');
$this->tpl['checkcustomercode'] = $this->object->check_codeclient();
$this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
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/card.php b/htdocs/societe/card.php
index 0d447ebe6c3..5ba0b3b6cc9 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -61,7 +61,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
if (empty($socid) && $action == 'view') $action='create';
$object = new Societe($db);
@@ -2296,7 +2296,7 @@ else
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php
index 91825fa0d2b..42fae860666 100644
--- a/htdocs/societe/class/api_thirdparties.class.php
+++ b/htdocs/societe/class/api_thirdparties.class.php
@@ -1676,6 +1676,13 @@ class Thirdparties extends DolibarrApi
$object = parent::_cleanObjectDatas($object);
unset($object->nom); // ->name already defined and nom deprecated
+ unset($object->name_bis); // ->name_alias already defined
+ unset($object->note); // ->note_private and note_public already defined
+ unset($object->departement);
+ unset($object->departement_code);
+ unset($object->pays);
+ unset($object->particulier);
+ unset($object->prefix_comm);
unset($object->total_ht);
unset($object->total_tva);
@@ -1686,6 +1693,8 @@ class Thirdparties extends DolibarrApi
unset($object->lines);
unset($object->thirdparty);
+ unset($object->fk_delivery_address); // deprecated feature
+
return $object;
}
diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php
index 9c6c15e2f66..c345d195935 100644
--- a/htdocs/societe/class/client.class.php
+++ b/htdocs/societe/class/client.class.php
@@ -63,7 +63,7 @@ class Client extends Societe
$sql = "SELECT count(s.rowid) as nb, s.client";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id)
+ if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index edea020ec3a..21213272a26 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -70,6 +70,9 @@ class Societe extends CommonObject
*/
protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm");
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto = 'company';
/**
@@ -328,11 +331,12 @@ class Societe extends CommonObject
* @var string
*/
public $user_modification;
+
/**
- * Date of creation
- * @var string
+ * @var integer|string date_creation
*/
public $date_creation;
+
/**
* User that created the thirdparty
* @var User
@@ -407,9 +411,16 @@ class Societe extends CommonObject
*/
public $note_public;
- //! code statut prospect
+ /**
+ * Status prospect id
+ * @var int
+ */
public $stcomm_id;
- public $statut_commercial;
+ /**
+ * Status prospect label
+ * @var int
+ */
+ public $status_prospect_label;
/**
* Assigned price level
@@ -1354,9 +1365,9 @@ class Societe extends CommonObject
$this->state = ($obj->state!='-'?$obj->state:'');
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcomm);
- $libelle=($transcode!='StatusProspect'.$obj->fk_stcomm?$transcode:$obj->stcomm);
- $this->stcomm_id = $obj->fk_stcomm; // id statut commercial
- $this->statut_commercial = $libelle; // libelle statut commercial
+ $label = ($transcode!='StatusProspect'.$obj->fk_stcomm ? $transcode : $obj->stcomm);
+ $this->stcomm_id = $obj->fk_stcomm; // id status prospect
+ $this->status_prospect_label = $label; // label status prospect
$this->email = $obj->email;
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
@@ -2236,7 +2247,7 @@ class Societe extends CommonObject
$linkend='';
global $user;
- if (! $user->rights->societe->client->voir && $user->societe_id > 0 && $this->id != $user->societe_id)
+ if (! $user->rights->societe->client->voir && $user->socid > 0 && $this->id != $user->socid)
{
$linkstart='';
$linkend='';
@@ -2260,8 +2271,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)
{
@@ -2285,15 +2296,15 @@ class Societe extends CommonObject
$statusType = 'status4';
if ($status == 0) $statusType = 'status5';
- if (empty($this->labelstatus) || empty($this->labelstatusshort))
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
- $this->labelstatus[0] = $langs->trans("ActivityCeased");
- $this->labelstatus[1] = $langs->trans("InActivity");
- $this->labelstatusshort[0] = $langs->trans("ActivityCeased");
- $this->labelstatusshort[1] = $langs->trans("InActivity");
+ $this->labelStatus[0] = $langs->trans("ActivityCeased");
+ $this->labelStatus[1] = $langs->trans("InActivity");
+ $this->labelStatusShort[0] = $langs->trans("ActivityCeased");
+ $this->labelStatusShort[1] = $langs->trans("InActivity");
}
- return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php
index bf94c522f68..f93dfd0ea68 100644
--- a/htdocs/societe/class/societeaccount.class.php
+++ b/htdocs/societe/class/societeaccount.class.php
@@ -124,7 +124,13 @@ class SocieteAccount extends CommonObject
public $date_last_login;
public $date_previous_login;
public $note_private;
+
+ /**
+ * @var integer|string date_creation
+ */
public $date_creation;
+
+
public $tms;
/**
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index 85df9b4f069..0039504e950 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $socid, '&societe');
$object = new Societe($db);
if ($socid > 0) $object->fetch($socid);
@@ -109,7 +109,7 @@ dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"), -1, 'company')
$linkback = '
'.$langs->trans("BackToList").' ';
-dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php
index 1b119e9c89a..352c9c53c35 100644
--- a/htdocs/societe/contact.php
+++ b/htdocs/societe/contact.php
@@ -56,7 +56,7 @@ $cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$confirm = GETPOST('confirm');
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
if (empty($socid) && $action == 'view') $action='create';
$object = new Societe($db);
@@ -150,7 +150,7 @@ dol_fiche_head($head, 'contact', $langs->trans("ThirdParty"), 0, 'company');
$linkback = '
'.$langs->trans("BackToList").' ';
-dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
+dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_fiche_end();
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index 971944c4f30..8e0c36aa451 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -40,10 +40,10 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
unset($action);
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result = restrictedArea($user, 'societe', $id, '&societe');
@@ -117,7 +117,7 @@ if ($object->id)
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php
index 5bd493fdeba..5aadc5d3606 100644
--- a/htdocs/societe/index.php
+++ b/htdocs/societe/index.php
@@ -38,10 +38,10 @@ $hookmanager->initHooks(array('thirdpartiesindex'));
$langs->load("companies");
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
// Security check
-$result=restrictedArea($user, 'societe', 0, '', '', '', '');
+$result = restrictedArea($user, 'societe', 0, '', '', '', '');
$thirdparty_static = new Societe($db);
@@ -51,10 +51,10 @@ $thirdparty_static = new Societe($db);
*/
$transAreaType = $langs->trans("ThirdPartiesArea");
-$helpurl='EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Terceros';
+$helpurl = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Terceros';
llxHeader("", $langs->trans("ThirdParties"), $helpurl);
-$linkback='';
+$linkback = '';
print load_fiche_titre($transAreaType, $linkback, 'companies');
@@ -73,26 +73,26 @@ $third = array(
'supplier' => 0,
'other' =>0
);
-$total=0;
+$total = 0;
$sql = "SELECT s.rowid, s.client, s.fournisseur";
-$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
-if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-$sql.= ' WHERE s.entity IN ('.getEntity('societe').')';
-if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-if ($socid) $sql.= " AND s.rowid = ".$socid;
-if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
+$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
+if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
+if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+if ($socid) $sql .= " AND s.rowid = ".$socid;
+if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
//print $sql;
$result = $db->query($sql);
if ($result)
{
while ($objp = $db->fetch_object($result))
{
- $found=0;
- if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; }
- if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; }
- if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; }
- if (! empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found=1; $third['other']++; }
+ $found = 0;
+ if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found = 1; $third['prospect']++; }
+ if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found = 1; $third['customer']++; }
+ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found = 1; $third['supplier']++; }
+ if (!empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found = 1; $third['other']++; }
if ($found) $total++;
}
}
@@ -101,14 +101,14 @@ else dol_print_error($db);
print '
';
print '
'."\n";
print ''.$langs->trans("Statistics").' ';
-if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2))
+if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + (round($third['customer']) ? 1 : 0) + (round($third['supplier']) ? 1 : 0) + (round($third['other']) ? 1 : 0) >= 2))
{
print '';
- $dataseries=array();
- if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array($langs->trans("Prospects"), round($third['prospect']));
- if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array($langs->trans("Customers"), round($third['customer']));
- if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array($langs->trans("Suppliers"), round($third['supplier']));
- if (! empty($conf->societe->enabled)) $dataseries[]=array($langs->trans("Others"), round($third['other']));
+ $dataseries = array();
+ if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[] = array($langs->trans("Prospects"), round($third['prospect']));
+ if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[] = array($langs->trans("Customers"), round($third['customer']));
+ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[] = array($langs->trans("Suppliers"), round($third['supplier']));
+ if (!empty($conf->societe->enabled)) $dataseries[] = array($langs->trans("Others"), round($third['other']));
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
@@ -122,23 +122,23 @@ if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(rou
}
else
{
- if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS))
+ if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS))
{
$statstring = " ";
- $statstring.= ''.$langs->trans("Prospects").' '.round($third['prospect']).' ';
- $statstring.= " ";
+ $statstring .= ''.$langs->trans("Prospects").' '.round($third['prospect']).' ';
+ $statstring .= "";
}
- if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS))
+ if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS))
{
- $statstring.= "";
- $statstring.= ''.$langs->trans("Customers").' '.round($third['customer']).' ';
- $statstring.= " ";
+ $statstring .= "";
+ $statstring .= ''.$langs->trans("Customers").' '.round($third['customer']).' ';
+ $statstring .= " ";
}
- if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire)
+ if (!empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire)
{
$statstring2 = "";
- $statstring2.= ''.$langs->trans("Suppliers").' '.round($third['supplier']).' ';
- $statstring2.= " ";
+ $statstring2 .= ''.$langs->trans("Suppliers").' '.round($third['supplier']).' ';
+ $statstring2 .= "";
}
print $statstring;
print $statstring2;
@@ -149,7 +149,7 @@ print '';
print '
';
print '
';
-if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES))
+if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES))
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$elementtype = 'societe';
@@ -161,41 +161,41 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS
print '
'.$langs->trans("Categories").' ';
print '
';
$sql = "SELECT c.label, count(*) as nb";
- $sql.= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
- $sql.= " WHERE c.type = 2";
- if (! is_numeric($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) $sql.= " AND c.label like '".$db->escape($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)."'";
- $sql.= " AND c.entity IN (".getEntity('category').")";
- $sql.= " GROUP BY c.label";
- $total=0;
+ $sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
+ $sql .= " WHERE c.type = 2";
+ if (!is_numeric($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) $sql .= " AND c.label like '".$db->escape($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)."'";
+ $sql .= " AND c.entity IN (".getEntity('category').")";
+ $sql .= " GROUP BY c.label";
+ $total = 0;
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
- $i=0;
- if (! empty($conf->use_javascript_ajax) )
+ $i = 0;
+ if (!empty($conf->use_javascript_ajax))
{
- $dataseries=array();
- $rest=0;
- $nbmax=10;
+ $dataseries = array();
+ $rest = 0;
+ $nbmax = 10;
while ($i < $num)
{
$obj = $db->fetch_object($result);
if ($i < $nbmax)
{
- $dataseries[]=array($obj->label, round($obj->nb));
+ $dataseries[] = array($obj->label, round($obj->nb));
}
else
{
- $rest+=$obj->nb;
+ $rest += $obj->nb;
}
- $total+=$obj->nb;
+ $total += $obj->nb;
$i++;
}
if ($i > $nbmax)
{
- $dataseries[]=array($langs->trans("Other"), round($rest));
+ $dataseries[] = array($langs->trans("Other"), round($rest));
}
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
@@ -214,7 +214,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS
$obj = $db->fetch_object($result);
print ' '.$obj->label.' '.$obj->nb.' ';
- $total+=$obj->nb;
+ $total += $obj->nb;
$i++;
}
}
@@ -232,22 +232,22 @@ print '
';
/*
- * Last third parties modified
+ * Latest modified third parties
*/
-$max=15;
+$max = 15;
$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
-$sql.= ", s.code_client";
-$sql.= ", s.code_fournisseur";
-$sql.= ", s.logo";
-$sql.= ", s.canvas, s.tms as datem, s.status as status";
-$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
-if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-$sql.= ' WHERE s.entity IN ('.getEntity('societe').')';
-if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-if ($socid) $sql.= " AND s.rowid = ".$socid;
-if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur != 1 OR s.client != 0)";
-$sql.= $db->order("s.tms", "DESC");
-$sql.= $db->plimit($max, 0);
+$sql .= ", s.code_client";
+$sql .= ", s.code_fournisseur";
+$sql .= ", s.logo";
+$sql .= ", s.canvas, s.tms as datem, s.status as status";
+$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
+if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
+if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+if ($socid) $sql .= " AND s.rowid = ".$socid;
+if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
+$sql .= $db->order("s.tms", "DESC");
+$sql .= $db->plimit($max, 0);
//print $sql;
$result = $db->query($sql);
@@ -274,16 +274,16 @@ if ($result)
{
$objp = $db->fetch_object($result);
- $thirdparty_static->id=$objp->rowid;
- $thirdparty_static->name=$objp->name;
- $thirdparty_static->client=$objp->client;
- $thirdparty_static->fournisseur=$objp->fournisseur;
+ $thirdparty_static->id = $objp->rowid;
+ $thirdparty_static->name = $objp->name;
+ $thirdparty_static->client = $objp->client;
+ $thirdparty_static->fournisseur = $objp->fournisseur;
$thirdparty_static->logo = $objp->logo;
- $thirdparty_static->datem=$db->jdate($objp->datem);
- $thirdparty_static->status=$objp->status;
+ $thirdparty_static->datem = $db->jdate($objp->datem);
+ $thirdparty_static->status = $objp->status;
$thirdparty_static->code_client = $objp->code_client;
$thirdparty_static->code_fournisseur = $objp->code_fournisseur;
- $thirdparty_static->canvas=$objp->canvas;
+ $thirdparty_static->canvas = $objp->canvas;
$thirdparty_static->email = $objp->email;
print '
';
@@ -293,21 +293,21 @@ if ($result)
print "\n";
// Type
print '';
- if ($thirdparty_static->client==1 || $thirdparty_static->client==3)
+ if ($thirdparty_static->client == 1 || $thirdparty_static->client == 3)
{
- $thirdparty_static->name=$langs->trans("Customer");
+ $thirdparty_static->name = $langs->trans("Customer");
print $thirdparty_static->getNomUrl(0, 'customer', 0, 1);
}
if ($thirdparty_static->client == 3 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print " / ";
- if (($thirdparty_static->client==2 || $thirdparty_static->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
+ if (($thirdparty_static->client == 2 || $thirdparty_static->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
- $thirdparty_static->name=$langs->trans("Prospect");
+ $thirdparty_static->name = $langs->trans("Prospect");
print $thirdparty_static->getNomUrl(0, 'prospect', 0, 1);
}
- if (! empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur)
+ if (!empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur)
{
if ($thirdparty_static->client) print " / ";
- $thirdparty_static->name=$langs->trans("Supplier");
+ $thirdparty_static->name = $langs->trans("Supplier");
print $thirdparty_static->getNomUrl(0, 'supplier', 0, 1);
}
print ' ';
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index ad793fcf63e..8f0d1895c1b 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -55,7 +55,7 @@ if ($contextpage == 'poslist')
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $socid, '');
$search_all=trim(GETPOST('search_all', 'alphanohtml')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php
index 4d20f050518..0f2bc4d8002 100644
--- a/htdocs/societe/note.php
+++ b/htdocs/societe/note.php
@@ -35,7 +35,7 @@ $langs->load("companies");
// Security check
$id = GETPOST('id')?GETPOST('id', 'int'):GETPOST('socid', 'int');
-if ($user->societe_id) $id=$user->societe_id;
+if ($user->socid) $id=$user->socid;
$result = restrictedArea($user, 'societe', $id, '&societe');
$object = new Societe($db);
@@ -78,7 +78,7 @@ if ($object->id > 0)
$linkback = ''.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
$cssclass='titlefield';
//if ($action == 'editnote_public') $cssclass='titlefieldcreate';
diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php
index 54536fa7502..d3f4c30f575 100644
--- a/htdocs/societe/notify/card.php
+++ b/htdocs/societe/notify/card.php
@@ -39,7 +39,7 @@ $actionid = GETPOST('actionid');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', '', '');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
@@ -156,7 +156,7 @@ if ($result > 0)
$linkback = ''.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '';
diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index df803b180ab..5ed2b9a148f 100644
--- a/htdocs/societe/paymentmodes.php
+++ b/htdocs/societe/paymentmodes.php
@@ -44,7 +44,7 @@ $langs->loadLangs(array("companies","commercial","banks","bills",'paypal','strip
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', '', '');
$id=GETPOST("id", "int");
@@ -804,7 +804,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
@@ -1615,7 +1615,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
@@ -1721,7 +1721,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer)
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
@@ -1769,7 +1769,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
@@ -1869,7 +1869,7 @@ if ($socid && $action == 'createcard' && $user->rights->societe->creer)
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php
index 967f91ca39d..d3c4c75fca5 100644
--- a/htdocs/societe/price.php
+++ b/htdocs/societe/price.php
@@ -46,8 +46,8 @@ $cancel = GETPOST('cancel', 'alpha');
// Security check
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
-if ($user->societe_id)
- $socid = $user->societe_id;
+if ($user->socid)
+ $socid = $user->socid;
$result = restrictedArea($user, 'societe', $socid, '&societe');
$object = new Societe($db);
@@ -187,7 +187,7 @@ dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), -1, 'company');
$linkback = '
'.$langs->trans("BackToList").' ';
-dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php
index 8f825bfc18c..1ff2c24956e 100644
--- a/htdocs/societe/project.php
+++ b/htdocs/societe/project.php
@@ -35,7 +35,7 @@ $langs->loadLangs(array("companies", "projects"));
// Security check
$socid = GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $socid, '&societe');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -82,7 +82,7 @@ if ($socid)
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php
index db18a1bf6af..0894935b962 100644
--- a/htdocs/societe/societecontact.php
+++ b/htdocs/societe/societecontact.php
@@ -51,7 +51,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $id, '');
$object = new Societe($db);
@@ -166,7 +166,7 @@ if ($id > 0 || ! empty($ref))
$linkback = '
'.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '
';
@@ -301,6 +301,8 @@ if ($id > 0 || ! empty($ref))
// Type
$membertypestatic->id=$objp->type_id;
$membertypestatic->libelle=$objp->type;
+ $membertypestatic->label=$objp->type;
+
print '
';
print $membertypestatic->getNomUrl(1, 32);
print ' ';
diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php
index 0e0c5ac2cc8..5e199722961 100644
--- a/htdocs/societe/website.php
+++ b/htdocs/societe/website.php
@@ -47,7 +47,7 @@ $search_status=GETPOST('search_status');
// Security check
$id = GETPOST('id', 'int')?GETPOST('id', 'int'):GETPOST('socid', 'int');
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $socid, '&societe');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
@@ -195,7 +195,7 @@ dol_fiche_head($head, 'website', $langs->trans("ThirdParty"), - 1, 'company');
$linkback = '
' . $langs->trans("BackToList") . ' ';
-dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom');
+dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
print '
';
@@ -428,14 +428,6 @@ print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '',
print '
'."\n";
-// Detect if we need a fetch on each output line
-$needToFetchEachLine=0;
-foreach ($extrafields->attribute_computed as $key => $val)
-{
- if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
-}
-
-
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php
index a9e417aa581..f398a013fb6 100644
--- a/htdocs/stripe/charge.php
+++ b/htdocs/stripe/charge.php
@@ -33,7 +33,7 @@ $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe'));
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
//$result = restrictedArea($user, 'salaries', '', '', '');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
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..0226c724165 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;
@@ -46,13 +46,13 @@ $stripearrayofkeysbyenv = array(
$stripearrayofkeys = array();
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))
{
- $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
+ $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
}
else
{
- $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
+ $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
}
\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/stripe/payment.php b/htdocs/stripe/payment.php
index 2614c8498f3..e0ed986bfd6 100644
--- a/htdocs/stripe/payment.php
+++ b/htdocs/stripe/payment.php
@@ -65,9 +65,9 @@ $multicurrency_amountsresttopay=array();
// Security check
$socid=0;
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$object=new Facture($db);
diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php
index 70988b339b5..e2f19c560be 100644
--- a/htdocs/stripe/payout.php
+++ b/htdocs/stripe/payout.php
@@ -33,7 +33,7 @@ $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe'));
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
//$result = restrictedArea($user, 'salaries', '', '', '');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php
index 6dc0a1e0815..3bc1050f867 100644
--- a/htdocs/stripe/transaction.php
+++ b/htdocs/stripe/transaction.php
@@ -33,7 +33,7 @@ $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe'));
// Security check
$socid = GETPOST("socid", "int");
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
//$result = restrictedArea($user, 'salaries', '', '', '');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index b953087b885..340a959d1a2 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -74,7 +74,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co
$NBLINES = 4;
// Security check
-if (! empty($user->societe_id)) $socid = $user->societe_id;
+if (! empty($user->socid)) $socid = $user->socid;
$result = restrictedArea($user, 'supplier_proposal', $id);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -1572,7 +1572,7 @@ if ($action == 'create')
print '
';
print '
';
@@ -1592,7 +1592,7 @@ if ($action == 'create')
print '';
print ' ';
@@ -1604,29 +1604,32 @@ if ($action == 'create')
print ' ';
// Multicurrency rate
- print '
';
- print '';
- print '';
- print ' ';
- if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
- if ($action == 'actualizemulticurrencyrate') {
- list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
- }
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
- } else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- if ($object->statut == SupplierProposal::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '';
+ if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
+ {
+ print ' ';
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
+ if ($action == 'actualizemulticurrencyrate') {
+ list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
+ }
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ print '';
+ }
}
+ print ' ';
}
- print '';
}
/* Not for supplier proposals
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index be272ee2d36..dede1c9eec9 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -66,6 +66,9 @@ class SupplierProposal extends CommonObject
*/
public $fk_element='fk_supplier_proposal';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
public $picto='propal';
/**
@@ -158,8 +161,8 @@ class SupplierProposal extends CommonObject
public $lines = array();
public $line;
- public $labelstatut=array();
- public $labelstatut_short=array();
+ public $labelStatus=array();
+ public $labelStatusShort=array();
public $nbtodo;
public $nbtodolate;
@@ -1364,9 +1367,9 @@ class SupplierProposal extends CommonObject
$line->fk_product = $objp->fk_product;
- $line->ref = $objp->product_ref; // TODO deprecated
+ $line->ref = $objp->product_ref; // deprecated
$line->product_ref = $objp->product_ref;
- $line->libelle = $objp->product_label; // TODO deprecated
+ $line->libelle = $objp->product_label; // deprecated
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; // Description produit
$line->fk_product_type = $objp->fk_product_type;
@@ -1698,22 +1701,22 @@ class SupplierProposal extends CommonObject
* Close the askprice
*
* @param User $user Object user that close
- * @param int $statut Statut
+ * @param int $status Status
* @param string $note Comment
* @return int <0 if KO, >0 if OK
*/
- public function cloture($user, $statut, $note)
+ public function cloture($user, $status, $note)
{
global $langs,$conf;
- $this->statut = $statut;
+ $this->statut = $status;
$error=0;
$now=dol_now();
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal";
- $sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
+ $sql.= " SET fk_statut = ".$status.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$resql=$this->db->query($sql);
@@ -1722,7 +1725,7 @@ class SupplierProposal extends CommonObject
$modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
$trigger_name='SUPPLIER_PROPOSAL_CLOSE_REFUSED';
- if ($statut == 2)
+ if ($status == 2)
{
$trigger_name='SUPPLIER_PROPOSAL_CLOSE_SIGNED';
$modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
@@ -1732,7 +1735,7 @@ class SupplierProposal extends CommonObject
$result = $this->updateOrCreatePriceFournisseur($user);
}
}
- if ($statut == 4)
+ if ($status == 4)
{
$trigger_name='SUPPLIER_PROPOSAL_CLASSIFY_BILLED';
}
@@ -2196,20 +2199,20 @@ class SupplierProposal extends CommonObject
// phpcs:enable
// Init/load array of translation of status
- if (empty($this->labelstatut) || empty($this->labelstatut_short))
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
$langs->load("supplier_proposal");
- $this->labelstatut[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraft");
- $this->labelstatut[self::STATUS_VALIDATED]=$langs->trans("SupplierProposalStatusValidated");
- $this->labelstatut[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSigned");
- $this->labelstatut[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSigned");
- $this->labelstatut[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosed");
- $this->labelstatut_short[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraftShort");
- $this->labelstatut_short[self::STATUS_VALIDATED]=$langs->trans("Opened");
- $this->labelstatut_short[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSignedShort");
- $this->labelstatut_short[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSignedShort");
- $this->labelstatut_short[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosedShort");
+ $this->labelStatus[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraft");
+ $this->labelStatus[self::STATUS_VALIDATED]=$langs->trans("SupplierProposalStatusValidated");
+ $this->labelStatus[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSigned");
+ $this->labelStatus[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSigned");
+ $this->labelStatus[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosed");
+ $this->labelStatusShort[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraftShort");
+ $this->labelStatusShort[self::STATUS_VALIDATED]=$langs->trans("Opened");
+ $this->labelStatusShort[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSignedShort");
+ $this->labelStatusShort[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSignedShort");
+ $this->labelStatusShort[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosedShort");
}
$statusnew='';
@@ -2219,7 +2222,7 @@ class SupplierProposal extends CommonObject
elseif ($status==self::STATUS_NOTSIGNED) $statusnew='status5';
elseif ($status==self::STATUS_CLOSE) $statusnew='status6';
- return dolGetStatus($this->labelstatut[$status], $this->labelstatut_short[$status], '', $statusnew, $mode);
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusnew, $mode);
}
@@ -2258,15 +2261,16 @@ class SupplierProposal extends CommonObject
if ($resql)
{
$label = $labelShort = '';
+ $status = '';
if ($mode == 'opened') {
$delay_warning=$conf->supplier_proposal->cloture->warning_delay;
- $statut = self::STATUS_VALIDATED;
+ $status = self::STATUS_VALIDATED;
$label = $langs->trans("SupplierProposalsToClose");
$labelShort = $langs->trans("ToAcceptRefuse");
}
if ($mode == 'signed') {
$delay_warning=$conf->supplier_proposal->facturation->warning_delay;
- $statut = self::STATUS_SIGNED;
+ $status = self::STATUS_SIGNED;
$label = $langs->trans("SupplierProposalsToProcess"); // May be billed or ordered
$labelShort = $langs->trans("ToClose");
}
@@ -2275,7 +2279,7 @@ class SupplierProposal extends CommonObject
$response->warning_delay = $delay_warning/60/60/24;
$response->label = $label;
$response->labelShort = $labelShort;
- $response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$statut;
+ $response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$status;
$response->img = img_object('', "propal");
// This assignment in condition is not a bug. It allows walking the results.
diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php
index d60fb3c04bc..84b007c53fc 100644
--- a/htdocs/supplier_proposal/contact.php
+++ b/htdocs/supplier_proposal/contact.php
@@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'supplier_proposal', $id, 'supplier_proposal', '');
$object = new SupplierProposal($db);
diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php
index 991059b9141..da76e9ea897 100644
--- a/htdocs/supplier_proposal/document.php
+++ b/htdocs/supplier_proposal/document.php
@@ -45,9 +45,9 @@ $ref = GETPOST('ref', 'alpha');
// Security check
$socid='';
-if (! empty($user->societe_id))
+if (! empty($user->socid))
{
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result = restrictedArea($user, 'supplier_proposal', $id);
diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php
index dd2acd27311..55bde878918 100644
--- a/htdocs/supplier_proposal/index.php
+++ b/htdocs/supplier_proposal/index.php
@@ -38,10 +38,10 @@ $langs->loadLangs(array('supplier_proposal', 'companies'));
// Security check
$socid=GETPOST('socid', 'int');
-if (isset($user->societe_id) && $user->societe_id > 0)
+if (isset($user->socid) && $user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$result = restrictedArea($user, 'supplier_proposal');
@@ -90,7 +90,7 @@ $sql.= ", ".MAIN_DB_PREFIX."supplier_proposal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.fk_soc = s.rowid";
$sql.= " AND p.entity IN (".getEntity('supplier_proposal').")";
-if ($user->societe_id) $sql.=' AND p.fk_soc = '.$user->societe_id;
+if ($user->socid) $sql.=' AND p.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " AND p.fk_statut IN (0,1,2,3,4)";
$sql.= " GROUP BY p.fk_statut";
diff --git a/htdocs/supplier_proposal/info.php b/htdocs/supplier_proposal/info.php
index ec269354af6..7b259b166e4 100644
--- a/htdocs/supplier_proposal/info.php
+++ b/htdocs/supplier_proposal/info.php
@@ -39,7 +39,7 @@ $id=GETPOST('id', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
$result = restrictedArea($user, 'supplier_proposal', $id);
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index 687d98911f2..c48f3756611 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -103,7 +103,7 @@ $NBLINES=4;
$module='supplier_proposal';
$dbtable='';
$objectid='';
-if (! empty($user->societe_id)) $socid=$user->societe_id;
+if (! empty($user->socid)) $socid=$user->socid;
if (! empty($socid))
{
$objectid=$socid;
diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php
index 447dc057979..0e12da2c104 100644
--- a/htdocs/supplier_proposal/note.php
+++ b/htdocs/supplier_proposal/note.php
@@ -40,7 +40,7 @@ $ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
-if ($user->societe_id) $socid=$user->societe_id;
+if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'supplier_proposal', $id, 'supplier_proposal');
$object = new SupplierProposal($db);
diff --git a/htdocs/takepos/ChangeLog.md b/htdocs/takepos/ChangeLog.md
deleted file mode 100644
index 7b623eaa252..00000000000
--- a/htdocs/takepos/ChangeLog.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# CHANGELOG TAKEPOS FOR
DOLIBARR ERP CRM
-
-## 1.0
-Initial version
-
diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php
index b009d01659b..167735e901d 100644
--- a/htdocs/takepos/admin/terminal.php
+++ b/htdocs/takepos/admin/terminal.php
@@ -45,14 +45,14 @@ $langs->loadLangs(array("admin", "cashdesk"));
global $db;
-$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
+$sql = "SELECT code, libelle as label FROM ".MAIN_DB_PREFIX."c_paiement";
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
$sql.= " AND active = 1";
$sql.= " ORDER BY libelle";
$resql = $db->query($sql);
$paiements = array();
-if($resql){
- while ($obj = $db->fetch_object($resql)){
+if ($resql) {
+ while ($obj = $db->fetch_object($resql)) {
array_push($paiements, $obj);
}
}
@@ -152,7 +152,7 @@ if (! empty($conf->banque->enabled))
foreach($paiements as $modep) {
if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; // Already managed before
$name="CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse;
- print '
'.$langs->trans("CashDeskBankAccountFor").' '.$langs->trans($modep->libelle).' ';
+ print ''.$langs->trans("CashDeskBankAccountFor").' '.$langs->trans($modep->label).' ';
print '';
if (! empty($conf->global->$name)) $atleastonefound++;
$cour=preg_match('/^LIQ.*/', $modep->code)?2:1;
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 2fcb9e0a6d8..126fea907a9 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -260,6 +260,9 @@ if ($action == "addline")
$prod = new Product($db);
$prod->fetch($idproduct);
+ $customer = new Societe($db);
+ $customer->fetch($invoice->socid);
+
$price = $prod->price;
$tva_tx = $prod->tva_tx;
$price_ttc = $prod->price_ttc;
@@ -267,16 +270,13 @@ if ($action == "addline")
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
- $customer = new Societe($db);
- $customer->fetch($invoice->socid);
-
$price = $prod->multiprices[$customer->price_level];
$tva_tx = $prod->multiprices_tva_tx[$customer->price_level];
$price_ttc = $prod->multiprices_ttc[$customer->price_level];
$price_base_type = $prod->multiprices_base_type[$customer->price_level];
}
- $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $prod->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0);
+ $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0);
$invoice->fetch($placeid);
}
diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php
index dd65469ec05..001fd842165 100644
--- a/htdocs/takepos/takepos.php
+++ b/htdocs/takepos/takepos.php
@@ -562,23 +562,23 @@ function MoreActions(totalactions){
}
}
+// Popup to select the terminal to use
function TerminalsDialog()
{
jQuery("#dialog-info").dialog({
resizable: false,
- height:220,
- width:400,
+ height: global->TAKEPOS_NUM_TERMINALS / 3 * 20); ?>,
+ width: dol_optimize_smallscreen ? 316 : 400); ?>,
modal: true,
buttons: {
- Terminal1: function() {
+ 'trans("Terminal")) ?> 1': function() {
location.href='takepos.php?setterminal=1';
}
global->TAKEPOS_NUM_TERMINALS; $i++)
{
- print "
- ,
- Terminal".$i.": function() {
+ print ",
+ '".dol_escape_js($langs->trans("Terminal"))." ".$i."': function() {
location.href='takepos.php?setterminal=".$i."';
}
";
diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php
index 975f2eb311f..27fc142d991 100644
--- a/htdocs/theme/eldy/badges.inc.php
+++ b/htdocs/theme/eldy/badges.inc.php
@@ -37,7 +37,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
padding: 0;
border-radius: 50%;
padding: 0.45em;
- vertical-align: middle;
+ vertical-align: text-top;
}
a.badge:focus, a.badge:hover {
diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php
index 51fbfd6a561..59c015b6245 100644
--- a/htdocs/theme/eldy/btn.inc.php
+++ b/htdocs/theme/eldy/btn.inc.php
@@ -260,4 +260,23 @@ div.pagination li:first-child a.btnTitle{
.butActionRefused, .butActionNewRefused, .btnTitle.refused {
display: none !important;
}
-
+
+
+/*
+ * BTN LINK
+ */
+
+.btn-link{
+ margin-right: 5px;
+ border: 1px solid #ddd;
+ color: #333;
+ padding: 5px 10px;
+ border-radius:1em;
+ text-decoration: none !important;
+}
+
+.btn-link:hover{
+ background-color: #ddd;
+ border: 1px solid #ddd;
+}
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 28029def9ff..6db99927fb1 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -473,6 +473,12 @@ textarea.centpercent {
.paddingright2 {
padding-: 2px;
}
+.marginleft2 {
+ margin-: 2px;
+}
+.marginright2 {
+ margin-: 2px;
+}
.cursordefault {
cursor: default;
}
@@ -488,6 +494,9 @@ textarea.centpercent {
.backgroundblank {
background-color: #fff;
}
+.nobackground, .nobackground tr {
+ background: unset !important;
+}
.checkboxattachfilelabel {
font-size: 0.85em;
opacity: 0.7;
@@ -517,6 +526,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,
+.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
/* Themes for badges */
@@ -2529,6 +2541,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 +2768,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 */
@@ -4399,6 +4415,14 @@ pre#editfilecontentaceeditorid {
#comment .comment-delete:hover {
background:rgba(250,20,20,0.8);
}
+#comment .comment-edit {
+ width: 100px;
+ text-align:center;
+ vertical-align:middle;
+}
+#comment .comment-edit:hover {
+ background:rgba(0,184,148,0.8);
+}
#comment textarea {
width: 100%;
}
diff --git a/htdocs/theme/eldy/progress.inc.php b/htdocs/theme/eldy/progress.inc.php
index 3e330745440..a211c40efb4 100644
--- a/htdocs/theme/eldy/progress.inc.php
+++ b/htdocs/theme/eldy/progress.inc.php
@@ -21,10 +21,10 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
height: 20px;
overflow: hidden;
background-color: #f5f5f5;
- background-color: rgba(0,0,0,0.1);
+ background-color: rgba(128, 128, 128, 0.1);
border-radius: 4px;
- -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
- box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
+ -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
.progress.spaced{
@@ -167,7 +167,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
}
.progress-bar-yellow,
.progress-bar-warning {
- background-color: #f39c12;
+ background-color: #bc9526;
}
.progress-striped .progress-bar-yellow,
.progress-striped .progress-bar-warning {
@@ -184,4 +184,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
+}
+.progress-bar-consumed {
+ background-color: rgb(0, 0, 0, 0.15);
}
\ No newline at end of file
diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php
index 386a81f0afd..24e7e6f7d41 100644
--- a/htdocs/theme/eldy/theme_vars.inc.php
+++ b/htdocs/theme/eldy/theme_vars.inc.php
@@ -81,7 +81,7 @@ $toolTipFontColor='#333';
$textSuccess ='#28a745';
$colorblind_deuteranopes_textSuccess ='#37de5d';
$textDanger ='#dc3545';
-$textWarning ='#f39c12';
+$textWarning ='#bc9526';
$colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color
diff --git a/htdocs/theme/eldy/timeline.inc.php b/htdocs/theme/eldy/timeline.inc.php
index 2cb3461d713..76ca244e572 100644
--- a/htdocs/theme/eldy/timeline.inc.php
+++ b/htdocs/theme/eldy/timeline.inc.php
@@ -125,7 +125,12 @@ a.timeline-btn:hover
font-weight: normal;
line-height: 1.1;
}
-.timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-header {
+
+.timeline > li > .timeline-item > .timeline-footer {
+ border-top: 1px solid #f4f4f4;
+}
+
+.timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-header, .timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-footer {
border-color: #ecebda;
}
@@ -195,3 +200,12 @@ a.timeline-btn:hover
background-color: #0073b7 !important;
color: #fff !important;
}
+
+.timeline-documents-container{
+
+}
+
+.timeline-documents{
+ margin-right: 5px;
+}
+
diff --git a/htdocs/theme/md/badges.inc.php b/htdocs/theme/md/badges.inc.php
index 2a1b9ffd24b..11536240ee0 100644
--- a/htdocs/theme/md/badges.inc.php
+++ b/htdocs/theme/md/badges.inc.php
@@ -36,8 +36,8 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
.badge-dot {
padding: 0;
border-radius: 50%;
- padding: 0.25rem;
- vertical-align: middle;
+ padding: 0.35em;
+ vertical-align: unset;
}
a.badge:focus, a.badge:hover {
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 04ae5d298c4..04fe7e85d77 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -676,6 +676,12 @@ textarea.centpercent {
.paddingright2 {
padding-: 2px;
}
+.marginleft2 {
+ margin-: 2px;
+}
+.marginright2 {
+ margin-: 2px;
+}
.cursordefault {
cursor: default;
}
@@ -691,6 +697,9 @@ textarea.centpercent {
.backgroundblank {
background-color: #fff;
}
+.nobackground, .nobackground tr {
+ background: unset !important;
+}
.checkboxattachfilelabel {
font-size: 0.85em;
opacity: 0.7;
@@ -720,6 +729,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 +2632,6 @@ span.tabspan {
margin-top: px;
}
-
.paddingrightonly {
border-collapse: collapse;
border: 0px;
@@ -2633,6 +2644,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 +2852,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/agenda.php b/htdocs/ticket/agenda.php
index dee2168136c..6db51996d12 100644
--- a/htdocs/ticket/agenda.php
+++ b/htdocs/ticket/agenda.php
@@ -78,19 +78,19 @@ if (!$action) {
// Security check
$id = GETPOST("id", 'int');
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result=restrictedArea($user, 'ticket', $id, '');
if (!$user->rights->ticket->read) {
accessforbidden();
}
// restrict access for externals users
-if ($user->societe_id > 0 && ($object->fk_soc != $user->societe_id))
+if ($user->socid > 0 && ($object->fk_soc != $user->socid))
{
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden();
}
@@ -138,15 +138,15 @@ if ($socid > 0) {
dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
+ dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
dol_fiche_end();
}
-if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
$object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'";
-} elseif ($user->societe_id > 0) {
- $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
+} elseif ($user->socid > 0) {
+ $object->next_prev_filter = "te.fk_soc = '" . $user->socid . "'";
}
$head = ticket_prepare_head($object);
@@ -172,7 +172,7 @@ if (!empty($object->origin_email)) {
if (! empty($conf->societe->enabled))
{
$morehtmlref.=' '.$langs->trans('ThirdParty');
- /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) {
+ /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' ';
}*/
$morehtmlref.=' : ';
@@ -220,7 +220,7 @@ $morehtmlref.='';
$linkback = '' . $langs->trans("BackToList") . ' ';
-dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_fiche_end();
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index eec2c813d26..6aa6d42e590 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -95,8 +95,8 @@ if ($id || $track_id || $ref) {
$url_page_current = DOL_URL_ROOT.'/ticket/card.php';
// Security check - Protection if external user
-//if ($user->societe_id > 0) access_forbidden();
-//if ($user->societe_id > 0) $socid = $user->societe_id;
+//if ($user->socid > 0) access_forbidden();
+//if ($user->socid > 0) $socid = $user->socid;
$result = restrictedArea($user, 'ticket', $object->id);
$triggermodname = 'TICKET_MODIFY';
@@ -622,7 +622,7 @@ if ($action == 'create' || $action == 'presend')
print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket');
- $formticket->withfromsocid = $socid ? $socid : $user->societe_id;
+ $formticket->withfromsocid = $socid ? $socid : $user->socid;
$formticket->withfromcontactid = $contactid ? $contactid : '';
$formticket->withtitletopic = 1;
$formticket->withnotifytiersatcreate = ($notifyTiers?1:0);
@@ -645,7 +645,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
if ($res > 0)
{
// or for unauthorized internals users
- if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+ if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden('', 0, 1);
}
@@ -741,14 +741,14 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
$head = societe_prepare_head($object->thirdparty);
dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
+ dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
dol_fiche_end();
}
- if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+ if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
$object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'";
- } elseif ($user->societe_id > 0) {
- $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
+ } elseif ($user->socid > 0) {
+ $object->next_prev_filter = "te.fk_soc = '" . $user->socid . "'";
}
$head = ticket_prepare_head($object);
@@ -775,7 +775,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
if (! empty($conf->societe->enabled))
{
$morehtmlref.=' '.$langs->trans('ThirdParty') . ' ';
- if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) {
+ if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 0) . ' : ';
}
if ($action == 'editcustomer') {
@@ -821,7 +821,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
$linkback = '' . $langs->trans("BackToList") . ' ';
- dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref);
print '';
print '
';
@@ -845,9 +845,9 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
// Subject
print '
';
- print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->societe_id, 'string');
+ print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string');
print ' ';
- print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->societe_id, 'string');
+ print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string');
print ' ';
// Creation date
@@ -889,7 +889,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
}
// Show user list to assignate one if status is "read"
- if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) {
+ if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
print '
';
print ' ';
print ' ';
@@ -906,7 +906,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
print '';
print $langs->trans('Progression') . ' ';
print ' ';
- if ($action != 'progression' && $object->fk_statut < 8 && !$user->societe_id) {
+ if ($action != 'progression' && $object->fk_statut < 8 && !$user->socid) {
print '' . img_edit($langs->trans('Modify')) . ' ';
}
print '
';
@@ -1033,7 +1033,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
// Display navbar with links to change ticket status
print '';
- if (!$user->societe_id && $user->rights->ticket->write && $object->fk_status < 8 && GETPOST('set') !== 'properties') {
+ if (!$user->socid && $user->rights->ticket->write && $object->fk_status < 8 && GETPOST('set') !== 'properties') {
$actionobject->viewStatusActions($object);
}
@@ -1187,12 +1187,12 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
}
// Re-open ticket
- if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->societe_id) {
+ if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->socid) {
print '';
}
// Delete ticket
- if ($user->rights->ticket->delete && ! $user->societe_id) {
+ if ($user->rights->ticket->delete && ! $user->socid) {
print '';
}
}
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/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 0daba74be77..494d6b351b8 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -1169,123 +1169,123 @@ class Ticket extends CommonObject
/**
* Return status label of object
*
- * @param string $statut id statut
+ * @param string $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
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
if ($mode == 0) {
- return $langs->trans($this->statuts[$statut]);
+ return $langs->trans($this->statuts[$status]);
}
elseif ($mode == 1) {
- return $langs->trans($this->statuts_short[$statut]);
+ return $langs->trans($this->statuts_short[$status]);
}
elseif ($mode == 2) {
- if ($statut == self::STATUS_NOT_READ) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ if ($status == self::STATUS_NOT_READ) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_READ) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_READ) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_ASSIGNED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_ASSIGNED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_IN_PROGRESS) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_IN_PROGRESS) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_NEED_MORE_INFO) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_NEED_MORE_INFO) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_WAITING) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_WAITING) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_CLOSED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_CLOSED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_CANCELED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_CANCELED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
}
elseif ($mode == 3) {
- if ($statut == self::STATUS_NOT_READ) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket');
+ if ($status == self::STATUS_NOT_READ) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket');
}
- elseif ($statut == self::STATUS_READ) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket');
+ elseif ($status == self::STATUS_READ) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket');
}
- elseif ($statut == self::STATUS_ASSIGNED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket');
+ elseif ($status == self::STATUS_ASSIGNED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket');
}
- elseif ($statut == self::STATUS_IN_PROGRESS) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket');
+ elseif ($status == self::STATUS_IN_PROGRESS) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket');
}
- elseif ($statut == self::STATUS_NEED_MORE_INFO) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket');
+ elseif ($status == self::STATUS_NEED_MORE_INFO) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket');
}
- elseif ($statut == self::STATUS_WAITING) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket');
+ elseif ($status == self::STATUS_WAITING) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket');
}
- elseif ($statut == self::STATUS_CLOSED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket');
+ elseif ($status == self::STATUS_CLOSED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket');
}
- elseif ($statut == self::STATUS_CANCELED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket');
+ elseif ($status == self::STATUS_CANCELED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket');
}
}
elseif ($mode == 4) {
- if ($statut == self::STATUS_NOT_READ) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ if ($status == self::STATUS_NOT_READ) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_READ) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_READ) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_ASSIGNED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_ASSIGNED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_IN_PROGRESS) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_IN_PROGRESS) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_NEED_MORE_INFO) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_NEED_MORE_INFO) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_WAITING) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_WAITING) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_CLOSED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_CLOSED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
- elseif ($statut == self::STATUS_CANCELED) {
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ elseif ($status == self::STATUS_CANCELED) {
+ return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]);
}
}
elseif ($mode == 5 || $mode == 6) {
- if ($statut == self::STATUS_NOT_READ) {
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket');
+ if ($status == self::STATUS_NOT_READ) {
+ return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket');
}
- elseif ($statut == self::STATUS_READ) {
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket');
+ elseif ($status == self::STATUS_READ) {
+ return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket');
}
- elseif ($statut == self::STATUS_ASSIGNED) {
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket');
+ elseif ($status == self::STATUS_ASSIGNED) {
+ return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket');
}
- elseif ($statut == self::STATUS_IN_PROGRESS) {
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket');
+ elseif ($status == self::STATUS_IN_PROGRESS) {
+ return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket');
}
- elseif ($statut == self::STATUS_NEED_MORE_INFO) {
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket');
+ elseif ($status == self::STATUS_NEED_MORE_INFO) {
+ return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket');
}
- elseif ($statut == self::STATUS_WAITING) {
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket');
+ elseif ($status == self::STATUS_WAITING) {
+ return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket');
}
- elseif ($statut == self::STATUS_CLOSED) {
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket');
+ elseif ($status == self::STATUS_CLOSED) {
+ return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket');
}
- elseif ($statut == self::STATUS_CANCELED) {
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket');
+ elseif ($status == self::STATUS_CANCELED) {
+ return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket');
}
}
}
@@ -2228,13 +2228,13 @@ class Ticket extends CommonObject
* Get array of all contacts for a ticket
* Override method of file commonobject.class.php to add phone number
*
- * @param int $statut Status of lines to get (-1=all)
+ * @param int $status Status of lines to get (-1=all)
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param int $list 0:Return array contains all properties, 1:Return array contains just id
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
* @return array Array of contacts
*/
- public function listeContact($statut = -1, $source = 'external', $list = 0, $code = '')
+ public function listeContact($status = -1, $source = 'external', $list = 0, $code = '')
{
global $langs;
@@ -2258,7 +2258,7 @@ class Ticket extends CommonObject
$sql .= ", t.phone as phone, t.phone_mobile as phone_mobile, t.phone_perso as phone_perso";
}
- $sql .= ", tc.source, tc.element, tc.code, tc.libelle";
+ $sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_contact_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_type_contact tc";
$sql .= ", " . MAIN_DB_PREFIX . "element_contact ec";
if ($source == 'internal') {
@@ -2281,8 +2281,8 @@ class Ticket extends CommonObject
}
$sql .= " AND tc.active=1";
- if ($statut >= 0) {
- $sql .= " AND ec.statut = '" . $statut . "'";
+ if ($status >= 0) {
+ $sql .= " AND ec.statut = '" . $status . "'";
}
$sql .= " ORDER BY t.lastname ASC";
@@ -2296,7 +2296,7 @@ class Ticket extends CommonObject
if (!$list) {
$transkey = "TypeContact_" . $obj->element . "_" . $obj->source . "_" . $obj->code;
- $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle);
+ $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->type_contact_label);
$tab[$i] = array(
'source' => $obj->source,
'socid' => $obj->socid,
diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php
index 65682fef2b3..78e78b86f7d 100644
--- a/htdocs/ticket/contact.php
+++ b/htdocs/ticket/contact.php
@@ -51,8 +51,8 @@ $ligne = GETPOST('ligne', 'int');
$lineid = GETPOST('lineid', 'int');
// Protection if external user
-if ($user->societe_id > 0) {
- $socid = $user->societe_id;
+if ($user->socid > 0) {
+ $socid = $user->socid;
accessforbidden();
}
@@ -129,14 +129,14 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
$object->fetch_thirdparty();
$head = societe_prepare_head($object->thirdparty);
dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
+ dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
dol_fiche_end();
}
- if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+ if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
$object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'";
- } elseif ($user->societe_id > 0) {
- $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
+ } elseif ($user->socid > 0) {
+ $object->next_prev_filter = "te.fk_soc = '" . $user->socid . "'";
}
$head = ticket_prepare_head($object);
@@ -163,7 +163,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
if (! empty($conf->societe->enabled))
{
$morehtmlref.=' '.$langs->trans('ThirdParty');
- /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) {
+ /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' ';
}*/
$morehtmlref.=' : ';
@@ -211,7 +211,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
$linkback = '' . $langs->trans("BackToList") . ' ';
- dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, '');
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, '');
dol_fiche_end();
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/ticket/document.php b/htdocs/ticket/document.php
index a80d455e43f..5a6b2b131f1 100644
--- a/htdocs/ticket/document.php
+++ b/htdocs/ticket/document.php
@@ -94,14 +94,14 @@ if ($object->id)
$object->fetch_thirdparty();
$head = societe_prepare_head($object->thirdparty);
dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
+ dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
dol_fiche_end();
}
- if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+ if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
$object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'";
- } elseif ($user->societe_id > 0) {
- $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
+ } elseif ($user->socid > 0) {
+ $object->next_prev_filter = "te.fk_soc = '" . $user->socid . "'";
}
$head = ticket_prepare_head($object);
@@ -128,7 +128,7 @@ if ($object->id)
if (! empty($conf->societe->enabled))
{
$morehtmlref.=' '.$langs->trans('ThirdParty');
- /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) {
+ /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' ';
}*/
$morehtmlref.=' : ';
@@ -176,7 +176,7 @@ if ($object->id)
$linkback = '' . $langs->trans("BackToList") . ' ';
- dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_fiche_end();
diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php
index be29b1be25e..d749aa25f02 100644
--- a/htdocs/ticket/index.php
+++ b/htdocs/ticket/index.php
@@ -44,8 +44,8 @@ $msg_id = GETPOST('msg_id', 'int');
$action = GETPOST('action', 'aZ09');
-if ($user->societe_id) {
- $socid = $user->societe_id;
+if ($user->socid) {
+ $socid = $user->socid;
}
// Security check
@@ -141,8 +141,8 @@ if (!$user->rights->societe->client->voir && !$socid) {
}
// External users restriction
-if ($user->societe_id > 0) {
- $sql .= " AND t.fk_soc='" . $user->societe_id . "'";
+if ($user->socid > 0) {
+ $sql .= " AND t.fk_soc='" . $user->socid . "'";
} else {
// For internals users,
if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) {
@@ -288,8 +288,8 @@ if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
}
-if ($user->societe_id > 0) {
- $sql .= " AND t.fk_soc='" . $user->societe_id . "'";
+if ($user->socid > 0) {
+ $sql .= " AND t.fk_soc='" . $user->socid . "'";
} else {
// Restricted to assigned user only
if ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && !$user->rights->ticket->manage) {
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index bfaa8ad3876..7c6f525a0c4 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -246,7 +246,7 @@ foreach($search as $key => $val)
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project, 2);
-if (! $user->societe_id && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) {
+if (! $user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) {
$sql.= " AND (t.fk_user_assign = ".$user->id;
if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql.=" OR t.fk_user_create = ".$user->id;
$sql.=")";
@@ -319,7 +319,7 @@ if ($socid && ! $projectid && ! $project_ref && $user->rights->societe->lire) {
dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), -1, 'company');
- dol_banner_tab($socstat, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
+ dol_banner_tab($socstat, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
print '';
diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php
index 7b4341cf684..11bd501bd17 100644
--- a/htdocs/ticket/messaging.php
+++ b/htdocs/ticket/messaging.php
@@ -77,19 +77,19 @@ if (!$action) {
// Security check
$id = GETPOST("id", 'int');
$socid=0;
-//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result=restrictedArea($user, 'ticket', $id, '');
if (!$user->rights->ticket->read) {
accessforbidden();
}
// restrict access for externals users
-if ($user->societe_id > 0 && ($object->fk_soc != $user->societe_id))
+if ($user->socid > 0 && ($object->fk_soc != $user->socid))
{
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden();
}
@@ -171,7 +171,7 @@ if (!empty($object->origin_email)) {
if (! empty($conf->societe->enabled))
{
$morehtmlref.='
'.$langs->trans('ThirdParty');
- /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) {
+ /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' ';
}*/
$morehtmlref.=' : ';
diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php
index f3cb531bb09..a6baeef7c06 100644
--- a/htdocs/ticket/stats/index.php
+++ b/htdocs/ticket/stats/index.php
@@ -37,10 +37,10 @@ $object_status=GETPOST('object_status');
$userid=GETPOST('userid', 'int');
$socid=GETPOST('socid', 'int');
// Security check
-if ($user->societe_id > 0)
+if ($user->socid > 0)
{
$action = '';
- $socid = $user->societe_id;
+ $socid = $user->socid;
}
$nowyear=strftime("%Y", dol_now());
@@ -80,7 +80,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenamenb = $dir.'/ticketsnbinyear-'.$user->id.'-'.$year.'.png';
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsnbinyear-'.$user->id.'-'.$year.'.png';
@@ -121,7 +121,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filenameamount = $dir.'/ticketsamountinyear-'.$user->id.'-'.$year.'.png';
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$user->id.'-'.$year.'.png';
@@ -160,7 +160,7 @@ if (! $mesg)
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
-if (!$user->rights->societe->client->voir || $user->societe_id)
+if (!$user->rights->societe->client->voir || $user->socid)
{
$filename_avg = $dir.'/ticketsaverage-'.$user->id.'-'.$year.'.png';
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$user->id.'-'.$year.'.png';
diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php
index d6f2eedb430..245718bd171 100644
--- a/htdocs/user/agenda_extsites.php
+++ b/htdocs/user/agenda_extsites.php
@@ -55,7 +55,7 @@ $object->getrights();
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php
index 886e931e38f..284c88a867b 100644
--- a/htdocs/user/bank.php
+++ b/htdocs/user/bank.php
@@ -46,7 +46,7 @@ $cancel = GETPOST('cancel', 'alpha');
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
// Ok if user->rights->salaries->read or user->rights->hrm->read
//$result = restrictedArea($user, 'salaries|hrm', $id, 'user&user', $feature2);
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 1e0a15bac06..79c5d65b246 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -83,7 +83,7 @@ if ($id)
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2='user';
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 63abb02fd2e..6702953878c 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -227,6 +227,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
*
@@ -279,7 +285,7 @@ class User extends CommonObject
$sql.= " u.socialnetworks,";
$sql.= " u.signature, u.office_phone, u.office_fax, u.user_mobile, u.personal_mobile,";
$sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,";
- $sql.= " u.admin, u.login, u.note,";
+ $sql.= " u.admin, u.login, u.note as note_private, u.note_public,";
$sql.= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,";
$sql.= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid, u.fk_user_expense_validator, u.fk_user_holiday_validator,";
$sql.= " u.statut, u.lang, u.entity,";
@@ -392,7 +398,9 @@ class User extends CommonObject
$this->job = $obj->job;
$this->signature = $obj->signature;
$this->admin = $obj->admin;
- $this->note = $obj->note;
+ $this->note_public = $obj->note_public;
+ $this->note_private = $obj->note_private;
+ $this->note = $obj->note_private;
$this->statut = $obj->statut;
$this->photo = $obj->photo;
$this->openid = $obj->openid;
@@ -972,22 +980,22 @@ class User extends CommonObject
/**
* Change status of a user
*
- * @param int $statut Status to set
+ * @param int $status Status to set
* @return int <0 if KO, 0 if nothing is done, >0 if OK
*/
- public function setstatus($statut)
+ public function setstatus($status)
{
global $conf,$langs,$user;
$error=0;
// Check parameters
- if ($this->statut == $statut) return 0;
- else $this->statut = $statut;
+ if ($this->statut == $status) return 0;
+ else $this->statut = $status;
$this->db->begin();
- // Deactivate user
+ // Save in database
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET statut = ".$this->statut;
$sql.= " WHERE rowid = ".$this->id;
@@ -1240,7 +1248,8 @@ class User extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
$langs->load("stocks");
$entrepot = new Entrepot($this->db);
- $entrepot->libelle = $langs->trans("PersonalStock", $this->getFullName($langs));
+ $entrepot->label = $langs->trans("PersonalStock", $this->getFullName($langs));
+ $entrepot->libelle = $entrepot->label; // For backward compatibility
$entrepot->description = $langs->trans("ThisWarehouseIsPersonalStock", $this->getFullName($langs));
$entrepot->statut = 1;
$entrepot->country_id = $mysoc->country_id;
@@ -1525,7 +1534,8 @@ class User extends CommonObject
$this->job = trim($this->job);
$this->signature = trim($this->signature);
- $this->note = trim($this->note);
+ $this->note_public = trim($this->note_public);
+ $this->note_private = trim($this->note_private);
$this->openid = trim(empty($this->openid)?'':$this->openid); // Avoid warning
$this->admin = $this->admin?$this->admin:0;
$this->address = empty($this->address)?'':$this->address;
@@ -1581,7 +1591,8 @@ class User extends CommonObject
$sql.= ", color = '".$this->db->escape($this->color)."'";
$sql.= ", dateemployment=".(strval($this->dateemployment)!='' ? "'".$this->db->idate($this->dateemployment)."'" : 'null');
$sql.= ", dateemploymentend=".(strval($this->dateemploymentend)!='' ? "'".$this->db->idate($this->dateemploymentend)."'" : 'null');
- $sql.= ", note = '".$this->db->escape($this->note)."'";
+ $sql.= ", note = '".$this->db->escape($this->note_private)."'";
+ $sql.= ", note_public = '".$this->db->escape($this->note_public)."'";
$sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null");
$sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null");
$sql.= ", fk_user = ".($this->fk_user > 0?"'".$this->db->escape($this->fk_user)."'":"null");
@@ -2485,48 +2496,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);
}
@@ -2710,7 +2704,8 @@ class User extends CommonObject
$this->lastname='DOLIBARR';
$this->firstname='SPECIMEN';
$this->gender='man';
- $this->note='This is a note';
+ $this->note_public='This is a note public';
+ $this->note_private='This is a note private';
$this->email='email@specimen.com';
$this->personal_email='personalemail@specimen.com';
$this->socialnetworks = array(
@@ -2957,7 +2952,7 @@ class User extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau
+ * Build the hierarchy/tree of users into an array.
* Set and return this->users that is an array sorted according to tree with arrays of:
* id = id user
* lastname
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index b624bdb34d9..aa4a6b3f8b6 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -52,7 +52,10 @@ class UserGroup extends CommonObject
*/
public $ismultientitymanaged = 1;
- public $picto='group';
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
+ public $picto='group';
/**
* @var int Entity of group
@@ -836,11 +839,11 @@ class UserGroup extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @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 Label of status
*/
- public function LibStatut($statut, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php
index 04a0f4c3883..f4c3e63f9cf 100644
--- a/htdocs/user/clicktodial.php
+++ b/htdocs/user/clicktodial.php
@@ -33,7 +33,7 @@ $id=GETPOST('id', 'int');
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
diff --git a/htdocs/user/document.php b/htdocs/user/document.php
index 1ae457fb907..63b31328716 100644
--- a/htdocs/user/document.php
+++ b/htdocs/user/document.php
@@ -64,7 +64,7 @@ if ($id)
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2='user';
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php
index 1cdf76e5ca4..448f38aea50 100644
--- a/htdocs/user/group/ldap.php
+++ b/htdocs/user/group/ldap.php
@@ -49,7 +49,7 @@ $id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$object = new Usergroup($db);
$object->fetch($id);
diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php
index 258cb42388d..32118e05b7b 100644
--- a/htdocs/user/group/perms.php
+++ b/htdocs/user/group/perms.php
@@ -243,7 +243,7 @@ if ($object->id > 0)
print '
'.$langs->trans("Permissions").' ';
print '
';
- $sql = "SELECT r.id, r.libelle, r.module";
+ $sql = "SELECT r.id, r.libelle as label, r.module";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql.= " AND r.entity = " . $entity;
@@ -330,7 +330,7 @@ if ($object->id > 0)
print '
  ';
}
- $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->libelle)));
+ $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->label)));
print '
'.$perm_libelle. ' ';
print '';
diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php
index a89fe447aa0..dc990497808 100644
--- a/htdocs/user/hierarchy.php
+++ b/htdocs/user/hierarchy.php
@@ -37,8 +37,8 @@ $langs->loadLangs(array('users', 'companies'));
// Security check (for external users)
$socid=0;
-if ($user->societe_id > 0)
- $socid = $user->societe_id;
+if ($user->socid > 0)
+ $socid = $user->socid;
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_user=GETPOST('search_user', 'alpha');
diff --git a/htdocs/user/home.php b/htdocs/user/home.php
index b17eafb22e6..ec742f3e6a9 100644
--- a/htdocs/user/home.php
+++ b/htdocs/user/home.php
@@ -45,7 +45,7 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
// Security check (for external users)
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$companystatic = new Societe($db);
$fuserstatic = new User($db);
diff --git a/htdocs/user/info.php b/htdocs/user/info.php
index 9296f0213ae..f10328e2a99 100644
--- a/htdocs/user/info.php
+++ b/htdocs/user/info.php
@@ -41,7 +41,7 @@ if ($id > 0 || ! empty($ref))
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php
index da3f3c774c6..0f11b91cd9e 100644
--- a/htdocs/user/ldap.php
+++ b/htdocs/user/ldap.php
@@ -35,7 +35,7 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userldap
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index 3b334871c06..31e5c5382de 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -42,8 +42,8 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userlist
// Security check (for external users)
$socid=0;
-if ($user->societe_id > 0) {
- $socid = $user->societe_id;
+if ($user->socid > 0) {
+ $socid = $user->socid;
}
// Load mode employee
@@ -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/user/note.php b/htdocs/user/note.php
index 0fdbdd26b81..51f6740d636 100644
--- a/htdocs/user/note.php
+++ b/htdocs/user/note.php
@@ -43,7 +43,7 @@ if (($object->id != $user->id) && (! $user->rights->user->user->lire)) accessfor
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php
index 577af6c04ba..2d6bc021355 100644
--- a/htdocs/user/notify/card.php
+++ b/htdocs/user/notify/card.php
@@ -39,7 +39,7 @@ $action = GETPOST('action', 'aZ09');
$actionid=GETPOST('actionid');
// Security check
-if ($user->societe_id) $id=$user->societe_id;
+if ($user->socid) $id=$user->socid;
$result = restrictedArea($user, 'societe', '', '');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php
index 813b5ab4b7f..736db8767ec 100644
--- a/htdocs/user/param_ihm.php
+++ b/htdocs/user/param_ihm.php
@@ -47,7 +47,7 @@ if ($id)
// Security check
$socid=0;
-if ($user->societe_id > 0) $socid = $user->societe_id;
+if ($user->socid > 0) $socid = $user->socid;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php
index a49c3e930b0..26758f52ab0 100644
--- a/htdocs/user/perms.php
+++ b/htdocs/user/perms.php
@@ -56,7 +56,7 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
// Security check
$socid=0;
-if (isset($user->societe_id) && $user->societe_id > 0) $socid = $user->societe_id;
+if (isset($user->socid) && $user->socid > 0) $socid = $user->socid;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
// A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin
if ($user->id == $id && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms) && empty($user->admin)))
@@ -255,7 +255,7 @@ print '
';
if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
// Show warning about external users
-if (empty($user->societe_id)) print info_admin(showModulesExludedForExternal($modules))."\n";
+if (empty($user->socid)) print info_admin(showModulesExludedForExternal($modules))."\n";
$parameters=array('permsgroupbyentity'=>$permsgroupbyentity);
$reshook=$hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -283,7 +283,7 @@ print '
'.$langs->trans("Permissions").' ';
print ''."\n";
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
-$sql = "SELECT r.id, r.libelle, r.module, r.module_position";
+$sql = "SELECT r.id, r.libelle as label, r.module, r.module_position";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql.= " AND r.entity = " . $entity;
@@ -421,7 +421,7 @@ if ($result)
}
// Label
- $permlabel=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->libelle)));
+ $permlabel=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->label)));
print '
'.$permlabel.' ';
print ''."\n";
diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php
index a87959e76fb..03f424f2dcc 100644
--- a/htdocs/variants/combinations.php
+++ b/htdocs/variants/combinations.php
@@ -304,7 +304,7 @@ if (! empty($id) || ! empty($ref))
$linkback = '
'.$langs->trans("BackToList").' ';
$object->next_prev_filter=" fk_product_type = ".$object->type;
- dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', '', '', '', 0, '', '', 1);
print '
';
diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php
index 6bec619269a..27f811fdafe 100644
--- a/htdocs/variants/generator.php
+++ b/htdocs/variants/generator.php
@@ -159,7 +159,7 @@ if (! empty($id) || ! empty($ref)) {
$linkback = '
'.$langs->trans("BackToList").' ';
$object->next_prev_filter=" fk_product_type = ".$object->type;
- dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', '', '', '', 0, '', '', 1);
dol_fiche_end();
}
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index 904266e281b..123578fb5ab 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -198,7 +198,7 @@ if (! empty($hashp))
else
{
// Basic protection (against external users only)
- if ($user->societe_id > 0)
+ if ($user->socid > 0)
{
if ($sqlprotectagainstexternals)
{
@@ -210,7 +210,7 @@ else
while ($i < $num)
{
$obj = $db->fetch_object($resql);
- if ($user->societe_id != $obj->fk_soc)
+ if ($user->socid != $obj->fk_soc)
{
$accessallowed=0;
break;
diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php
index f2fed8f1bca..b66b0db4bcd 100644
--- a/htdocs/webservices/server_productorservice.php
+++ b/htdocs/webservices/server_productorservice.php
@@ -518,10 +518,10 @@ function createProductOrService($authentication, $product)
$newobject->ref=$product['ref'];
$newobject->ref_ext=$product['ref_ext'];
$newobject->type=$product['type'];
- $newobject->libelle=$product['label']; // @deprecated
$newobject->label=$product['label'];
$newobject->description=$product['description'];
- $newobject->note=$product['note'];
+ $newobject->note_public=$product['note_public'];
+ $newobject->note_private=$product['note_private'];
$newobject->status=$product['status_tosell'];
$newobject->status_buy=$product['status_tobuy'];
$newobject->price=$product['price_net'];
@@ -692,7 +692,6 @@ function updateProductOrService($authentication, $product)
if (isset($product['ref'])) $newobject->ref=$product['ref'];
if (isset($product['ref_ext'])) $newobject->ref_ext=$product['ref_ext'];
$newobject->type=$product['type'];
- $newobject->libelle=$product['label']; // @deprecated
$newobject->label=$product['label'];
$newobject->description=$product['description'];
$newobject->note=$product['note'];
diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php
index 1873a8a9f5c..d738bca19f3 100644
--- a/htdocs/webservices/server_supplier_invoice.php
+++ b/htdocs/webservices/server_supplier_invoice.php
@@ -290,8 +290,8 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
'date_modification'=>dol_print_date($invoice->tms, 'dayhourrfc'),
'date_invoice'=>dol_print_date($invoice->date, 'dayhourrfc'),
'date_term'=>dol_print_date($invoice->date_echeance, 'dayhourrfc'),
- 'label'=>$invoice->libelle,
- 'paid'=>$invoice->paye,
+ 'label'=>$invoice->label,
+ 'paid'=>$invoice->paid,
'note_private'=>$invoice->note_private,
'note_public'=>$invoice->note_public,
'close_code'=>$invoice->close_code,
@@ -422,8 +422,8 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty)
'date_modification'=>dol_print_date($invoice->tms, 'dayhourrfc'),
'date_invoice'=>dol_print_date($invoice->date, 'dayhourrfc'),
'date_term'=>dol_print_date($invoice->date_echeance, 'dayhourrfc'),
- 'label'=>$invoice->libelle,
- 'paid'=>$invoice->paye,
+ 'label'=>$invoice->label,
+ 'paid'=>$invoice->paid,
'note_private'=>$invoice->note_private,
'note_public'=>$invoice->note_public,
'close_code'=>$invoice->close_code,
diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php
index 509115d48d6..8f06153a34e 100644
--- a/htdocs/webservices/server_user.php
+++ b/htdocs/webservices/server_user.php
@@ -359,7 +359,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '')
'pass_indatabase_crypted' => $user->pass_indatabase_crypted,
'datec' => dol_print_date($user->datec, 'dayhourrfc'),
'datem' => dol_print_date($user->datem, 'dayhourrfc'),
- 'fk_thirdparty' => $user->societe_id,
+ 'fk_thirdparty' => $user->socid,
'fk_contact' => $user->contact_id,
'fk_member' => $user->fk_member,
'datelastlogin' => dol_print_date($user->datelastlogin, 'dayhourrfc'),
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index bd54b93438f..d84b5232773 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.= '