diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 1431df9f8a2..ad28dd1af97 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -1260,7 +1260,7 @@ class BookKeeping extends CommonObject
global $user;
$error = 0;
- $object = new Accountingbookkeeping($this->db);
+ $object = new BookKeeping($this->db);
$this->db->begin();
diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php
index 869b86238ff..c6fd3f72def 100644
--- a/htdocs/compta/bank/class/api_bankaccounts.class.php
+++ b/htdocs/compta/bank/class/api_bankaccounts.class.php
@@ -72,7 +72,7 @@ class BankAccounts extends DolibarrApi
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t";
$sql.= ' WHERE t.entity IN ('.getEntity('bank_account').')';
// Add sql filters
- if ($sqlfilters)
+ if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@@ -81,7 +81,7 @@ class BankAccounts extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
-
+
$sql.= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@@ -89,10 +89,10 @@ class BankAccounts extends DolibarrApi
$page = 0;
}
$offset = $limit * $page;
-
+
$sql.= $this->db->plimit($limit + 1, $offset);
}
-
+
dol_syslog("API Rest request");
$result = $this->db->query($sql);
@@ -236,7 +236,7 @@ class BankAccounts extends DolibarrApi
function _validate($data)
{
$account = array();
- foreach (Accounts::$FIELDS as $field) {
+ foreach (BankAccounts::$FIELDS as $field) {
if (! isset($data[$field]))
throw new RestException(400, "$field field missing");
$account[$field] = $data[$field];
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index d77f83cbb2e..41affeba238 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -400,6 +400,22 @@ if (empty($reshook))
setEventMessages($discount->error, $discount->errors, 'errors');
}
}
+
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ {
+ $outputlangs = $langs;
+ $newlang = '';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
+ if (! empty($newlang)) {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+ $ret = $object->fetch($id); // Reload to get new records
+
+ $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
+ }
}
else if ($action == 'setref_client' && $user->rights->facture->creer)
@@ -1105,8 +1121,17 @@ if (empty($reshook))
foreach ($amountdeposit as $tva => $amount)
{
+ $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
+ $descline = $langs->trans('Deposit');
+ $descline.= ' - '.$langs->trans($arraylist[$typeamount]);
+ if ($typeamount=='amount') {
+ $descline.= ' ('. price($valuedeposit, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).')';
+ } elseif ($typeamount=='variable') {
+ $descline.= ' ('. $valuedeposit.'%)';
+ }
+ $descline.= ' - '.$srcobject->ref;
$result = $object->addline(
- $langs->trans('Deposit'),
+ $descline,
$amount, // subprice
1, // quantity
$tva, // vat rate
@@ -1128,8 +1153,8 @@ if (empty($reshook))
0,
0,
0,
- 0,
- $langs->trans('Deposit')
+ 0
+ //,$langs->trans('Deposit') //Deprecated
);
}
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index f4e61380a9c..8e67825c085 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -337,6 +337,24 @@ class Paiement extends CommonObject
$error++;
}
}
+ }
+
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ {
+ $outputlangs = $langs;
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
+ if (! empty($newlang)) {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+ $ret = $invoice->fetch($id); // Reload to get new records
+
+ $result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
+ if ($result < 0) {
+ setEventMessages($invoice->error, $invoice->errors, 'errors');
+ $error++;
+ }
+
}
}
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index e44fa8a5aec..966f3f859c0 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -281,7 +281,7 @@ class ExtraFields
*/
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $default='', $computed='')
{
- global $conf;
+ global $conf,$user;
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
@@ -305,7 +305,27 @@ class ExtraFields
$params='';
}
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable, perms, list, ishidden, fielddefault, fieldcomputed)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(";
+ $sql.= " name,";
+ $sql.= " label,";
+ $sql.= " type,";
+ $sql.= " pos,";
+ $sql.= " size,";
+ $sql.= " entity,";
+ $sql.= " elementtype,";
+ $sql.= " fieldunique,";
+ $sql.= " fieldrequired,";
+ $sql.= " param,";
+ $sql.= " alwayseditable,";
+ $sql.= " perms,";
+ $sql.= " list,";
+ $sql.= " ishidden,";
+ $sql.= " fielddefault,";
+ $sql.= " fieldcomputed,";
+ $sql.= " fk_user_author,";
+ $sql.= " fk_user_modif,";
+ $sql.= " datec";
+ $sql.= " )";
$sql.= " VALUES('".$attrname."',";
$sql.= " '".$this->db->escape($label)."',";
$sql.= " '".$type."',";
@@ -321,9 +341,12 @@ class ExtraFields
$sql.= " ".$list.",";
$sql.= " ".$ishidden.",";
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").",";
- $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null");
+ $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
+ $sql .= " " . $user->id . ",";
+ $sql .= " " . $user->id . ",";
+ $sql .= "'" . $this->db->idate(dol_now()) . "'";
$sql.=')';
-
+
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
if ($this->db->query($sql))
{
@@ -562,7 +585,7 @@ class ExtraFields
*/
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0,$default='',$computed='')
{
- global $conf;
+ global $conf, $user;
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden.", ".$default.", ".$computed);
// Clean parameters
@@ -603,7 +626,10 @@ class ExtraFields
$sql.= " list,";
$sql.= " ishidden,";
$sql.= " fielddefault,";
- $sql.= " fieldcomputed";
+ $sql.= " fieldcomputed,";
+ $sql.= " fk_user_author,";
+ $sql.= " fk_user_modif,";
+ $sql.= " datec";
$sql.= ") VALUES (";
$sql.= "'".$attrname."',";
$sql.= " ".$conf->entity.",";
@@ -620,7 +646,10 @@ class ExtraFields
$sql.= " ".$list.", ";
$sql.= " ".$ishidden.", ";
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").",";
- $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null");
+ $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
+ $sql .= " " . $user->id . ",";
+ $sql .= " " . $user->id . ",";
+ $sql .= "'" . $this->db->idate(dol_now()) . "'";
$sql.= ")";
$resql2=$this->db->query($sql);
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index 64d0da9b5fd..f9dac51389f 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -211,7 +211,7 @@ class doc_generic_contract_odt extends ModelePDFContract
if (! is_object($object))
{
$id = $object;
- $object = new Contract($this->db);
+ $object = new Contrat($this->db);
$result=$object->fetch($id);
if ($result < 0)
{
diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
index 0339f2ea255..130aa90ecfd 100644
--- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
+++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
@@ -167,7 +167,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$texte.=$file['name'].'
';
}
$texte.='