';
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index cafc9338ae8..f73ff9bf451 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -121,8 +121,13 @@ class AdherentType extends CommonObject
/** @var array Array of members */
public $members = array();
+ /** @var string string other */
+ public $other;
+
public $multilangs = array();
+ public $other = array();
+
/**
* Constructor
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 493203231b5..2ac4fa76682 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -225,7 +225,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
-$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
+$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
@@ -272,7 +272,7 @@ $tabsqlsort[24] = "code ASC, label ASC";
$tabsqlsort[25] = "t.module ASC, t.code ASC, t.label ASC";
//$tabsqlsort[26]="code ASC";
$tabsqlsort[27] = "code ASC";
-$tabsqlsort[28] = "country ASC, code ASC";
+$tabsqlsort[28] = "sortorder ASC, country ASC, code ASC";
$tabsqlsort[29] = "position ASC";
$tabsqlsort[30] = "code ASC";
//$tabsqlsort[31]="pcg_version ASC";
@@ -319,7 +319,7 @@ $tabfield[24] = "code,label";
$tabfield[25] = "code,label";
//$tabfield[26]= "code,label,short_label";
$tabfield[27] = "code,libelle,picto";
-$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative";
+$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
$tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
@@ -366,7 +366,7 @@ $tabfieldvalue[24] = "code,label";
$tabfieldvalue[25] = "code,label";
//$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27] = "code,libelle,picto";
-$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative";
+$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
$tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label";
@@ -413,7 +413,7 @@ $tabfieldinsert[24] = "code,label";
$tabfieldinsert[25] = "code,label";
//$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27] = "code,libelle,picto";
-$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative";
+$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
$tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label";
diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php
index 19c15839231..710ae7fd3d0 100644
--- a/htdocs/asset/class/asset.class.php
+++ b/htdocs/asset/class/asset.class.php
@@ -144,6 +144,7 @@ class Asset extends CommonObject
public $fk_disposal_type;
public $disposal_depreciated;
public $disposal_subject_to_vat;
+ public $supplier_invoice_id;
public $note_public;
public $note_private;
public $date_creation;
@@ -154,6 +155,7 @@ class Asset extends CommonObject
public $import_key;
public $model_pdf;
public $status;
+ public $supplier_invoice_id;
// /**
// * @var string Field with ID of parent key if this object has a parent
diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php
index eae7b5d0fde..6390ad74c18 100644
--- a/htdocs/asset/class/assetmodel.class.php
+++ b/htdocs/asset/class/assetmodel.class.php
@@ -129,6 +129,7 @@ class AssetModel extends CommonObject
public $import_key;
public $model_pdf;
public $status;
+ public $asset_depreciation_options;
// /**
// * @var string Field with ID of parent key if this object has a parent
diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php
index 2b9c6f57bbd..4bc9095a57e 100644
--- a/htdocs/bom/bom_agenda.php
+++ b/htdocs/bom/bom_agenda.php
@@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
+$socid = GETPOST('socid', 'int');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@@ -79,7 +80,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// 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->bom->multidir_output[$object->entity]."/".$object->id;
+ $upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
// Security check - Protection if external user
diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php
index 64f3cdbfac1..a0390ef5105 100644
--- a/htdocs/bom/bom_document.php
+++ b/htdocs/bom/bom_document.php
@@ -104,6 +104,7 @@ $form = new Form($db);
$title = $langs->trans("BillOfMaterials").' - '.$langs->trans("Files");
$help_url = 'EN:Module_BOM';
+$morehtmlref = "";
llxHeader('', $title, $help_url);
diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php
index e850365d365..d08cce70382 100644
--- a/htdocs/bom/bom_net_needs.php
+++ b/htdocs/bom/bom_net_needs.php
@@ -34,6 +34,7 @@ $langs->loadLangs(array("mrp", "other", "stocks"));
// Get parameters
$id = GETPOST('id', 'int');
+$lineid = GETPOST('lineid', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php
index 8ace40cc900..9984a1498b8 100644
--- a/htdocs/bom/bom_note.php
+++ b/htdocs/bom/bom_note.php
@@ -54,7 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// 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->bom->multidir_output[$object->entity]."/".$object->id;
+ $upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 86e07ed424d..fb7fd68e13a 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -916,27 +916,27 @@ class BOM extends CommonObject
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
- if ($obj->fk_user_author) {
+ if (!empty($obj->fk_user_author)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
- if ($obj->fk_user_valid) {
+ if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
- if ($obj->fk_user_cloture) {
+ if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
- $this->date_modification = $this->db->jdate($obj->datem);
- $this->date_validation = $this->db->jdate($obj->datev);
+ $this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : "";
+ $this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
}
$this->db->free($result);
@@ -1134,6 +1134,9 @@ class BOM extends CommonObject
if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
} else {
+ if (empty($TNetNeeds[$line->fk_product])) {
+ $TNetNeeds[$line->fk_product] = 0;
+ }
$TNetNeeds[$line->fk_product] += $line->qty*$qty;
}
}
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 434b994ccd2..ef5ea585314 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -113,7 +113,7 @@ class Categorie extends CommonObject
*
* @todo Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_CAT_FK = array(
+ public static $MAP_CAT_FK = array(
'customer' => 'soc',
'supplier' => 'soc',
'contact' => 'socpeople',
@@ -125,7 +125,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_CAT_TABLE = array(
+ public static $MAP_CAT_TABLE = array(
'customer' => 'societe',
'supplier' => 'fournisseur',
'bank_account'=> 'account',
@@ -136,7 +136,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_OBJ_CLASS = array(
+ public static $MAP_OBJ_CLASS = array(
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
@@ -178,7 +178,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_OBJ_TABLE = array(
+ public static $MAP_OBJ_TABLE = array(
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
@@ -258,6 +258,12 @@ class Categorie extends CommonObject
*/
public $motherof = array();
+ /**
+ * @var array Childs
+ */
+ public $childs = array();
+
+
/**
* Constructor
*
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index fc1f12afa04..73e73fbe2f9 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -296,8 +296,8 @@ class Propal extends CommonObject
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>24),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
@@ -317,7 +317,7 @@ class Propal extends CommonObject
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
- 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
@@ -327,7 +327,7 @@ class Propal extends CommonObject
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
- 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>191),
+ 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>191),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
@@ -1517,6 +1517,7 @@ class Propal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
+ $sql .= ", p.date_signature as dates";
$sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp";
$sql .= ", p.fin_validite as dfv";
@@ -1600,6 +1601,7 @@ class Propal extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_modification = $this->db->jdate($obj->date_modification); // tms
+ $this->date_signature = $this->db->jdate($obj->dates); // Signature date
$this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv);
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 5d5e5c2a7c4..a7d237bc780 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -313,8 +313,8 @@ class Commande extends CommonOrder
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>25),
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
@@ -334,14 +334,14 @@ class Commande extends CommonOrder
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
- 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
- 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
+ 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
@@ -4443,7 +4443,7 @@ class OrderLine extends CommonOrderLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
$sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
- $sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,';
+ $sql .= ' fk_product, product_type, remise_percent, subprice, price, fk_remise_except,';
$sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,';
$sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,';
$sql .= ' fk_unit';
@@ -4466,7 +4466,6 @@ class OrderLine extends CommonOrderLine
$sql .= " '".price2num($this->remise_percent)."',";
$sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").",";
$sql .= " ".($this->price != '' ? "'".price2num($this->price)."'" : "null").",";
- $sql .= " '".price2num($this->remise)."',";
$sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").',';
$sql .= ' '.((int) $this->special_code).',';
$sql .= ' '.((int) $this->rang).',';
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index af6d4dc606b..927da1bf17a 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
@@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
@@ -199,7 +199,7 @@ class FactureRec extends CommonInvoice
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1),
'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
- 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190, 'isameasure'=>1),
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 583626f0220..989fa28b2f0 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -281,8 +281,8 @@ if ($object->id > 0) {
}
$author = new User($db);
- if ($object->user_author) {
- $author->fetch($object->user_author);
+ if ($object->fk_user_author) {
+ $author->fetch($object->fk_user_author);
}
if ($type == 'bank-transfer') {
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index fae36d323e3..1cef1901917 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -316,8 +316,9 @@ if (empty($reshook)) {
$result = $object->delete(); // TODO Add $user as first param
if ($result > 0) {
- if ($backtopage) {
- header("Location: ".$backtopage);
+ setEventMessages("RecordDeleted", null, 'mesgs');
+ if ($backurlforlist) {
+ header("Location: ".$backurlforlist);
exit;
} else {
header("Location: ".DOL_URL_ROOT.'/contact/list.php');
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 494c3cb1369..79f2e8e9e15 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -232,8 +232,8 @@ class Contrat extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>75),
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index cec127eeac4..85b854f8ba7 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -101,10 +101,10 @@ if ($action == 'add' && !empty($permissiontoadd)) {
//var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
$object->$key = $value;
- if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)') {
+ if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') {
$object->$key = '(PROV)';
}
- if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
+ if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index b94655fbc14..5acc6b22ee2 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -1468,6 +1468,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
$trackid = 'leav'.$objecttmp->id;
+ require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
// Sending email
diff --git a/htdocs/core/ajax/ajaxcompanies.php b/htdocs/core/ajax/ajaxcompanies.php
new file mode 100644
index 00000000000..350f03398aa
--- /dev/null
+++ b/htdocs/core/ajax/ajaxcompanies.php
@@ -0,0 +1,122 @@
+
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2007-2010 Laurent Destailleur
+ * Copyright (C) 2010 Cyrille de Lambert
+ *
+ * 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/ajax/ajaxcompanies.php
+ * \brief File to return Ajax response on third parties request
+ */
+
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
+if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
+if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
+if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
+if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
+
+require '../../main.inc.php';
+
+
+/*
+ * View
+ */
+
+// Ajout directives pour resoudre bug IE
+//header('Cache-Control: Public, must-revalidate');
+//header('Pragma: public');
+
+//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
+top_httphead();
+
+//print ''."\n";
+
+dol_syslog(join(',', $_GET));
+
+
+// Generation liste des societes
+if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) {
+ $return_arr = array();
+
+ // Define filter on text typed
+ $socid = $_GET['newcompany'] ? $_GET['newcompany'] : '';
+ if (!$socid) $socid = $_GET['socid'] ? $_GET['socid'] : '';
+ if (!$socid) $socid = $_GET['id_fourn'] ? $_GET['id_fourn'] : '';
+
+ $sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec, s.logo";
+ $sql .= " , c.label as country, d.nom as departement";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON d.rowid = s.fk_departement";
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")";
+ if ($socid) {
+ $sql .= " AND (";
+ // Add criteria on name/code
+ if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { // Can use index
+ $sql .= "s.nom LIKE '".$db->escape($socid)."%'";
+ $sql .= " OR s.code_client LIKE '".$db->escape($socid)."%'";
+ $sql .= " OR s.code_fournisseur LIKE '".$db->escape($socid)."%'";
+ } else {
+ $sql .= "s.nom LIKE '%".$db->escape($socid)."%'";
+ $sql .= " OR s.code_client LIKE '%".$db->escape($socid)."%'";
+ $sql .= " OR s.code_fournisseur LIKE '%".$db->escape($socid)."%'";
+ }
+ if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql .= " OR s.rowid = '".$db->escape($socid)."'";
+ $sql .= ")";
+ }
+ //if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters
+ $sql .= " ORDER BY s.nom ASC";
+
+ //dol_syslog("ajaxcompanies", LOG_DEBUG);
+ $resql = $db->query($sql);
+
+ if ($resql) {
+ while ($row = $db->fetch_array($resql)) {
+ $label = $row['nom'];
+ if ($socid) $label = $label;
+ $row_array['label'] = $label;
+ $row_array['value'] = $row['nom'];
+ $row_array['key'] = $row['rowid'];
+ $row_array['name_alias'] = $row['name_alias'];
+ $row_array['code_client'] = $row['code_client'];
+ $row_array['code_fournisseur'] = $row['code_fournisseur'];
+ $row_array['address'] = $row['address'];
+ $row_array['zip'] = $row['zip'];
+ $row_array['town'] = $row['town'];
+ $row_array['email'] = $row['email'];
+ $row_array['siren'] = $row['siren'];
+ $row_array['siret'] = $row['siret'];
+ $row_array['ape'] = $row['ape'];
+ $row_array['idprof4'] = $row['idprof4'];
+ $row_array['client'] = $row['client'];
+ $row_array['fournisseur'] = $row['fournisseur'];
+ $row_array['datec'] = $row['datec'];
+ $row_array['logo'] = $row['logo'];
+ $row_array['country'] = $row['country'];
+ $row_array['departement'] = $row['departement'];
+
+ array_push($return_arr, $row_array);
+ }
+
+ echo json_encode($return_arr);
+ } else {
+ echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error'));
+ }
+} else {
+ echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter'));
+}
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index 371a7a0dbed..02b5070a96c 100644
--- a/htdocs/core/boxes/box_activity.php
+++ b/htdocs/core/boxes/box_activity.php
@@ -329,7 +329,7 @@ class box_activity extends ModeleBoxes
if (!empty($data)) {
$j = 0;
while ($j < count($data)) {
- $billurl = "search_status=2&paye=1&year=".$data[$j]->annee;
+ $billurl = "search_status=2&paye=1";
$this->info_box_contents[$line][0] = array(
'td' => 'class="left" width="16"',
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
@@ -339,7 +339,7 @@ class box_activity extends ModeleBoxes
$this->info_box_contents[$line][1] = array(
'td' => '',
- 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0)." ".$data[$j]->annee,
+ 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
);
$this->info_box_contents[$line][2] = array(
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index b6acbbbfbc9..94fb05d5346 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -597,7 +597,7 @@ class CMailFile
}
$sendingmode = $this->sendmode;
- if ($this->context == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
+ if ($this->sendcontext == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
// List of sending methods
$listofmethods = array();
$listofmethods['mail'] = 'PHP mail function';
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 079401d045a..bf33cbe224e 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4889,7 +4889,7 @@ abstract class CommonObject
$product_static->fetch($line->fk_product);
$product_static->ref = $line->ref; //can change ref in hook
- $product_static->label = $line->label; //can change label in hook
+ $product_static->label = !empty($line->label) ? $line->label : ""; //can change label in hook
$text = $product_static->getNomUrl(1);
@@ -4925,7 +4925,7 @@ abstract class CommonObject
$description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
}
- $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU');
+ $line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
@@ -6847,7 +6847,7 @@ abstract class CommonObject
if ((string) $key == '') {
continue;
}
- list($val, $parent) = explode('|', $val);
+ if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val);
$out .= '
global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
+
print '';
print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');
+ /* Disabled. Must be implenteted by keeping the input text but calling ajax on a keydown of the input and output
+ data of duplicate into a div under the input. We need to keep the widgetForTranslation also for some countries.
+ */
+ /*
+ print '';
+ print "\n".'
+ ';
+ */
print '
';
if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
print '