';
if (!empty($conf->multicurrency->enabled))
{
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index b6d91b235ba..5069135dd88 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -76,7 +76,7 @@ class Orders extends DolibarrApi
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
- * @url GET byRef/{ref}
+ * @url GET ref/{ref}
*
* @throws RestException
*/
@@ -94,7 +94,7 @@ class Orders extends DolibarrApi
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
- * @url GET byRefExt/{ref_ext}
+ * @url GET ref_ext/{ref_ext}
*
* @throws RestException
*/
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 0c093d561c0..ef15d983d20 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -977,35 +977,22 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
if ($this->db->query($sql))
{
- if ($this->id)
+ $this->ref = $initialref;
+
+ if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
{
- $this->ref = $initialref;
+ $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
+ }
- if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
+ // Add object linked
+ if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
+ {
+ foreach ($this->linked_objects as $origin => $tmp_origin_id)
{
- $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
- }
-
- // Add object linked
- if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
- {
- foreach ($this->linked_objects as $origin => $tmp_origin_id)
+ if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
{
- if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
+ foreach ($tmp_origin_id as $origin_id)
{
- foreach ($tmp_origin_id as $origin_id)
- {
- $ret = $this->add_object_linked($origin, $origin_id);
- if (!$ret)
- {
- $this->error = $this->db->lasterror();
- $error++;
- }
- }
- }
- else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
- {
- $origin_id = $tmp_origin_id;
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
{
@@ -1014,44 +1001,54 @@ class Commande extends CommonOrder
}
}
}
+ else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
+ {
+ $origin_id = $tmp_origin_id;
+ $ret = $this->add_object_linked($origin, $origin_id);
+ if (!$ret)
+ {
+ $this->error = $this->db->lasterror();
+ $error++;
+ }
+ }
}
+ }
- if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) // Get contact from origin object
+ if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) // Get contact from origin object
+ {
+ $originforcontact = $this->origin;
+ $originidforcontact = $this->origin_id;
+ if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
{
- $originforcontact = $this->origin;
- $originidforcontact = $this->origin_id;
- if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
+ require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
+ $exp = new Expedition($this->db);
+ $exp->fetch($this->origin_id);
+ $exp->fetchObjectLinked();
+ if (count($exp->linkedObjectsIds['commande']) > 0)
{
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
- $exp = new Expedition($this->db);
- $exp->fetch($this->origin_id);
- $exp->fetchObjectLinked();
- if (count($exp->linkedObjectsIds['commande']) > 0)
+ foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
{
- foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
- {
- $originforcontact = 'commande';
- if (is_object($value)) $originidforcontact = $value->id;
- else $originidforcontact = $value;
- break; // We take first one
- }
+ $originforcontact = 'commande';
+ if (is_object($value)) $originidforcontact = $value->id;
+ else $originidforcontact = $value;
+ break; // We take first one
}
}
-
- $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
- $sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
-
- $resqlcontact = $this->db->query($sqlcontact);
- if ($resqlcontact)
- {
- while ($objcontact = $this->db->fetch_object($resqlcontact))
- {
- //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
- $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
- }
- }
- else dol_print_error($resqlcontact);
}
+
+ $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
+ $sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
+
+ $resqlcontact = $this->db->query($sqlcontact);
+ if ($resqlcontact)
+ {
+ while ($objcontact = $this->db->fetch_object($resqlcontact))
+ {
+ //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
+ $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
+ }
+ }
+ else dol_print_error($resqlcontact);
}
if (!$error)
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 1de1e64e0c7..9e34c745fab 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -80,7 +80,7 @@ $search_total_ttc = GETPOST('search_total_ttc', 'alpha');
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
$optioncss = GETPOST('optioncss', 'alpha');
$billed = GETPOST('billed', 'int');
-$viewstatut = GETPOST('viewstatut');
+$viewstatut = GETPOST('viewstatut', 'int');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
$search_project_ref = GETPOST('search_project_ref', 'alpha');
diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php
index 1b69e035fba..a593e10adf4 100644
--- a/htdocs/commande/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php
@@ -18,7 +18,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf)) {
+if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
}
@@ -36,14 +36,14 @@ $langs->load("orders");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
-$total=0;
-$ilink=0;
-foreach($linkedObjectBlock as $key => $objectlink)
+$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';
+ $trclass = 'oddeven';
+ if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
echo '
';
echo '
'.$langs->trans("CustomerOrder");
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
@@ -62,14 +62,14 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo '
';
// Bank
@@ -321,7 +321,7 @@ if ($action == 'create')
print '
';
- print '
'."\n";
+ print '
'."\n";
}
// Project
@@ -358,13 +358,13 @@ if ($action == 'create')
// TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '
";
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index ee4208cd65e..0d718c2abc2 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -75,6 +75,7 @@ if ($action == 'add' && !empty($permissiontoadd))
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field
if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field
+ //var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
$object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)')
{
diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php
new file mode 100644
index 00000000000..957c738ad22
--- /dev/null
+++ b/htdocs/core/boxes/box_shipments.php
@@ -0,0 +1,190 @@
+
+ * Copyright (C) 2004-2009 Laurent Destailleur
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2019 Alexandre Spangaro
+ *
+ * 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/core/boxes/box_shipments.php
+ * \ingroup shipment
+ * \brief Module for generating the display of the shipment box
+ */
+
+include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
+
+
+/**
+ * Class to manage the box to show last shipments
+ */
+class box_shipments extends ModeleBoxes
+{
+ public $boxcode="lastcustomershipments";
+ public $boximg="sending";
+ public $boxlabel="BoxLastCustomerShipments";
+ public $depends = array("expedition");
+
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ public $param;
+
+ public $info_box_head = array();
+ public $info_box_contents = array();
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ public function __construct($db, $param)
+ {
+ global $user;
+
+ $this->db=$db;
+
+ $this->hidden=! ($user->rights->expedition->lire);
+ }
+
+ /**
+ * Load data for box to show them later
+ *
+ * @param int $max Maximum number of records to load
+ * @return void
+ */
+ public function loadBox($max = 5)
+ {
+ global $user, $langs, $conf;
+ $langs->loadLangs(array('orders', 'sendings'));
+
+ $this->max = $max;
+
+ include_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+
+ $shipmentstatic = new Expedition($this->db);
+ $orderstatic = new Commande($this->db);
+ $societestatic = new Societe($this->db);
+
+ $this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerShipments", $max));
+
+ if ($user->rights->expedition->lire)
+ {
+ $sql = "SELECT s.nom as name";
+ $sql.= ", s.rowid as socid";
+ $sql.= ", s.code_client";
+ $sql.= ", s.logo, s.email";
+ $sql.= ", e.ref, e.tms";
+ $sql.= ", e.rowid";
+ $sql.= ", e.ref_customer";
+ $sql.= ", e.fk_statut";
+ $sql.= ", e.fk_user_valid";
+ $sql.= ", c.ref as commande_ref";
+ $sql.= ", c.rowid as commande_id";
+ $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
+ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
+ $sql.= " WHERE e.entity = ".$conf->entity;
+ if (! empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql.=" AND e.fk_statut = 1";
+ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND sc.fk_user = " .$user->id;
+ else $sql.= " ORDER BY e.date_delivery, e.ref DESC ";
+ $sql.= $this->db->plimit($max, 0);
+
+ $result = $this->db->query($sql);
+ if ($result) {
+ $num = $this->db->num_rows($result);
+
+ $line = 0;
+
+ while ($line < $num) {
+ $objp = $this->db->fetch_object($result);
+
+ $shipmentstatic->id = $objp->rowid;
+ $shipmentstatic->ref = $objp->ref;
+ $shipmentstatic->ref_customer = $objp->ref_customer;
+
+ $orderstatic->id= $objp->commande_id;
+ $orderstatic->ref=$objp->commande_ref;
+
+ $societestatic->id = $objp->socid;
+ $societestatic->name = $objp->name;
+ $societestatic->email = $objp->email;
+ $societestatic->code_client = $objp->code_client;
+ $societestatic->logo = $objp->logo;
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => '',
+ 'text' => $shipmentstatic->getNomUrl(1),
+ 'asis' => 1,
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
+ 'text' => $societestatic->getNomUrl(1),
+ 'asis' => 1,
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => '',
+ 'text' => $orderstatic->getNomUrl(1),
+ 'asis' => 1,
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="right" width="18"',
+ 'text' => $shipmentstatic->LibStatut($objp->fk_statut, 3),
+ );
+
+ $line++;
+ }
+
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedShipments"));
+
+ $this->db->free($result);
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => '',
+ 'maxlength'=>500,
+ 'text' => ($this->db->error().' sql='.$sql),
+ );
+ }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="nohover opacitymedium left"',
+ 'text' => $langs->trans("ReadPermissionNotAllowed")
+ );
+ }
+ }
+
+ /**
+ * Method to show box
+ *
+ * @param array $head Array with properties of box title
+ * @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
+ * @return string
+ */
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ }
+}
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 335c1b50111..eb15710eb7c 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -626,6 +626,7 @@ class CMailFile
}
// Force parameters
+ //dol_syslog("CMailFile::sendfile conf->global->".$keyforsmtpserver."=".$conf->global->$keyforsmtpserver." cpnf->global->".$keyforsmtpport."=".$conf->global->$keyforsmtpport, LOG_DEBUG);
if (!empty($conf->global->$keyforsmtpserver)) ini_set('SMTP', $conf->global->$keyforsmtpserver);
if (!empty($conf->global->$keyforsmtpport)) ini_set('smtp_port', $conf->global->$keyforsmtpport);
@@ -776,7 +777,7 @@ class CMailFile
else
{
if (empty($this->error)) $this->error = $result;
- dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
+ dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport." ".$this->error, LOG_ERR);
$res = false;
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 1fb0fe17a75..bbd11c8f522 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6571,7 +6571,8 @@ abstract class CommonObject
/**
- * Function to show lines of extrafields with output datas
+ * Function to show lines of extrafields with output datas.
+ * This function is responsible to output the
and
according to correct number of columns received into $params['colspan']
*
* @param Extrafields $extrafields Extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield
diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php
index b65d72332e0..41a0d485ce0 100644
--- a/htdocs/core/class/emailsenderprofile.class.php
+++ b/htdocs/core/class/emailsenderprofile.class.php
@@ -56,19 +56,28 @@ class EmailSenderProfile extends CommonObject
public $picto = 'emailsenderprofile@monmodule';
+ const STATUS_DISABLED = 0;
+ const STATUS_ENABLED = 1;
+
+
/**
- * 'type' if the field format.
- * 'label' the translation key.
- * 'enabled' is a condition when the filed must be managed.
- * 'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed).
- * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
- * '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).
- * 'help' is a string visible as a tooltip on field
- * 'comment' is not used. You can store here any text of your choice.
+ * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
+ * 'label' the translation key.
+ * 'enabled' is a condition when the field must be managed.
+ * '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 replaced by the global setup of default values)
+ * '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")
*/
// BEGIN MODULEBUILDER PROPERTIES
@@ -78,7 +87,7 @@ class EmailSenderProfile extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
- 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1),
+ 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1),
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
//'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
@@ -86,7 +95,7 @@ class EmailSenderProfile extends CommonObject
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
- 'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
+ 'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
);
/**
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index cac859c53b5..d70993be51d 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -6521,6 +6521,7 @@ class Form
elseif ($addjscombo == 2)
{
// Add other js lib
+ // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
// ...
$out .= '$(document).ready(function () {
$(\'#'.$htmlname.'\').multiSelect({
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 00ca3f3d45f..9faa3762111 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3911,9 +3911,9 @@ function dol_print_error($db = '', $error = '', $errors = null)
}
if (empty($dolibarr_main_prod)) print $out;
- else
+ else // This should not happen, except if there is a bug somewhere. Enabled and check log in such case.
{
- print 'This website is currently temporarly offline. This may be due to a maintenance operation. Current status of operation are on next line...
'."\n";
+ print 'This website is currently temporarly offline.
This may be due to a maintenance operation. Current status of operation are on next line...
'."\n";
$langs->load("errors");
print $langs->trans("DolibarrHasDetectedError").'. ';
print $langs->trans("YouCanSetOptionDolibarrMainProdToZero");
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index d5226bb7e3d..7a3102e8aca 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -422,7 +422,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (! empty($objectid) && $objectid > 0)
{
$ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select);
- return $ok ? 1 : accessforbidden();
+ $params=array('objectid' => $objectid, 'features' => join(',', $featuresarray), 'features2' => $feature2);
+ return $ok ? 1 : accessforbidden('', 1, 1, 0, $params);
}
return 1;
@@ -660,13 +661,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
* Show a message to say access is forbidden and stop program
* Calling this function terminate execution of PHP.
*
- * @param string $message Force error message
- * @param int $printheader Show header before
- * @param int $printfooter Show footer after
- * @param int $showonlymessage Show only message parameter. Otherwise add more information.
+ * @param string $message Force error message
+ * @param int $printheader Show header before
+ * @param int $printfooter Show footer after
+ * @param int $showonlymessage Show only message parameter. Otherwise add more information.
+ * @param array|null $params Send params
* @return void
*/
-function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0)
+function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null)
{
global $conf, $db, $user, $langs, $hookmanager;
if (! is_object($langs))
@@ -697,7 +699,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('main'));
}
- $parameters = array('message'=>$message);
+ $parameters = array('message'=>$message, 'params'=>$params);
$reshook=$hookmanager->executeHooks('getAccessForbiddenMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
print $hookmanager->resPrint;
if (empty($reshook))
diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php
index 68f4a3d5fba..8f99dcc59a1 100644
--- a/htdocs/core/modules/modExpedition.class.php
+++ b/htdocs/core/modules/modExpedition.class.php
@@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
*/
class modExpedition extends DolibarrModules
{
-
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
@@ -133,7 +132,9 @@ class modExpedition extends DolibarrModules
$r++;
// Boxes
- $this->boxes = array();
+ $this->boxes = array(
+ 0=>array('file'=>'box_shipments.php','enabledbydefaulton'=>'Home'),
+ );
// Permissions
$this->rights = array();
@@ -187,7 +188,7 @@ class modExpedition extends DolibarrModules
$r++;
$this->rights[$r][0] = 1101;
- $this->rights[$r][1] = 'Lire les bons de livraison';
+ $this->rights[$r][1] = 'Read delivery receipts';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison';
@@ -195,7 +196,7 @@ class modExpedition extends DolibarrModules
$r++;
$this->rights[$r][0] = 1102;
- $this->rights[$r][1] = 'Creer modifier les bons de livraison';
+ $this->rights[$r][1] = 'Create/modify delivery receipts';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison';
@@ -203,7 +204,7 @@ class modExpedition extends DolibarrModules
$r++;
$this->rights[$r][0] = 1104;
- $this->rights[$r][1] = 'Valider les bons de livraison';
+ $this->rights[$r][1] = 'Validate delivery receipts';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison_advance';
@@ -211,7 +212,7 @@ class modExpedition extends DolibarrModules
$r++;
$this->rights[$r][0] = 1109;
- $this->rights[$r][1] = 'Supprimer les bons de livraison';
+ $this->rights[$r][1] = 'Delete delivery receipts';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison';
diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php
index 081149be51d..917da8fec25 100644
--- a/htdocs/core/modules/modHoliday.class.php
+++ b/htdocs/core/modules/modHoliday.class.php
@@ -269,4 +269,45 @@ class modHoliday extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
+
+ /**
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
+ *
+ * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function init($options = '')
+ {
+ global $conf;
+
+ // Permissions
+ $this->remove($options);
+
+ //ODT template
+ /*$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/holiday/template_holiday.odt';
+ $dirodt=DOL_DATA_ROOT.'/doctemplates/holiday';
+ $dest=$dirodt.'/template_order.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 = 'holiday' AND entity = ".$conf->entity,
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','holiday',".$conf->entity.")"
+ );*/
+
+ return $this->_init($sql, $options);
+ }
}
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index e74f76669cf..6ea964bbc66 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -91,7 +91,7 @@ $(document).ready(function () {