Fix from scrutinizer
This commit is contained in:
parent
7c9993ef0e
commit
d12019d1b5
@ -85,12 +85,12 @@ if ($action == 'lettering') {
|
|||||||
|
|
||||||
if ($action == 'autolettrage') {
|
if ($action == 'autolettrage') {
|
||||||
|
|
||||||
$result = $BookKeeping->LettrageTiers($socid);
|
$result = $BookKeeping->lettrageTiers($socid);
|
||||||
|
|
||||||
if( $result < 0 ){
|
if( $result < 0 )
|
||||||
|
{
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||||
$error++;
|
$error++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,12 +86,12 @@ if ($action == 'lettering') {
|
|||||||
|
|
||||||
if ($action == 'autolettrage') {
|
if ($action == 'autolettrage') {
|
||||||
|
|
||||||
$result = $BookKeeping->LettrageTiers($socid);
|
$result = $BookKeeping->lettrageTiers($socid);
|
||||||
|
|
||||||
if( $result < 0 ){
|
if ( $result < 0 )
|
||||||
|
{
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||||
$error++;
|
$error++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class lettering extends BookKeeping
|
|||||||
* lettrageTiers
|
* lettrageTiers
|
||||||
*
|
*
|
||||||
* @param int $socid Thirdparty id
|
* @param int $socid Thirdparty id
|
||||||
* @return void
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function lettrageTiers($socid) {
|
public function lettrageTiers($socid) {
|
||||||
|
|
||||||
@ -229,13 +229,15 @@ class lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function updatelettrage($ids, $notrigger=false){
|
public function updatelettrage($ids, $notrigger=false){
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
$lettre='';
|
||||||
|
|
||||||
$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1; ";
|
$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1; ";
|
||||||
// echo $sql;
|
// echo $sql;
|
||||||
@ -252,15 +254,17 @@ class lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
// var_dump(__line__, $error);
|
// var_dump(__line__, $error);
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
$sql .= " rowid IN (".implode(',', $ids).") ";
|
$sql .= " rowid IN (".implode(',', $ids).") ";
|
||||||
$result = $this->db->query ( $sql );
|
$result = $this->db->query ( $sql );
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object ( $result );
|
$obj = $this->db->fetch_object ( $result );
|
||||||
// print_r($obj);
|
// print_r($obj);
|
||||||
if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
|
if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
|
||||||
// echo $sql;
|
// echo $sql;
|
||||||
// print_r($obj);
|
// print_r($obj);
|
||||||
$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
|
$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -269,21 +273,22 @@ class lettering extends BookKeeping
|
|||||||
$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
|
$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update request
|
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
||||||
$sql.= " lettering_code='".$lettre."'";
|
$sql.= " lettering_code='".$lettre."'";
|
||||||
$sql.= " , date_lettering = " .$now ; // todo correct date it's false
|
$sql.= " , date_lettering = " .$now ; // todo correct date it's false
|
||||||
$sql.= " WHERE rowid IN (".implode(',', $ids).") ";
|
$sql.= " WHERE rowid IN (".implode(',', $ids).") ";
|
||||||
// echo $sql ;
|
// echo $sql ;
|
||||||
//
|
//
|
||||||
// var_dump(__line__, $error);
|
// var_dump(__line__, $error);
|
||||||
// print_r($this->errors);
|
// print_r($this->errors);
|
||||||
// exit;
|
// exit;
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||||
@ -306,6 +311,7 @@ class lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// var_dump(__line__, $error);
|
// var_dump(__line__, $error);
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
@ -325,6 +331,8 @@ class lettering extends BookKeeping
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -230,6 +230,8 @@ class AdherentType extends CommonObject
|
|||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
|||||||
@ -26,17 +26,19 @@ include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class
|
|||||||
class Dolistore
|
class Dolistore
|
||||||
{
|
{
|
||||||
// params
|
// params
|
||||||
public $start // beginning of pagination
|
public $start; // beginning of pagination
|
||||||
, $end // end of pagination
|
public $end; // end of pagination
|
||||||
, $per_page // pagination: display per page
|
public $per_page; // pagination: display per page
|
||||||
, $categorie // the current categorie
|
public $categorie; // the current categorie
|
||||||
, $search // the search keywords
|
public $search; // the search keywords
|
||||||
|
|
||||||
// setups
|
// setups
|
||||||
, $url // the url of this page
|
public $url; // the url of this page
|
||||||
, $shop_url // the url of the shop
|
public $shop_url; // the url of the shop
|
||||||
, $vat_rate // the vat rate used in the shop (prices are provided without vat)
|
public $vat_rate; // the vat rate used in the shop (prices are provided without vat)
|
||||||
, $lang // the integer representing the lang in the store
|
public $lang; // the integer representing the lang in the store
|
||||||
, $debug_api; // usefull if no dialog
|
public $debug_api; // usefull if no dialog
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|||||||
@ -1581,7 +1581,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||||
$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
|
$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
|
||||||
$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town)?' ':''.$row_town)), array(CHR(13) => ", ", CHR(10) => ""));
|
$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town)?' ':''.$row_town), array(CHR(13) => ", ", CHR(10) => "")));
|
||||||
if (trim($addressline1)) $XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1,70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
if (trim($addressline1)) $XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1,70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
||||||
if (trim($addressline2)) $XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2,70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
if (trim($addressline2)) $XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2,70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
||||||
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
||||||
|
|||||||
@ -223,11 +223,9 @@ class EmailSenderProfile extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load object lines in memory from the database
|
* Load object lines in memory from the database
|
||||||
*
|
*
|
||||||
* @param int $id Id object
|
|
||||||
* @param string $ref Ref
|
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchLines($id, $ref = null)
|
public function fetchLines()
|
||||||
{
|
{
|
||||||
$this->lines=array();
|
$this->lines=array();
|
||||||
|
|
||||||
@ -257,7 +255,7 @@ class EmailSenderProfile extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function delete(User $user, $notrigger = false)
|
public function delete(User $user, $notrigger = false)
|
||||||
{
|
{
|
||||||
return $this->deleteCommon($user, $trigger);
|
return $this->deleteCommon($user, $notrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -272,8 +270,6 @@ class EmailSenderProfile extends CommonObject
|
|||||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
global $menumanager;
|
global $menumanager;
|
||||||
|
|
||||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
$companylink = '';
|
$companylink = '';
|
||||||
|
|
||||||
@ -285,7 +281,7 @@ class EmailSenderProfile extends CommonObject
|
|||||||
|
|
||||||
if ($withpicto)
|
if ($withpicto)
|
||||||
{
|
{
|
||||||
$result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
$result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
|
||||||
if ($withpicto != 2) $result.=' ';
|
if ($withpicto != 2) $result.=' ';
|
||||||
}
|
}
|
||||||
$result.= $linkstart . $this->label . $linkend;
|
$result.= $linkstart . $this->label . $linkend;
|
||||||
|
|||||||
@ -480,7 +480,7 @@ class FormMail extends Form
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($this->db);
|
||||||
|
|
||||||
foreach($listaliases as $typealias => $listalias)
|
foreach($listaliases as $typealias => $listalias)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -35,13 +35,13 @@ class ExpenseReportRule extends CoreObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* date start
|
* date start
|
||||||
* @var date
|
* @var int|string
|
||||||
*/
|
*/
|
||||||
public $dates;
|
public $dates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* date end
|
* date end
|
||||||
* @var date
|
* @var int|string
|
||||||
*/
|
*/
|
||||||
public $datee;
|
public $datee;
|
||||||
|
|
||||||
|
|||||||
@ -228,11 +228,9 @@ class MyObject extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load object lines in memory from the database
|
* Load object lines in memory from the database
|
||||||
*
|
*
|
||||||
* @param int $id Id object
|
|
||||||
* @param string $ref Ref
|
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchLines($id, $ref = null)
|
public function fetchLines()
|
||||||
{
|
{
|
||||||
$this->lines=array();
|
$this->lines=array();
|
||||||
|
|
||||||
@ -262,7 +260,7 @@ class MyObject extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function delete(User $user, $notrigger = false)
|
public function delete(User $user, $notrigger = false)
|
||||||
{
|
{
|
||||||
return $this->deleteCommon($user, $trigger);
|
return $this->deleteCommon($user, $notrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user