Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
e35a9747c9
@ -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();
|
||||
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -167,7 +167,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$texte.=$file['name'].'<br>';
|
||||
}
|
||||
$texte.='<div id="div_'.get_class($this).'">';
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE BLOC SHOW/HIDE -->
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#hide-<?php echo $blocname ?>").click(function(){
|
||||
setShowHide(0);
|
||||
$("#<?php echo $blocname ?>_bloc").hide("blind", {direction: "vertical"}, 300).removeClass("nohideobject");
|
||||
$(this).hide();
|
||||
$("#show-<?php echo $blocname ?>").show();
|
||||
});
|
||||
$("#show-<?php echo $blocname ?>").click(function(){
|
||||
setShowHide(1);
|
||||
$("#<?php echo $blocname ?>_bloc").show("blind", {direction: "vertical"}, 300).addClass("nohideobject");
|
||||
$(this).hide();
|
||||
$("#hide-<?php echo $blocname ?>").show();
|
||||
});
|
||||
function setShowHide(status) {
|
||||
var id = <?php echo $object->id; ?>;
|
||||
var element = '<?php echo $object->element; ?>';
|
||||
var htmlelement = '<?php echo $blocname ?>';
|
||||
var type = 'showhide';
|
||||
<?php
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print '$(document).ready(function() {'."\n";
|
||||
print '$("#hide-'.$blocname.'").click(function(){'."\n";
|
||||
print ' setShowHide(0);'."\n";
|
||||
print ' $("#'.$blocname.'_bloc").hide("blind", {direction: "vertical"}, 300).removeClass("nohideobject");'."\n";
|
||||
print ' $(this).hide();'."\n";
|
||||
print ' $("#show-'.$blocname.'").show();'."\n";
|
||||
print '});'."\n";
|
||||
|
||||
$.get("<?php echo dol_buildpath('/core/ajax/extraparams.php', 1); ?>?id="+id+"&element="+element+"&htmlelement="+htmlelement+"&type="+type+"&value="+status);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
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";
|
||||
|
||||
<div style="float:right; position: relative; top: 3px; right:5px;" id="hide-<?php echo $blocname ?>" class="linkobject<?php echo ($hide ? ' hideobject' : ''); ?>"><?php echo img_picto('', '1uparrow.png'); ?></div>
|
||||
<div style="float:right; position: relative; top: 3px; right:5px;" id="show-<?php echo $blocname ?>" class="linkobject<?php echo ($hide ? '' : ' hideobject'); ?>"><?php echo img_picto('', '1downarrow.png'); ?></div>
|
||||
<div id="<?php echo $blocname ?>_title" class="liste_titre"><?php echo $title; ?></div>
|
||||
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";
|
||||
|
||||
<div id="<?php echo $blocname ?>_bloc" class="<?php echo ($hide ? 'hideobject' : 'nohideobject'); ?>">
|
||||
print '});'."\n";
|
||||
print '</script>'."\n";
|
||||
|
||||
<?php include DOL_DOCUMENT_ROOT.'/core/tpl/'.$blocname.'.tpl.php'; ?>
|
||||
print '<div style="float:right; position: relative; top: 3px; right:5px;" id="hide-'.$blocname.'"';
|
||||
print ' class="linkobject'.($hide ? ' hideobject' : '').'">'.img_picto('', '1uparrow.png').'</div>'."\n";
|
||||
print '<div style="float:right; position: relative; top: 3px; right:5px;" id="show-'.$blocname.'"';
|
||||
print ' class="linkobject'.($hide ? '' : ' hideobject').'">'.img_picto('', '1downarrow.png').'</div>'."\n";
|
||||
print '<div id="'.$blocname.'_title" class="liste_titre">'.$title.'</div>'."\n";
|
||||
print '<div id="'.$blocname.'_bloc" class="'.($hide ? 'hideobject' : 'nohideobject')'">'."\n";
|
||||
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- END PHP TEMPLATE BLOC SHOW/HIDE -->
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/'.$blocname.'.tpl.php';
|
||||
print '</div><br>';
|
||||
?>
|
||||
<!-- END PHP TEMPLATE BLOC SHOW/HIDE -->
|
||||
|
||||
@ -494,7 +494,7 @@ if ($resql)
|
||||
|
||||
if (! GETPOST('cancel'))
|
||||
{
|
||||
$objecttmp=new FactureFourn($db);
|
||||
$objecttmp=new FactureFournisseur($db);
|
||||
$listofselectedid=array();
|
||||
$listofselectedthirdparties=array();
|
||||
$listofselectedref=array();
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -990,11 +990,11 @@ else
|
||||
// Stock min level
|
||||
if ($type != 1 && ! empty($conf->stock->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).'</td><td>';
|
||||
print '<input name="seuil_stock_alerte" class="maxwidth50" value="'.GETPOST('seuil_stock_alerte').'">';
|
||||
print '</td>';
|
||||
// Stock desired level
|
||||
print '<td>'.$langs->trans("DesiredStock").'</td><td>';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).'</td><td>';
|
||||
print '<input name="desiredstock" class="maxwidth50" value="'.GETPOST('desiredstock').'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -614,7 +614,7 @@ if ($id > 0 || $ref)
|
||||
}
|
||||
|
||||
// Stock alert threshold
|
||||
print '<tr><td>'.$form->editfieldkey("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).'</td><td>';
|
||||
print '<tr><td>'.$form->editfieldkey($form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1),'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).'</td><td>';
|
||||
print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user