Fix: Too many parameter
Fix: Can't delete bank account
This commit is contained in:
parent
bb8ec0c8f9
commit
605919be76
@ -35,6 +35,7 @@ $langs->load("bills");
|
|||||||
|
|
||||||
$action=GETPOST('action');
|
$action=GETPOST('action');
|
||||||
$id=GETPOST('id');
|
$id=GETPOST('id');
|
||||||
|
$ref=GETPOST('ref');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (isset($_GET["id"]) || isset($_GET["ref"]))
|
if (isset($_GET["id"]) || isset($_GET["ref"]))
|
||||||
@ -89,7 +90,8 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->
|
|||||||
{
|
{
|
||||||
// Modification
|
// Modification
|
||||||
$account = new Account($db);
|
$account = new Account($db);
|
||||||
$account->delete($_GET["id"]);
|
$account->fetch($id);
|
||||||
|
$account->delete();
|
||||||
|
|
||||||
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
|
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -326,35 +326,32 @@ class Localtax extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function localtax_sum_collectee($year = 0)
|
function localtax_sum_collectee($year = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "SELECT sum(f.localtax) as amount";
|
$sql = "SELECT sum(f.localtax) as amount";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1";
|
||||||
|
|
||||||
if ($year)
|
if ($year)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' ";
|
$sql .= " AND f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows($result))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
return $obj->amount;
|
$ret = $obj->amount;
|
||||||
|
$this->db->free($result);
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
$this->db->free($result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($result);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,31 +367,30 @@ class Localtax extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT sum(f.total_localtax) as total_localtax";
|
$sql = "SELECT sum(f.total_localtax) as total_localtax";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
|
|
||||||
if ($year)
|
if ($year)
|
||||||
{
|
{
|
||||||
$sql .= " WHERE f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' ";
|
$sql .= " WHERE f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' ";
|
||||||
}
|
}
|
||||||
$result = $this->db->query($sql);
|
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows($result))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
return $obj->total_localtax;
|
$ret = $obj->total_localtax;
|
||||||
|
$this->db->free($result);
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
$this->db->free($result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -412,32 +408,30 @@ class Localtax extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT sum(f.amount) as amount";
|
$sql = "SELECT sum(f.amount) as amount";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."localtax as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."localtax as f";
|
||||||
|
|
||||||
if ($year)
|
if ($year)
|
||||||
{
|
{
|
||||||
$sql .= " WHERE f.datev >= '$year-01-01' AND f.datev <= '$year-12-31' ";
|
$sql .= " WHERE f.datev >= '$year-01-01' AND f.datev <= '$year-12-31' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows($result))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
return $obj->amount;
|
$ret = $obj->amount;
|
||||||
|
$this->db->free($result);
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
$this->db->free($result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -543,14 +537,14 @@ class Localtax extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -353,32 +353,30 @@ class Tva extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT sum(f.tva) as amount";
|
$sql = "SELECT sum(f.tva) as amount";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1";
|
||||||
|
|
||||||
if ($year)
|
if ($year)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.datef >= '".$year."-01-01' AND f.datef <= '".$year."-12-31' ";
|
$sql .= " AND f.datef >= '".$year."-01-01' AND f.datef <= '".$year."-12-31' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows($result))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
return $obj->amount;
|
$ret = $obj->amount;
|
||||||
|
$this->db->free($result);
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
$this->db->free($result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($result);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,31 +392,30 @@ class Tva extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT sum(f.total_tva) as total_tva";
|
$sql = "SELECT sum(f.total_tva) as total_tva";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
|
|
||||||
if ($year)
|
if ($year)
|
||||||
{
|
{
|
||||||
$sql .= " WHERE f.datef >= '".$year."-01-01' AND f.datef <= '".$year."-12-31' ";
|
$sql .= " WHERE f.datef >= '".$year."-01-01' AND f.datef <= '".$year."-12-31' ";
|
||||||
}
|
}
|
||||||
$result = $this->db->query($sql);
|
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows($result))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
return $obj->total_tva;
|
$ret = $obj->total_tva;
|
||||||
|
$this->db->free($result);
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
$this->db->free($result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -442,25 +439,24 @@ class Tva extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows($result))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
return $obj->amount;
|
$ret = $obj->amount;
|
||||||
|
$this->db->free($result);
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
$this->db->free($result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ if ($action == 'setstocklimit')
|
|||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$result=$product->fetch($id);
|
$result=$product->fetch($id);
|
||||||
$product->seuil_stock_alerte=$stocklimit;
|
$product->seuil_stock_alerte=$stocklimit;
|
||||||
$result=$product->update($product->id,$user,1,0,1);
|
$result=$product->update($product->id,$user,0,'update');
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessage($product->error, 'errors');
|
setEventMessage($product->error, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
@ -80,7 +80,7 @@ if ($action == 'setdesiredstock')
|
|||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$result=$product->fetch($id);
|
$result=$product->fetch($id);
|
||||||
$product->desiredstock=$desiredstock;
|
$product->desiredstock=$desiredstock;
|
||||||
$result=$product->update($product->id,$user,1,0,1);
|
$result=$product->update($product->id,$user,0,'update');
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessage($product->error, 'errors');
|
setEventMessage($product->error, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
|
|||||||
@ -279,6 +279,7 @@ if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivat
|
|||||||
if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'<br><br>'."\n";
|
if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'<br><br>'."\n";
|
||||||
|
|
||||||
// For multicompany transversal mode
|
// For multicompany transversal mode
|
||||||
|
// TODO Place a hook here
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
||||||
{
|
{
|
||||||
$aEntities=array_keys($permsgroupbyentity);
|
$aEntities=array_keys($permsgroupbyentity);
|
||||||
@ -422,6 +423,12 @@ if ($result)
|
|||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
// For multicompany transversal mode
|
||||||
|
// TODO Place a hook here
|
||||||
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
||||||
|
{
|
||||||
|
dol_fiche_end();
|
||||||
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user