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.='
'; - + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { // Model for creation @@ -252,7 +252,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales if (! is_object($object)) { $id = $object; - $object = new Propale($this->db); + $object = new Propal($this->db); $result=$object->fetch($id); if ($result < 0) { diff --git a/htdocs/core/tpl/bloc_showhide.tpl.php b/htdocs/core/tpl/bloc_showhide.tpl.php index 2c5d71c79d5..a98e8314097 100644 --- a/htdocs/core/tpl/bloc_showhide.tpl.php +++ b/htdocs/core/tpl/bloc_showhide.tpl.php @@ -21,43 +21,45 @@ if (isset($parameters['showblocbydefault'])) $hide=(empty($parameters['showblocb if (isset($object->extraparams[$blocname]['showhide'])) $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false); ?> - - +print '$("#show-'.$blocname.'").click(function(){'."\n"; +print ' setShowHide(1);'."\n"; +print ' $("#'.$blocname.'").show("blind", {direction: "vertical"}, 300).addClass("nohideobject");'."\n"; +print ' $(this).hide();'."\n"; +print ' $("#hide-'.$blocname.'").show();'."\n"; +print '});'."\n"; -
-
-
+print 'function setShowHide(status) {'."\n"; +print ' var id = '.$object->id."\n"; +print ' var element = '.$object->element."\n"; +print ' var htmlelement = '.$blocname."\n"; +print ' var type = "showhide";'."\n"; +print ' $.get("'.dol_buildpath('/core/ajax/extraparams.php', 1); +print '?id="+id+"&element="+element+"&htmlelement="+htmlelement+"&type="+type+"&value="+status);'."\n"; +print '}'."\n"; -
+print '});'."\n"; +print ''."\n"; - +print '
'.img_picto('', '1uparrow.png').'
'."\n"; +print '
'.img_picto('', '1downarrow.png').'
'."\n"; +print '
'.$title.'
'."\n"; +print '
'."\n"; -
-
- - \ No newline at end of file +include DOL_DOCUMENT_ROOT.'/core/tpl/'.$blocname.'.tpl.php'; +print '

'; +?> + diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 7ecd7ba45fe..fcaa024e186 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -494,7 +494,7 @@ if ($resql) if (! GETPOST('cancel')) { - $objecttmp=new FactureFourn($db); + $objecttmp=new FactureFournisseur($db); $listofselectedid=array(); $listofselectedthirdparties=array(); $listofselectedref=array(); diff --git a/htdocs/index.php b/htdocs/index.php index 187273ef2b4..cb4db301bcc 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -448,7 +448,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) } // Number of supplier invoices (has paid) -if (! empty($conf->supplier_invoice->enabled) && ! empty($conf->facture->enabled) && $user->rights->facture->lire) +if (! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board=new FactureFournisseur($db); diff --git a/htdocs/install/mysql/tables/llx_extrafields.sql b/htdocs/install/mysql/tables/llx_extrafields.sql index aee51524e6f..101254ea186 100644 --- a/htdocs/install/mysql/tables/llx_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_extrafields.sql @@ -37,5 +37,9 @@ create table llx_extrafields param text, -- extra parameters to define possible values of field list integer DEFAULT 0, -- list of values for field that are combo lists langs varchar(24), -- example: fileofmymodule@mymodule - ishidden integer DEFAULT 0 -- ??? example of use case ??? + ishidden integer DEFAULT 0, -- Can be foreign key of external system + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + datec datetime, -- date de creation + tms timestamp )ENGINE=innodb; diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 06ef2ed41e3..e5b9d47a0ba 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -165,6 +165,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup_extrafield CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_price_by_qty FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -- Add triggers for timestamp fields named date_m diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index fc1c41895a4..a8d068cfd7d 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -160,10 +160,6 @@ else if (defined('DOLENTITY') && is_numeric(DOLENTITY)) // For public page wit { $conf->entity = DOLENTITY; } -else if (!empty($_COOKIE['DOLENTITY'])) // For other application with MultiCompany module (TODO: We should remove this. entity to use should never be stored into client side) -{ - $conf->entity = $_COOKIE['DOLENTITY']; -} // Sanitize entity if (! is_numeric($conf->entity)) $conf->entity=1; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0a6c9052b91..318d19e10b3 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -990,11 +990,11 @@ else // Stock min level if ($type != 1 && ! empty($conf->stock->enabled)) { - print ''.$langs->trans("StockLimit").''; + print ''.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).''; print ''; print ''; // Stock desired level - print ''.$langs->trans("DesiredStock").''; + print ''.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).''; print ''; print ''; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 1daff124764..db462411fe7 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -614,7 +614,7 @@ if ($id > 0 || $ref) } // Stock alert threshold - print ''.$form->editfieldkey("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).''; + print ''.$form->editfieldkey($form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1),'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).''; print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string'); print ''; diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 37ff691fdcc..4421c6d6298 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -50,13 +50,6 @@ if ($result < 0) { $error++; } // Define url to go after disconnect $urlfrom=empty($_SESSION["urlfrom"])?'':$_SESSION["urlfrom"]; -// Destroy some cookies -// TODO external module -if (! empty($conf->phenix->enabled) && ! empty($conf->phenix->cookie)) -{ - setcookie($conf->phenix->cookie, '', 1, "/"); -} - // Define url to go $url=DOL_URL_ROOT."/index.php"; // By default go to login page if ($urlfrom) $url=DOL_URL_ROOT.$urlfrom;