Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
9a3c7a230b
@ -63,7 +63,7 @@ class Categorie
|
|||||||
* Load category into memory from database
|
* Load category into memory from database
|
||||||
*
|
*
|
||||||
* @param int $id Id of category
|
* @param int $id Id of category
|
||||||
* @param strin $label Label of category
|
* @param string $label Label of category
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id,$label='')
|
function fetch($id,$label='')
|
||||||
@ -85,6 +85,8 @@ class Categorie
|
|||||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($resql) > 0)
|
||||||
{
|
{
|
||||||
$res = $this->db->fetch_array($resql);
|
$res = $this->db->fetch_array($resql);
|
||||||
|
|
||||||
@ -102,6 +104,11 @@ class Categorie
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -446,12 +446,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.type, ';
|
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.type, ';
|
||||||
$sql.= ' f.datef as df';
|
$sql.= ' f.datef as df';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||||
$sql.= ' WHERE f.fk_soc = '.$facture->socid;
|
$sql.= ' WHERE f.entity = '.$conf->entity;
|
||||||
|
$sql.= ' AND f.fk_soc = '.$facture->socid;
|
||||||
$sql.= ' AND f.paye = 0';
|
$sql.= ' AND f.paye = 0';
|
||||||
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
||||||
if ($facture->type != 2)
|
if ($facture->type != 2)
|
||||||
{
|
{
|
||||||
$sql .= ' AND type in (0,1,3)'; // Standard invoice, replacement, deposit
|
$sql .= ' AND type IN (0,1,3)'; // Standard invoice, replacement, deposit
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,8 +36,7 @@ $action=GETPOST("action");
|
|||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', $langs->trans("SocialContribution"), '', 'charges');
|
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -262,8 +262,12 @@ class ChargeSociales extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function solde($year = 0)
|
function solde($year = 0)
|
||||||
{
|
{
|
||||||
$sql = "SELECT sum(f.amount) as amount";
|
global $conf;
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f WHERE paye = 0";
|
|
||||||
|
$sql = "SELECT SUM(f.amount) as amount";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
|
||||||
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND paye = 0";
|
||||||
|
|
||||||
if ($year) {
|
if ($year) {
|
||||||
$sql .= " AND f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' ";
|
$sql .= " AND f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' ";
|
||||||
@ -300,8 +304,8 @@ class ChargeSociales extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function set_paid($user)
|
function set_paid($user)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
|
||||||
$sql.= " set paye=1";
|
$sql.= " paye = 1";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
$return = $this->db->query($sql);
|
$return = $this->db->query($sql);
|
||||||
if ($return) return 1;
|
if ($return) return 1;
|
||||||
@ -397,12 +401,14 @@ class ChargeSociales extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getSommePaiement()
|
function getSommePaiement()
|
||||||
{
|
{
|
||||||
$table='paiementcharge';
|
global $conf;
|
||||||
$field='fk_charge';
|
|
||||||
|
|
||||||
$sql = 'SELECT sum(amount) as amount';
|
$sql = 'SELECT SUM(amount) as amount';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$table;
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pc';
|
||||||
$sql.= ' WHERE '.$field.' = '.$this->id;
|
$sql.= ', '.MAIN_DB_PREFIX.'chargesociales as c';
|
||||||
|
$sql.= ' WHERE c.entity = '.$conf->entity;
|
||||||
|
$sql.= ' AND pc.fk_charge = c.rowid';
|
||||||
|
$sql.= ' AND pc.fk_charge = '.$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getSommePaiement sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::getSommePaiement sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ $action=GETPOST("action");
|
|||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', $langs->trans("SocialContribution"), '', 'charges');
|
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -264,6 +264,8 @@ class Entrepot extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($result) > 0)
|
||||||
{
|
{
|
||||||
$obj=$this->db->fetch_object($result);
|
$obj=$this->db->fetch_object($result);
|
||||||
|
|
||||||
@ -291,6 +293,11 @@ class Entrepot extends CommonObject
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user