Merge branch 'Upstream/develop'
This commit is contained in:
commit
9eaeaae2fb
10
.travis.yml
10
.travis.yml
@ -91,15 +91,17 @@ script:
|
||||
- php upgrade2.php 3.4.0 3.5.0 > upgrade2.log
|
||||
- php upgrade.php 3.5.0 3.6.0 >> upgrade.log
|
||||
- php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log
|
||||
- cd ../..
|
||||
- php upgrade.php 3.6.0 3.7.0 >> upgrade.log
|
||||
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log
|
||||
# - cat upgrade.log
|
||||
# - cat upgrade2.log
|
||||
- cd ../..
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php
|
||||
# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php
|
||||
- phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php
|
||||
- phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs -p --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
|
||||
after_script:
|
||||
|
||||
17
ChangeLog
17
ChangeLog
@ -9,13 +9,27 @@ For users:
|
||||
- New: Can create proposal from an intervention.
|
||||
- New: Can filter events on a group of users.
|
||||
- New: Add thirdparty to filter on events.
|
||||
- New: Form to add a photo is immediatly available on photo page if
|
||||
permissions are ok (save one click per photo to add).
|
||||
- New: Add option PRODUCT_MAX_VISIBLE_PHOTO to limit number of photos
|
||||
shown on main product card.
|
||||
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
|
||||
- Fix: [ bug #1470, #1472, #1473] User trigger problem
|
||||
- Fix: [ bug #1489, #1491 ] Intervention trigger problem
|
||||
- Fix: [ bug #1492, #1493 ] Member trigger problem
|
||||
- Fix: [ bug #1474, #1475 ] Contract trigger problem
|
||||
- Fix: [ bug #1496 ] ACTION_DELETE trigger does not show trigger error
|
||||
- Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action
|
||||
- Fix: [ bug #1502 ] DON_CREATE trigger does not intercept trigger action
|
||||
- Fix: [ bug #1505, #1504] Project trigger problem
|
||||
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
|
||||
For developers:
|
||||
- New: Add hook "searchAgendaFrom".
|
||||
- New: Add trigger DON_UPDATE, DON_DELETE
|
||||
|
||||
|
||||
***** ChangeLog for 3.6 compared to 3.5.* *****
|
||||
@ -87,6 +101,8 @@ For users:
|
||||
- Fix: [ bug #1478 ] BILL_PAYED trigger action does not intercept failure under some circumstances
|
||||
- Fix: [ bug #1479 ] Several customer invoice triggers do not intercept trigger action
|
||||
- Fix: [ bug #1477 ] Several customer invoice triggers do not show trigger error messages
|
||||
- Fix: [ bug #1471 ] Several PHP warnings when intercepting USER_CREATE trigger.
|
||||
- Fix: [ bug #1517 ] Packages sizes.
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
@ -128,6 +144,7 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
|
||||
|
||||
|
||||
***** ChangeLog for 3.5.4 compared to 3.5.3 *****
|
||||
Fix: Hide title of event when agenda module disabled.
|
||||
Fix: When using option MAIN_MAIL_ALLOW_SENDMAIL_F, a mail was sent to sender.
|
||||
Fix: Question about warehouse must not be done when module stock is disabled.
|
||||
Fix: Option STOCK_SUPPORTS_SERVICES was not correctly implemented
|
||||
|
||||
@ -91,7 +91,7 @@ class Skeleton_Class extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -105,10 +105,8 @@ class Skeleton_Class extends CommonObject
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
@ -149,7 +147,7 @@ class Skeleton_Class extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch");
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -169,7 +167,6 @@ class Skeleton_Class extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -204,7 +201,7 @@ class Skeleton_Class extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update");
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -216,12 +213,10 @@ class Skeleton_Class extends CommonObject
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@ -264,12 +259,10 @@ class Skeleton_Class extends CommonObject
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,7 +271,7 @@ class Skeleton_Class extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete");
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ if ($action == 'list')
|
||||
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
print '</tr>';
|
||||
|
||||
dol_syslog($script_file." sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog($script_file, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -119,7 +119,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."skeleton";
|
||||
$sql.= " WHERE field3 = 'xxx'";
|
||||
$sql.= " ORDER BY field1 ASC";
|
||||
|
||||
dol_syslog($script_file." sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog($script_file, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -307,7 +307,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
|
||||
$sql ="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid;
|
||||
$sql.=" WHERE rowid=".$crowid;
|
||||
|
||||
dol_syslog("card_subscriptions::cotisation sql=".$sql);
|
||||
dol_syslog("card_subscriptions::cotisation", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -454,8 +454,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
|
||||
// Update fk_bank into subscription table
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'cotisation SET fk_bank='.$bank_line_id;
|
||||
$sql.= ' WHERE rowid='.$crowid;
|
||||
dol_syslog('sql='.$sql);
|
||||
$result = $db->query($sql);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
|
||||
@ -72,7 +72,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
|
||||
$sql.= " ORDER BY d.rowid ASC";
|
||||
|
||||
dol_syslog("Search members sql=".$sql);
|
||||
dol_syslog("Search members", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -310,7 +310,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", ".(! empty($this->import_key) ? "'".$this->import_key."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -335,7 +335,7 @@ class Adherent extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
|
||||
$sql.= " fk_member = '".$this->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->user_id;
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -347,12 +347,10 @@ class Adherent extends CommonObject
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (count($this->errors))
|
||||
@ -378,7 +376,6 @@ class Adherent extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -455,7 +452,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", fk_user_mod=".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update update member sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update update member", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -501,14 +498,14 @@ class Adherent extends CommonObject
|
||||
{
|
||||
dol_syslog(get_class($this)."::update update link to user");
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id;
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; }
|
||||
// If there is a user linked to this member
|
||||
if ($this->user_id > 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id." WHERE rowid = ".$this->user_id;
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; }
|
||||
}
|
||||
@ -599,12 +596,10 @@ class Adherent extends CommonObject
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_MODIFY',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,7 +618,6 @@ class Adherent extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::Update ".$this->error,LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -650,7 +644,7 @@ class Adherent extends CommonObject
|
||||
$sql.= " WHERE fk_adherent='".$this->id."'";
|
||||
$sql.= " ORDER by dateadh DESC"; // Sort by start subscription date
|
||||
|
||||
dol_syslog(get_class($this)."::update_end_date sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -663,7 +657,7 @@ class Adherent extends CommonObject
|
||||
$sql.= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null");
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_end_date sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -683,7 +677,6 @@ class Adherent extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update_end_date ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -711,14 +704,13 @@ class Adherent extends CommonObject
|
||||
|
||||
// Remove category
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error .= $this->db->lasterror();
|
||||
$errorflag=-1;
|
||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||
|
||||
}
|
||||
|
||||
@ -726,14 +718,13 @@ class Adherent extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE fk_adherent = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error .= $this->db->lasterror();
|
||||
$errorflag=-2;
|
||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -746,7 +737,6 @@ class Adherent extends CommonObject
|
||||
$error++;
|
||||
$this->error .= $this->db->lasterror();
|
||||
$errorflag=-3;
|
||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -769,25 +759,22 @@ class Adherent extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error .= $this->db->lasterror();
|
||||
$errorflag=-5;
|
||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {$error++; $this->errors=$interface->errors;}
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_DELETE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
|
||||
@ -841,12 +828,14 @@ class Adherent extends CommonObject
|
||||
$password_indatabase = $password;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
//dol_syslog("Adherent::Password sql=hidden");
|
||||
dol_syslog(get_class($this)."::setPassword sql=".$sql);
|
||||
dol_syslog(get_class($this)."::setPassword", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -885,23 +874,24 @@ class Adherent extends CommonObject
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_NEW_PASSWORD',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_NEW_PASSWORD',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return $this->pass;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
@ -922,7 +912,7 @@ class Adherent extends CommonObject
|
||||
|
||||
// If user is linked to this member, remove old link to this member
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id;
|
||||
dol_syslog(get_class($this)."::setUserId sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setUserId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -1; }
|
||||
|
||||
@ -931,7 +921,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id;
|
||||
$sql.= " WHERE rowid = ".$userid;
|
||||
dol_syslog(get_class($this)."::setUserId sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setUserId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -2; }
|
||||
}
|
||||
@ -960,7 +950,7 @@ class Adherent extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = null";
|
||||
$sql.= " WHERE fk_soc = '".$thirdpartyid."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
dol_syslog(get_class($this)."::setThirdPartyId sql=".$sql);
|
||||
dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
}
|
||||
|
||||
@ -968,7 +958,7 @@ class Adherent extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = ".($thirdpartyid>0 ? $thirdpartyid : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setThirdPartyId sql=".$sql);
|
||||
dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -978,7 +968,6 @@ class Adherent extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::setThirdPartyId ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1088,7 +1077,7 @@ class Adherent extends CommonObject
|
||||
$sql.= " AND d.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1169,7 +1158,6 @@ class Adherent extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1198,7 +1186,7 @@ class Adherent extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cotisation as c";
|
||||
$sql.= " WHERE c.fk_adherent = ".$this->id;
|
||||
$sql.= " ORDER BY c.dateadh";
|
||||
dol_syslog(get_class($this)."::fetch_subscriptions sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch_subscriptions", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1301,12 +1289,10 @@ class Adherent extends CommonObject
|
||||
$this->last_subscription_date_start=$date;
|
||||
$this->last_subscription_date_end=$datefin;
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_SUBSCRIPTION',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -1356,18 +1342,16 @@ class Adherent extends CommonObject
|
||||
$sql.= ", fk_user_valid=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::validate sql=".$sql);
|
||||
dol_syslog(get_class($this)."::validate", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->statut=1;
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_VALIDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_VALIDATE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -1412,12 +1396,10 @@ class Adherent extends CommonObject
|
||||
{
|
||||
$this->statut=0;
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_RESILIATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_RESILIATE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -1902,7 +1884,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'adherent as a';
|
||||
$sql.= ' WHERE a.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this)."::info sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -76,7 +76,7 @@ class AdherentType extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("Adherent_type::create sql=".$sql);
|
||||
dol_syslog("Adherent_type::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -188,7 +188,7 @@ class AdherentType extends CommonObject
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".$rowid;
|
||||
|
||||
dol_syslog("Adherent_type::fetch sql=".$sql);
|
||||
dol_syslog("Adherent_type::fetch", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -211,7 +211,6 @@ class AdherentType extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Adherent_type::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ class Cotisation extends CommonObject
|
||||
$sql.= " '".$this->db->idate($this->datef)."',";
|
||||
$sql.= " ".$this->amount.",'".$this->db->escape($this->note)."')";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -91,7 +91,6 @@ class Cotisation extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -113,7 +112,7 @@ class Cotisation extends CommonObject
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."cotisation";
|
||||
$sql.=" WHERE rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -168,7 +167,7 @@ class Cotisation extends CommonObject
|
||||
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null');
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -183,7 +182,6 @@ class Cotisation extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -207,7 +205,7 @@ class Cotisation extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid = ".$this->id;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -68,7 +68,7 @@ $sql.= " AND d.entity IN (".getEntity().")";
|
||||
$sql.= " WHERE t.entity IN (".getEntity().")";
|
||||
$sql.= " GROUP BY t.rowid, t.libelle, t.cotisation, d.statut";
|
||||
|
||||
dol_syslog("index.php::select nb of members by type sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("index.php::select nb of members by type", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -106,7 +106,7 @@ $sql.= " AND d.statut = 1 AND d.datefin >= '".$db->idate($now)."'";
|
||||
$sql.= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql.= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -158,7 +158,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
dol_syslog("get list sql=".$sql);
|
||||
dol_syslog("get list", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -74,7 +74,7 @@ $sql.=" GROUP BY d.morphy";
|
||||
$foundphy=$foundmor=0;
|
||||
|
||||
// Define $data array
|
||||
dol_syslog("Count member sql=".$sql);
|
||||
dol_syslog("Count member", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -138,7 +138,7 @@ if ($mode)
|
||||
//print $langsen->trans("Country"."FI");exit;
|
||||
|
||||
// Define $data array
|
||||
dol_syslog("Count member sql=".$sql);
|
||||
dol_syslog("Count member", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -203,7 +203,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY code";
|
||||
|
||||
dol_syslog("admin/barcode.php sql=".$sql);
|
||||
dol_syslog("admin/barcode.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -66,7 +66,7 @@ if ($action == 'add')
|
||||
$sql.= " WHERE param = 'MAIN_BOXES_".$db->escape(GETPOST("pos","alpha"))."' AND value = '1'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
dol_syslog("boxes.php search fk_user to activate box for sql=".$sql);
|
||||
dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
@ -93,7 +93,7 @@ if ($action == 'add')
|
||||
{
|
||||
$nbboxonleft=$nbboxonright=0;
|
||||
$sql = "SELECT box_order FROM ".MAIN_DB_PREFIX."boxes WHERE position = ".GETPOST("pos","alpha")." AND fk_user = ".$fk_user." AND entity = ".$conf->entity;
|
||||
dol_syslog("boxes.php activate box sql=".$sql);
|
||||
dol_syslog("boxes.php activate box", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -112,7 +112,7 @@ if ($action == 'add')
|
||||
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("boxes.php activate box sql=".$sql);
|
||||
dol_syslog("boxes.php activate box", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -235,7 +235,7 @@ $sql.= " AND b.box_id = bd.rowid";
|
||||
$sql.= " AND b.fk_user=0";
|
||||
$sql.= " ORDER by b.position, b.box_order";
|
||||
|
||||
dol_syslog("Search available boxes sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Search available boxes", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -271,7 +271,7 @@ if ($resql)
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " AND LENGTH(box_order) <= 2";
|
||||
|
||||
dol_syslog("Execute requests to renumber box order sql=".$sql);
|
||||
dol_syslog("Execute requests to renumber box order", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -597,7 +597,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
|
||||
if(! isOnlyOneLocalTax(1))
|
||||
{
|
||||
print '<tr><td align="left">'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).': ';
|
||||
print '<tr><td align="left">'.$langs->trans("LTRate").': ';
|
||||
$formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
|
||||
}
|
||||
print '</td></tr>';
|
||||
@ -639,7 +639,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>";
|
||||
$example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
|
||||
print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
|
||||
print '<tr><td align="left">'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).': ';
|
||||
print '<tr><td align="left">'.$langs->transcountry("LTRate").': ';
|
||||
if(! isOnlyOneLocalTax(2))
|
||||
{
|
||||
$formcompany->select_localtax(2,$conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
|
||||
@ -1000,15 +1000,20 @@ else
|
||||
print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>";
|
||||
$example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
|
||||
print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
|
||||
if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0){
|
||||
print '<tr><td>'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
|
||||
if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
|
||||
}
|
||||
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0){
|
||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax1",$mysoc->country_code);
|
||||
}else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==1){
|
||||
}
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==1)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax2",$mysoc->country_code);
|
||||
}else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
|
||||
}
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
|
||||
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
||||
}
|
||||
|
||||
@ -1046,15 +1051,21 @@ else
|
||||
print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>";
|
||||
$example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
|
||||
print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
|
||||
if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0){
|
||||
print '<tr><td>'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
|
||||
if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
|
||||
}
|
||||
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0){
|
||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax1",$mysoc->country_code);
|
||||
}else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1){
|
||||
}
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax2",$mysoc->country_code);
|
||||
}else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2){
|
||||
}
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
||||
}
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ if (empty($user->entity) && $debug) {} // to force for superadmin
|
||||
elseif ($user->entity || empty($conf->multicompany->enabled)) $sql.= " AND visible = 1";
|
||||
$sql.= " ORDER BY entity, name ASC";
|
||||
|
||||
dol_syslog("Const::listConstant sql=".$sql);
|
||||
dol_syslog("Const::listConstant", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -528,7 +528,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
$sql.=",1)";
|
||||
|
||||
dol_syslog("actionadd sql=".$sql);
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
@ -576,7 +576,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
|
||||
dol_syslog("actionmodify sql=".$sql);
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
@ -599,7 +599,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||
|
||||
dol_syslog("delete sql=".$sql);
|
||||
dol_syslog("delete", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
@ -826,7 +826,7 @@ if ($id)
|
||||
print '</form>';
|
||||
|
||||
// List of available values in database
|
||||
dol_syslog("htdocs/admin/dict sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -229,7 +229,7 @@ $sql ="SELECT rowid, file, note FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||
$sql.=" WHERE file = 'box_external_rss.php'";
|
||||
$sql.=" ORDER BY note";
|
||||
|
||||
dol_syslog("select rss boxes sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog("select rss boxes", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -304,7 +304,6 @@ if ($conf->use_javascript_ajax)
|
||||
$sql.= " AND fk_menu >= 0";
|
||||
$sql.= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same)
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$res = $db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
|
||||
@ -178,13 +178,20 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300"> => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970,1,false).' (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')</td>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300"> => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970,1,true).' (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')</td>';
|
||||
// Parent company
|
||||
/*
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CompanyTZ").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300"> => '.$langs->trans("CompanyHour").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
|
||||
*/
|
||||
// Database timezone
|
||||
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("MySQLTimeZone").' (database)</td><td>'; // Timezone server base
|
||||
$sql="SHOW VARIABLES where variable_name = 'system_time_zone'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print $form->textwithtooltip($obj->Value,$langs->trans('TZHasNoEffect'),2,1,img_info(''));
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
// Client
|
||||
$var=!$var;
|
||||
$tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
|
||||
@ -372,4 +379,4 @@ print '</table>';
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -78,7 +78,7 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."events";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("listevents purge sql=".$sql);
|
||||
dol_syslog("listevents purge", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
|
||||
@ -126,7 +126,7 @@ if ($action == 'initbarcodeproducts')
|
||||
$sql.=$db->order("datec","ASC");
|
||||
$sql.=$db->plimit($maxperinit);
|
||||
|
||||
dol_syslog("codeinit sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("codeinit", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -65,7 +65,7 @@ class Bookmark
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("Bookmark::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Bookmark::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -123,7 +123,7 @@ class Bookmark
|
||||
if ($this->fk_soc) $sql.=",".$this->fk_soc;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("Bookmark::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Bookmark::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -173,7 +173,7 @@ class Bookmark
|
||||
$sql.= " ,position = '".$this->position."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("Bookmark::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Bookmark::update", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
@ -196,7 +196,7 @@ class Bookmark
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql .= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog("Bookmark::remove sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Bookmark::remove", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -103,7 +103,7 @@ class Facturation
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva";
|
||||
$sql.= " WHERE rowid = ".$this->tva();
|
||||
|
||||
dol_syslog("ajoutArticle sql=".$sql);
|
||||
dol_syslog("ajoutArticle", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@ -65,7 +65,7 @@ if ( GETPOST('filtre') ) {
|
||||
else $sql.= ")";
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
dol_syslog("facturation.php sql=".$sql);
|
||||
dol_syslog("facturation.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -62,7 +62,7 @@ if (dol_strlen($_GET["code"]) >= 0) // If search criteria is on char length at l
|
||||
}
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
dol_syslog("facturation_dhtml.php sql=".$sql);
|
||||
dol_syslog("facturation_dhtml.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
|
||||
@ -87,7 +87,7 @@ class Categorie extends CommonObject
|
||||
if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity=".$conf->entity;;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -158,7 +158,7 @@ class Categorie extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this).'::create sql='.$sql);
|
||||
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (";
|
||||
$sql.= "fk_parent,";
|
||||
$sql.= " label,";
|
||||
@ -185,7 +185,7 @@ class Categorie extends CommonObject
|
||||
$sql.= $conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this).'::create sql='.$sql);
|
||||
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
@ -212,16 +212,22 @@ class Categorie extends CommonObject
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CATEGORY_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CATEGORY_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
$this->db->commit();
|
||||
return $id;
|
||||
if ( ! $error )
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -232,7 +238,6 @@ class Categorie extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::create error ".$this->error." sql=".$sql, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -278,7 +283,7 @@ class Categorie extends CommonObject
|
||||
$sql .= ", fk_parent = ".$this->fk_parent;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
||||
@ -303,12 +308,10 @@ class Categorie extends CommonObject
|
||||
$this->db->commit();
|
||||
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CATEGORY_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CATEGORY_MODIFY',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -346,7 +349,6 @@ class Categorie extends CommonObject
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -357,7 +359,6 @@ class Categorie extends CommonObject
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -368,7 +369,6 @@ class Categorie extends CommonObject
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -379,7 +379,6 @@ class Categorie extends CommonObject
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -390,7 +389,6 @@ class Categorie extends CommonObject
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -401,7 +399,6 @@ class Categorie extends CommonObject
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -414,7 +411,6 @@ class Categorie extends CommonObject
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
@ -432,12 +428,10 @@ class Categorie extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CATEGORY_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; $this->error=join(',',$this->errors); }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CATEGORY_DELETE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,10 +471,12 @@ class Categorie extends CommonObject
|
||||
if ($type=='contact') $column_name='socpeople';
|
||||
if ($type=='fournisseur') $column_name='societe';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")";
|
||||
$sql .= " VALUES (".$this->id.", ".$obj->id.")";
|
||||
|
||||
dol_syslog(get_class($this).'::add_type sql='.$sql);
|
||||
dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! empty($conf->global->CATEGORIE_RECURSIV_ADD))
|
||||
@ -488,7 +484,7 @@ class Categorie extends CommonObject
|
||||
$sql = 'SELECT fk_parent FROM '.MAIN_DB_PREFIX.'categorie';
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::add_type sql=".$sql);
|
||||
dol_syslog(get_class($this)."::add_type", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -517,6 +513,7 @@ class Categorie extends CommonObject
|
||||
|
||||
if ($error)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -524,18 +521,26 @@ class Categorie extends CommonObject
|
||||
// Save object we want to link category to into category instance to provide information to trigger
|
||||
$this->linkto=$obj;
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CATEGORY_LINK',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; $this->error=$interface->error; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CATEGORY_LINK',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
|
||||
if (! $error) return 1;
|
||||
else return -2;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$this->error=$this->db->lasterrno();
|
||||
@ -570,29 +575,38 @@ class Categorie extends CommonObject
|
||||
$column_name=$type;
|
||||
if ($type=='contact') $column_name='socpeople';
|
||||
if ($type=='fournisseur') $column_name='societe';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type;
|
||||
$sql .= " WHERE fk_categorie = ".$this->id;
|
||||
$sql .= " AND fk_".$column_name." = ".$obj->id;
|
||||
|
||||
dol_syslog(get_class($this).'::del_type sql='.$sql);
|
||||
dol_syslog(get_class($this).'::del_type', LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// Save object we want to unlink category off into category instance to provide information to trigger
|
||||
$this->unlinkoff=$obj;
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CATEGORY_UNLINK',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CATEGORY_UNLINK',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
|
||||
if (! $error) return 1;
|
||||
else return -2;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
@ -626,7 +640,7 @@ class Categorie extends CommonObject
|
||||
$sql.= " AND c.fk_categorie = ".$this->id;
|
||||
$sql.= " AND c.fk_".$field." = o.rowid";
|
||||
|
||||
dol_syslog(get_class($this)."::getObjectsInCateg sql=".$sql);
|
||||
dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -641,7 +655,6 @@ class Categorie extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
dol_syslog(get_class($this)."::getObjectsInCateg ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -679,13 +692,12 @@ class Categorie extends CommonObject
|
||||
}
|
||||
$sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $category_table;
|
||||
$sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $field . " = " . $object_id;
|
||||
dol_syslog(get_class($this)."::containsObject sql=".$sql);
|
||||
dol_syslog(get_class($this)."::containsObject", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
return $this->db->fetch_object($resql)->nb;
|
||||
} else {
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
dol_syslog(get_class($this)."::containsObject ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -737,7 +749,7 @@ class Categorie extends CommonObject
|
||||
$sql.= " WHERE fk_parent != 0";
|
||||
$sql.= " AND entity IN (".getEntity('category',1).")";
|
||||
|
||||
dol_syslog(get_class($this)."::load_motherof sql=".$sql);
|
||||
dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -788,7 +800,7 @@ class Categorie extends CommonObject
|
||||
$sql.= " WHERE c.entity IN (".getEntity('category',1).")";
|
||||
$sql.= " AND c.type = ".$type;
|
||||
|
||||
dol_syslog(get_class($this)."::get_full_arbo get category list sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -982,7 +994,7 @@ class Categorie extends CommonObject
|
||||
$sql.= " AND c.fk_parent = ".$this->fk_parent;
|
||||
$sql.= " AND c.label = '".$this->db->escape($this->label)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::already_exists sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::already_exists", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1006,7 +1018,6 @@ class Categorie extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::already_exists error ".$this->error." sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1145,7 +1156,7 @@ class Categorie extends CommonObject
|
||||
$sql.= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".$table." = ".$id." AND c.type = ".$typeid;
|
||||
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||
|
||||
dol_syslog(get_class($this).'::containing sql='.$sql);
|
||||
dol_syslog(get_class($this).'::containing', LOG_DEBUG);
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
@ -1227,7 +1238,6 @@ class Categorie extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
dol_syslog(get_class($this)."::rechercher ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1447,11 +1457,10 @@ class Categorie extends CommonObject
|
||||
$sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->label);
|
||||
$sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
|
||||
}
|
||||
dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2);
|
||||
dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG);
|
||||
if (! $this->db->query($sql2))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1473,11 +1482,10 @@ class Categorie extends CommonObject
|
||||
|
||||
// on ne sauvegarde pas des champs vides
|
||||
if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] )
|
||||
dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2);
|
||||
dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG);
|
||||
if (! $this->db->query($sql2))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= $conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::add sql=".$sql);
|
||||
dol_syslog(get_class($this)."::add", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -227,14 +227,10 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ACTION_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ACTION_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -252,7 +248,6 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::add ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -292,7 +287,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
||||
$sql.= " WHERE a.id=".$id." AND a.fk_action=c.id";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -369,7 +364,7 @@ class ActionComm extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm";
|
||||
$sql.= " WHERE id=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$res=$this->db->query($sql);
|
||||
if ($res < 0) {
|
||||
$this->error=$this->db->lasterror();
|
||||
@ -390,14 +385,10 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ACTION_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ACTION_DELETE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -415,7 +406,6 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -477,7 +467,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null");
|
||||
$sql.= " WHERE id=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
||||
@ -500,14 +490,10 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ACTION_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ACTION_MODIFY',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -526,7 +512,6 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -558,7 +543,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
if (! empty($filter)) $sql.= $filter;
|
||||
|
||||
dol_syslog(get_class()."::getActions sql=".$sql);
|
||||
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -644,7 +629,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
|
||||
$sql.= ' WHERE a.id = '.$id;
|
||||
|
||||
dol_syslog(get_class($this)."::info sql=".$sql);
|
||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -930,7 +915,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= " ORDER by datep";
|
||||
//print $sql;exit;
|
||||
|
||||
dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql);
|
||||
dol_syslog(get_class($this)."::build_exportfile select events", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -976,7 +961,6 @@ class ActionComm extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ class CActionComm
|
||||
if (is_numeric($id)) $sql.= " WHERE id=".$id;
|
||||
else $sql.= " WHERE code='".$id."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -117,7 +117,7 @@ class CActionComm
|
||||
if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'";
|
||||
$sql.= " ORDER BY module, position";
|
||||
|
||||
dol_syslog(get_class($this)."::liste_array sql=".$sql);
|
||||
dol_syslog(get_class($this)."::liste_array", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -283,8 +283,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
setEventMessage($mesg,'errors');
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,7 +445,7 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
|
||||
$sql.= ' ORDER BY datep';
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("comm/action/index.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -557,7 +557,7 @@ if ($showbirthday)
|
||||
}
|
||||
$sql.= ' ORDER BY birthday';
|
||||
|
||||
dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("comm/action/index.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -182,7 +182,7 @@ $sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("comm/action/listactions.php sql=".$sql);
|
||||
dol_syslog("comm/action/listactions.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -89,7 +89,7 @@ $sql.= " ORDER BY year DESC, month DESC, df DESC";
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
//print $sql;
|
||||
dol_syslog("select sql=".$sql);
|
||||
dol_syslog("select", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -288,30 +288,28 @@ if ($id > 0)
|
||||
print '</tr>';
|
||||
|
||||
// Local Taxes
|
||||
if($mysoc->country_code=='ES')
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td class="nowrap">'.$langs->trans('LocalTax1IsUsedES').'</td><td colspan="3">';
|
||||
print yn($object->localtax1_assuj);
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="nowrap">'.$langs->trans('LocalTax2IsUsedES').'</td><td colspan="3">';
|
||||
print yn($object->localtax2_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
||||
print yn($object->localtax1_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
||||
print yn($object->localtax2_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '<tr><td class="nowrap">'.$langs->trans('LocalTax1IsUsedES').'</td><td colspan="3">';
|
||||
print yn($object->localtax1_assuj);
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="nowrap">'.$langs->trans('LocalTax2IsUsedES').'</td><td colspan="3">';
|
||||
print yn($object->localtax2_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
||||
print yn($object->localtax1_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
||||
print yn($object->localtax2_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// TVA Intra
|
||||
print '<tr><td class="nowrap">'.$langs->trans('VATIntra').'</td><td colspan="3">';
|
||||
|
||||
@ -149,7 +149,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
dol_syslog('comm/list.php: sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog('comm/list.php:', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -118,7 +118,7 @@ class Mailing extends CommonObject
|
||||
$this->titre = $langs->trans("NoTitle");
|
||||
}
|
||||
|
||||
dol_syslog("Mailing::Create sql=".$sql);
|
||||
dol_syslog("Mailing::Create", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -131,7 +131,6 @@ class Mailing extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Mailing::Create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -141,7 +140,6 @@ class Mailing extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Mailing::Create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -166,7 +164,7 @@ class Mailing extends CommonObject
|
||||
$sql .= ", bgimage = '".($this->bgimage?$this->bgimage:null)."'";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("Mailing::Update sql=".$sql);
|
||||
dol_syslog("Mailing::Update", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -175,7 +173,6 @@ class Mailing extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Mailing::Update ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -201,7 +198,7 @@ class Mailing extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m";
|
||||
$sql.= " WHERE m.rowid = ".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -334,7 +331,7 @@ class Mailing extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles ";
|
||||
$sql.= " WHERE fk_mailing = ".$fromid;
|
||||
|
||||
dol_syslog(get_class($this)."::createFromClone sql=".$sql);
|
||||
dol_syslog(get_class($this)."::createFromClone", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -357,7 +354,6 @@ class Mailing extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Mailing::createFromClone ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -393,7 +389,7 @@ class Mailing extends CommonObject
|
||||
$sql .= " SET statut = 1, date_valid = '".$this->db->idate($now)."', fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("Mailing::valid sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Mailing::valid", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
@ -401,7 +397,6 @@ class Mailing extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Mailing::Valid ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -418,7 +413,7 @@ class Mailing extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
|
||||
dol_syslog("Mailing::delete sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Mailing::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -427,7 +422,6 @@ class Mailing extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Mailing::Valid ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -445,7 +439,7 @@ class Mailing extends CommonObject
|
||||
$sql.= " SET statut = 0";
|
||||
$sql.= " WHERE fk_mailing = ".$this->id;
|
||||
|
||||
dol_syslog("Mailing::reset_targets_status sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Mailing::reset_targets_status", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -454,7 +448,6 @@ class Mailing extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Mailing::Valid ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
|
||||
|
||||
dol_syslog("fiche.php: select targets sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("fiche.php: select targets", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -295,7 +295,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
{
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")";
|
||||
dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("fiche.php: set prospect thirdparty status", LOG_DEBUG);
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
@ -304,7 +304,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
|
||||
//Update status communication of contact prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("fiche.php: set prospect contact status", LOG_DEBUG);
|
||||
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
@ -363,7 +363,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
}
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
|
||||
dol_syslog("comm/mailing/fiche.php: update global status sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("comm/mailing/fiche.php: update global status", LOG_DEBUG);
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
|
||||
@ -82,7 +82,6 @@ else
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
//print $sql;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -1463,12 +1463,12 @@ if ($action == 'create') {
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
|
||||
if ($mysoc->localtax1_assuj == "1") // Localtax1 RE
|
||||
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0 ) // Localtax1
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax1) . "</td></tr>";
|
||||
}
|
||||
|
||||
if ($mysoc->localtax2_assuj == "1") // Localtax2 IRPF
|
||||
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
|
||||
}
|
||||
@ -1985,13 +1985,13 @@ if ($action == 'create') {
|
||||
print '<td></td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1") // Localtax1
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
print '<tr><td height="10">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right" class="nowrap">' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '<td></td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1") // Localtax2
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2
|
||||
{
|
||||
print '<tr><td height="10">' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right" class="nowrap">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-214 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -355,7 +355,7 @@ class Propal extends CommonObject
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
@ -443,7 +443,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -510,7 +509,7 @@ class Propal extends CommonObject
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
@ -597,7 +596,6 @@ class Propal extends CommonObject
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::updateline Error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -749,7 +747,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -760,7 +758,7 @@ class Propal extends CommonObject
|
||||
$this->ref='(PROV'.$this->id.')';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->ref."' WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) $error++;
|
||||
|
||||
@ -888,7 +886,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::create -2 ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -896,7 +893,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::create -1 ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1075,7 +1071,7 @@ class Propal extends CommonObject
|
||||
if ($ref) $sql.= " AND p.ref='".$ref."'";
|
||||
else $sql.= " AND p.rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1226,7 +1222,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1246,7 +1241,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1327,7 +1321,7 @@ class Propal extends CommonObject
|
||||
$sql.= " fk_statut = 1, date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
dol_syslog(get_class($this).'::valid sql='.$sql);
|
||||
dol_syslog(get_class($this).'::valid', LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $notrigger)
|
||||
@ -1412,7 +1406,7 @@ class Propal extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
dol_syslog(get_class($this)."::set_date sql=".$sql);
|
||||
dol_syslog(get_class($this)."::set_date", LOG_DEBUG);
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$this->date = $date;
|
||||
@ -1422,7 +1416,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::set_date ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1449,7 +1442,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::set_echeance Erreur SQL".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1602,7 +1594,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::set_remise_percent Error sql=$sql");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1637,7 +1628,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::set_remise_absolue Error sql=$sql");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1669,7 +1659,7 @@ class Propal extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::reopen sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::reopen", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error++; $this->errors[]="Error ".$this->db->lasterror();
|
||||
@ -1995,7 +1985,7 @@ class Propal extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")";
|
||||
|
||||
dol_syslog(get_class($this)."::InvoiceArrayList sql=".$sql);
|
||||
dol_syslog(get_class($this)."::InvoiceArrayList", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
@ -2135,7 +2125,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
@ -2143,7 +2132,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
@ -2151,7 +2139,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -2159,7 +2146,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2640,7 +2626,7 @@ class Propal extends CommonObject
|
||||
$sql.= ' WHERE pt.fk_propal = '.$this->id;
|
||||
$sql.= ' ORDER BY pt.rang ASC, pt.rowid';
|
||||
|
||||
dol_syslog(get_class($this).'::getLinesArray sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::getLinesArray', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2691,7 +2677,6 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::getLinesArray Error sql=$sql, error=".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2928,7 +2913,7 @@ class PropaleLigne extends CommonObject
|
||||
$sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null");
|
||||
$sql.= ')';
|
||||
|
||||
dol_syslog(get_class($this).'::insert sql='.$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::insert', LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2962,7 +2947,6 @@ class PropaleLigne extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dol_syslog(get_class($this).'::insert Error '.$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2981,7 +2965,7 @@ class PropaleLigne extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid;
|
||||
dol_syslog("PropaleLigne::delete sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
|
||||
@ -3013,7 +2997,6 @@ class PropaleLigne extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dol_syslog("PropaleLigne::delete Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -3092,7 +3075,7 @@ class PropaleLigne extends CommonObject
|
||||
$sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null");
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -3124,7 +3107,6 @@ class PropaleLigne extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -3147,7 +3129,7 @@ class PropaleLigne extends CommonObject
|
||||
$sql.= ",total_ttc=".price2num($this->total_ttc,'MT')."";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog("PropaleLigne::update_total sql=$sql");
|
||||
dol_syslog("PropaleLigne::update_total", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -3158,7 +3140,6 @@ class PropaleLigne extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("PropaleLigne::update_total Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$sql.= " ORDER BY $sortfield $sortorder, s.nom ASC";
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
dol_syslog('comm/prospect/list.php sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog('comm/prospect/list.php', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -232,11 +232,10 @@ class Commande extends CommonOrder
|
||||
$sql.= " fk_user_valid = ".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::valid() sql=".$sql);
|
||||
dol_syslog(get_class($this)."::valid()", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid Echec update - 10 - sql=".$sql, LOG_ERR);
|
||||
dol_print_error($this->db);
|
||||
$error++;
|
||||
}
|
||||
@ -355,7 +354,7 @@ class Commande extends CommonOrder
|
||||
$sql.= " SET fk_statut = 0";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// If stock is decremented on validate order, we must reincrement it
|
||||
@ -398,7 +397,6 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -427,7 +425,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ' SET fk_statut=1, facture=0';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_reopen sql=".$sql);
|
||||
dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -515,7 +513,6 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
@ -543,7 +540,7 @@ class Commande extends CommonOrder
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND fk_statut = 1";
|
||||
|
||||
dol_syslog(get_class($this)."::cancel sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::cancel", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// If stock is decremented on validate order, we must reincrement it
|
||||
@ -602,7 +599,6 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -686,7 +682,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1122,7 +1118,7 @@ class Commande extends CommonOrder
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
@ -1352,7 +1348,7 @@ class Commande extends CommonOrder
|
||||
if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1427,13 +1423,11 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error='Order with id '.$id.' not found sql='.$sql;
|
||||
dol_syslog(get_class($this).'::fetch '.$this->error);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::fetch Error rowid='.$id, LOG_ERR);
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
@ -1536,7 +1530,7 @@ class Commande extends CommonOrder
|
||||
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
|
||||
$sql .= ' ORDER BY l.rang';
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_lines sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1601,7 +1595,6 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog('Commande::fetch_lines: Error '.$this->error, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
@ -1663,7 +1656,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
|
||||
//print $sql;
|
||||
|
||||
dol_syslog(get_class($this)."::loadExpeditions sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::loadExpeditions", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1681,7 +1674,6 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::loadExpeditions ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1896,7 +1888,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ' SET remise_absolue = '.$remise;
|
||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;';
|
||||
|
||||
dol_syslog(get_class($this)."::set_remise_absolue sql=$sql");
|
||||
dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG);
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -1928,7 +1920,7 @@ class Commande extends CommonOrder
|
||||
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
dol_syslog(get_class($this)."::set_date sql=$sql",LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::set_date",LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1938,7 +1930,6 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::set_date ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1963,7 +1954,7 @@ class Commande extends CommonOrder
|
||||
$sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1973,7 +1964,6 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::set_date_livraison ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2207,7 +2197,6 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::set_ref_client Erreur '.$this->error.' - '.$sql, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -2231,7 +2220,7 @@ class Commande extends CommonOrder
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1';
|
||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
|
||||
|
||||
dol_syslog(get_class($this)."::classifyBilled sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// Appel des triggers
|
||||
@ -2267,7 +2256,6 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::classifyBilled Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2343,7 +2331,7 @@ class Commande extends CommonOrder
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
@ -2474,19 +2462,17 @@ class Commande extends CommonOrder
|
||||
{
|
||||
// Delete order details
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete error", LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Delete order
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete error", LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -3025,7 +3011,6 @@ class Commande extends CommonOrder
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -3191,7 +3176,7 @@ class OrderLine extends CommonOrderLine
|
||||
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';";
|
||||
|
||||
dol_syslog("OrderLine::delete sql=".$sql);
|
||||
dol_syslog("OrderLine::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -3230,7 +3215,6 @@ class OrderLine extends CommonOrderLine
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("OrderLine::delete ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -3315,7 +3299,7 @@ class OrderLine extends CommonOrderLine
|
||||
$sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null");
|
||||
$sql.= ')';
|
||||
|
||||
dol_syslog(get_class($this)."::insert sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -3357,7 +3341,6 @@ class OrderLine extends CommonOrderLine
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -3435,7 +3418,7 @@ class OrderLine extends CommonOrderLine
|
||||
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -3475,7 +3458,6 @@ class OrderLine extends CommonOrderLine
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -3503,7 +3485,7 @@ class OrderLine extends CommonOrderLine
|
||||
$sql.= ",total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog("OrderLine::update_total sql=$sql");
|
||||
dol_syslog("OrderLine::update_total", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -3514,7 +3496,6 @@ class OrderLine extends CommonOrderLine
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("OrderLine::update_total Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -1589,12 +1589,12 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
|
||||
if ($mysoc->localtax1_assuj == "1") // Localtax1 RE
|
||||
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax1) . "</td></tr>";
|
||||
}
|
||||
|
||||
if ($mysoc->localtax2_assuj == "1") // Localtax2 IRPF
|
||||
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
|
||||
}
|
||||
@ -1840,9 +1840,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
$nbrow ++;
|
||||
|
||||
// Local taxes
|
||||
if ($mysoc->localtax1_assuj == "1")
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
|
||||
$nbrow ++;
|
||||
if ($mysoc->localtax2_assuj == "1")
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0 )
|
||||
$nbrow ++;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
@ -2115,9 +2115,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
}
|
||||
|
||||
$rowspan = 4;
|
||||
if ($mysoc->localtax1_assuj == "1")
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
|
||||
$rowspan ++;
|
||||
if ($mysoc->localtax2_assuj == "1")
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0)
|
||||
$rowspan ++;
|
||||
|
||||
// Total HT
|
||||
@ -2138,12 +2138,12 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td align="right">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1") // Localtax1 RE
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1") // Localtax2 IRPF
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
|
||||
@ -241,7 +241,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql.= " AND ba.entity = ".$conf->entity;
|
||||
$sql.= $sql_rech;
|
||||
|
||||
dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("account.php count transactions -", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -485,7 +485,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
|
||||
$sql.= $db->plimit($limitsql, 0);
|
||||
|
||||
dol_syslog("account.php get transactions - sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("account.php get transactions -", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -52,7 +52,6 @@ if (GETPOST('add'))
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
@ -73,7 +72,6 @@ if (GETPOST('update'))
|
||||
$sql.= " WHERE rowid = '".GETPOST('categid')."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
@ -92,7 +90,6 @@ if ($action == 'delete')
|
||||
$sql.= " WHERE rowid = '".GETPOST('categid')."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
|
||||
@ -147,7 +147,7 @@ class Account extends CommonObject
|
||||
$sql.= ", '".$type."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::add_url_line sql=".$sql);
|
||||
dol_syslog(get_class($this)."::add_url_line", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url");
|
||||
@ -156,7 +156,6 @@ class Account extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::add_url_line ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -190,7 +189,7 @@ class Account extends CommonObject
|
||||
}
|
||||
$sql.= " ORDER BY type, label";
|
||||
|
||||
dol_syslog(get_class($this)."::get_url sql=".$sql);
|
||||
dol_syslog(get_class($this)."::get_url", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -303,7 +302,7 @@ class Account extends CommonObject
|
||||
$sql.= ", ".($banque?"'".$this->db->escape($banque)."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::addline sql=".$sql);
|
||||
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank");
|
||||
@ -331,7 +330,6 @@ class Account extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::addline ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -407,7 +405,7 @@ class Account extends CommonObject
|
||||
$sql.= ", ".$this->country_id;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -440,7 +438,6 @@ class Account extends CommonObject
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
@ -451,12 +448,10 @@ class Account extends CommonObject
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$this->error=$langs->trans("ErrorBankLabelAlreadyExists");
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -517,7 +512,7 @@ class Account extends CommonObject
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -574,7 +569,7 @@ class Account extends CommonObject
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::update_bban sql=$sql");
|
||||
dol_syslog(get_class($this)."::update_bban", LOG_DEBUG);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -621,7 +616,7 @@ class Account extends CommonObject
|
||||
if ($id) $sql.= " AND ba.rowid = ".$id;
|
||||
if ($ref) $sql.= " AND ba.ref = '".$this->db->escape($ref)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -696,7 +691,7 @@ class Account extends CommonObject
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
return 1;
|
||||
@ -1096,7 +1091,7 @@ class AccountLine extends CommonObject
|
||||
else if ($ref) $sql.= " AND b.rowid='".$this->db->escape($ref)."'";
|
||||
else $sql.= " AND b.rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1171,12 +1166,12 @@ class AccountLine extends CommonObject
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".$this->rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result) $nbko++;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$this->rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result) $nbko++;
|
||||
|
||||
@ -1213,7 +1208,7 @@ class AccountLine extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$this->rowid;
|
||||
dol_syslog(get_class($this)."::delete_urls sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete_urls", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result) $nbko++;
|
||||
|
||||
@ -1247,7 +1242,7 @@ class AccountLine extends CommonObject
|
||||
$sql.= " dateo='".$this->db->idate($this->dateo)."'";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1258,7 +1253,6 @@ class AccountLine extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1281,7 +1275,7 @@ class AccountLine extends CommonObject
|
||||
$sql.= ", fk_user_rappro = ".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_conciliation sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1295,7 +1289,7 @@ class AccountLine extends CommonObject
|
||||
$sql.= ", ".$cat;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::update_conciliation sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
// No error check. Can fail if category already affected
|
||||
|
||||
@ -84,7 +84,7 @@ class BankCateg // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -142,7 +142,7 @@ class BankCateg // extends CommonObject
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
$sql.= " AND t.entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -160,7 +160,6 @@ class BankCateg // extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -192,7 +191,7 @@ class BankCateg // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -249,7 +248,7 @@ class BankCateg // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
|
||||
else $sql.=", rappro = ".$rappro;
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
|
||||
dol_syslog("ligne.php sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("ligne.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -189,7 +189,7 @@ else
|
||||
$sql.= " AND b.fk_account = ".$acct->id;
|
||||
$sql.= " ORDER BY b.num_releve DESC";
|
||||
|
||||
dol_syslog("htdocs/compta/bank/releve.php sql=".$sql);
|
||||
dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -211,7 +211,7 @@ else
|
||||
$sql.= " AND b.fk_account = ".$acct->id;
|
||||
$sql.= " ORDER BY b.num_releve ASC";
|
||||
|
||||
dol_syslog("htdocs/compta/bank/releve.php sql=".$sql);
|
||||
dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -277,7 +277,6 @@ else
|
||||
$sql.= " AND b.fk_account = ba.rowid";
|
||||
$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -145,7 +145,7 @@ $sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog('compta/bank/search.php:: sql='.$sql);
|
||||
dol_syslog('compta/bank/search.php::', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -207,7 +208,7 @@ if ($conf->tax->enabled)
|
||||
//$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("compta/charges/index.php: select payment sql=".$sql);
|
||||
dol_syslog("compta/charges/index.php: select payment", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -353,6 +354,108 @@ if ($conf->tax->enabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
//localtax
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
$j=1;
|
||||
$numlt=3;
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
{
|
||||
$j=1;
|
||||
$numlt=2;
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
$j=2;
|
||||
$numlt=3;
|
||||
}
|
||||
else
|
||||
{
|
||||
$j=0;
|
||||
$numlt=0;
|
||||
}
|
||||
|
||||
while($j<$numlt)
|
||||
{
|
||||
if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
|
||||
{
|
||||
print "<br>";
|
||||
|
||||
$tva = new Tva($db);
|
||||
|
||||
print_fiche_titre($langs->transcountry(($j==1?"LT1Payments":"LT2Payments"),$mysoc->country_code).($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
|
||||
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.datep as dp";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."localtax as pv";
|
||||
$sql.= " WHERE pv.entity = ".$conf->entity." AND localtaxtype = ".$j ;
|
||||
if ($year > 0)
|
||||
{
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
$sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$total = 0 ;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=1;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -120,7 +120,7 @@ class Deplacement extends CommonObject
|
||||
$sql.= ", ".($this->fk_soc > 0? $this->fk_soc : "null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -203,7 +203,7 @@ class Deplacement extends CommonObject
|
||||
$sql .= " , fk_projet = ".($this->fk_project>0?$this->fk_project:0);
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -230,7 +230,7 @@ class Deplacement extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
@ -271,7 +271,7 @@ class Deplacement extends CommonObject
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -381,7 +381,7 @@ class Deplacement extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees";
|
||||
$sql.= " WHERE active = ".$active;
|
||||
|
||||
dol_syslog(get_class($this)."::listOfTypes sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::listOfTypes", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
@ -415,7 +415,7 @@ class Deplacement extends CommonObject
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'deplacement as c';
|
||||
$sql.= ' WHERE c.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this).'::info sql='.$sql);
|
||||
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
|
||||
@ -307,6 +307,8 @@ class Don extends CommonObject
|
||||
$this->country=($this->country?$this->country:$this->country);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
|
||||
$sql.= "datec";
|
||||
@ -354,25 +356,23 @@ class Don extends CommonObject
|
||||
$sql.= ", '".$this->db->escape($this->phone_mobile)."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("Don::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Don::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."don");
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('DON_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('DON_CREATE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
@ -393,6 +393,8 @@ class Don extends CommonObject
|
||||
$this->country_id=($this->country_id>0?$this->country_id:$this->country_id);
|
||||
$this->country=($this->country?$this->country:$this->country);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
|
||||
$sql .= "amount = " . price2num($this->amount);
|
||||
$sql .= ",fk_paiement = ".($this->modepaiementid?$this->modepaiementid:"null");
|
||||
@ -414,14 +416,21 @@ class Don extends CommonObject
|
||||
$sql .= ",fk_statut=".$this->statut;
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
|
||||
dol_syslog("Don::update sql=".$sql);
|
||||
dol_syslog("Don::update", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('DON_UPDATE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
@ -435,6 +444,8 @@ class Don extends CommonObject
|
||||
*/
|
||||
function delete($rowid)
|
||||
{
|
||||
|
||||
$this->db-begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;";
|
||||
|
||||
@ -443,10 +454,17 @@ class Don extends CommonObject
|
||||
{
|
||||
if ( $this->db->affected_rows($resql) )
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('DON_DELETE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -478,7 +496,7 @@ class Don extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_paiement";
|
||||
$sql.= " WHERE d.rowid = ".$rowid." AND d.entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -535,7 +553,6 @@ class Don extends CommonObject
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0";
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -571,7 +588,6 @@ class Don extends CommonObject
|
||||
}
|
||||
$sql .= " WHERE rowid = $rowid AND fk_statut = 1";
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -603,7 +619,6 @@ class Don extends CommonObject
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2";
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -633,7 +648,6 @@ class Don extends CommonObject
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$rowid;
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -2302,12 +2302,12 @@ if ($action == 'create')
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
|
||||
if ($mysoc->localtax1_assuj == "1") // Localtax1 RE
|
||||
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax1) . "</td></tr>";
|
||||
}
|
||||
|
||||
if ($mysoc->localtax2_assuj == "1") // Localtax2 IRPF
|
||||
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
|
||||
}
|
||||
@ -2907,9 +2907,9 @@ if ($action == 'create')
|
||||
if (! empty($conf->banque->enabled))
|
||||
$nbcols ++;
|
||||
// if (! empty($soc->outstandingbill)) $nbrows++;
|
||||
if ($mysoc->localtax1_assuj == "1")
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
|
||||
$nbrows ++;
|
||||
if ($mysoc->localtax2_assuj == "1")
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0)
|
||||
$nbrows ++;
|
||||
if ($selleruserevenustamp)
|
||||
$nbrows ++;
|
||||
@ -3173,12 +3173,12 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) // Localtax1 (example RE)
|
||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right" colspan="3" nowrap>' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) // Localtax2 (example IRPF)
|
||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right" colspan="3" nowrap>' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
|
||||
@ -216,7 +216,7 @@ class FactureRec extends Facture
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
|
||||
$sql.= ' WHERE f.rowid='.$rowid;
|
||||
|
||||
dol_syslog("FactureRec::Fetch rowid=".$rowid." sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("FactureRec::Fetch rowid=".$rowid."", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -269,7 +269,6 @@ class FactureRec extends Facture
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
return 1;
|
||||
@ -284,7 +283,6 @@ class FactureRec extends Facture
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -359,7 +357,6 @@ class FactureRec extends Facture
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog('Facture::fetch_lines: Error '.$this->error, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
@ -497,7 +494,7 @@ class FactureRec extends Facture
|
||||
$sql.= ", ".$rang;
|
||||
$sql.= ", ".$special_code.")";
|
||||
|
||||
dol_syslog(get_class($this)."::addline sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->id=$facid;
|
||||
@ -507,7 +504,6 @@ class FactureRec extends Facture
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("FactureRec::addline sql=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
@ -263,7 +263,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ",".$this->mode_reglement_id;
|
||||
$sql.= ", '".$this->db->idate($datelim)."', '".$this->modelpdf."')";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -273,7 +273,7 @@ class Facture extends CommonInvoice
|
||||
$this->ref='(PROV'.$this->id.')';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->ref."' WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) $error++;
|
||||
|
||||
@ -516,7 +516,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::create error ".$this->error." sql=".$sql, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -846,7 +845,7 @@ class Facture extends CommonInvoice
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -915,7 +914,6 @@ class Facture extends CommonInvoice
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
return 1;
|
||||
@ -930,7 +928,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -956,7 +953,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang';
|
||||
|
||||
dol_syslog(get_class($this).'::fetch_lines sql='.$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::fetch_lines', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1016,7 +1013,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this).'::fetch_lines '.$this->error,LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
@ -1089,7 +1085,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error++; $this->errors[]="Error ".$this->db->lasterror();
|
||||
@ -1311,11 +1307,10 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' SET fk_facture = NULL, fk_facture_line = NULL';
|
||||
$sql.= ' WHERE fk_facture_line IN ('.join(',',$list_rowid_det).')';
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -5;
|
||||
}
|
||||
@ -1344,9 +1339,15 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Delete invoice line
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
if ($this->db->query($sql) && $this->delete_linked_contact())
|
||||
{
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1384,7 +1385,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror()." sql=".$sql;
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -6;
|
||||
}
|
||||
@ -1392,7 +1392,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror()." sql=".$sql;
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -4;
|
||||
}
|
||||
@ -1400,7 +1399,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -1432,7 +1430,7 @@ class Facture extends CommonInvoice
|
||||
if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'";
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_paid sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::set_paid", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1488,7 +1486,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' SET paye=0, fk_statut=1, close_code=null, close_note=null';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_unpaid sql=".$sql);
|
||||
dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1702,11 +1700,10 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::validate sql=".$sql);
|
||||
dol_syslog(get_class($this)."::validate", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate Echec update - 10 - sql=".$sql, LOG_ERR);
|
||||
dol_print_error($this->db);
|
||||
$error++;
|
||||
}
|
||||
@ -1841,7 +1838,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= " SET fk_statut = 0";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1988,7 +1985,7 @@ class Facture extends CommonInvoice
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type);
|
||||
|
||||
@ -2076,7 +2073,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2147,7 +2143,7 @@ class Facture extends CommonInvoice
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'',$localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
@ -2256,12 +2252,11 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' SET fk_facture_line = NULL';
|
||||
$sql.= ' WHERE fk_facture_line = '.$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::deleteline sql=".$sql);
|
||||
dol_syslog(get_class($this)."::deleteline", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::deleteline Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2351,7 +2346,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
$sql.= ' AND fk_statut = 0';
|
||||
|
||||
dol_syslog(get_class($this)."::set_remise_absolue sql=$sql");
|
||||
dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG);
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -2396,7 +2391,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' AND p.fk_paiement = t.id';
|
||||
if ($filtertype) $sql.=" AND t.code='PRE'";
|
||||
|
||||
dol_syslog(get_class($this)."::getListOfPayments sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getListOfPayments", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2742,7 +2737,7 @@ class Facture extends CommonInvoice
|
||||
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
|
||||
$sql.= " ORDER BY f.facnumber";
|
||||
|
||||
dol_syslog(get_class($this)."::list_replacable_invoices sql=$sql");
|
||||
dol_syslog(get_class($this)."::list_replacable_invoices", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2758,7 +2753,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::list_replacable_invoices ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2792,7 +2786,7 @@ class Facture extends CommonInvoice
|
||||
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
|
||||
$sql.= " ORDER BY f.facnumber";
|
||||
|
||||
dol_syslog(get_class($this)."::list_qualified_avoir_invoices sql=".$sql);
|
||||
dol_syslog(get_class($this)."::list_qualified_avoir_invoices", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2814,7 +2808,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::list_avoir_invoices ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2841,7 +2834,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' WHERE fk_facture = '.$this->id;
|
||||
$sql.= ' AND traite = 0';
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement sql=".$sql);
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2872,7 +2865,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ",'".$bac->number."'";
|
||||
$sql .= ",'".$bac->cle_rib."')";
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement sql=".$sql);
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
@ -3190,7 +3183,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang ASC, l.rowid';
|
||||
|
||||
dol_syslog(get_class($this).'::getLinesArray sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::getLinesArray',LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -3240,7 +3233,6 @@ class Facture extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Error sql=".$sql.", error=".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -3504,7 +3496,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql.= " ".price2num($this->total_localtax2);
|
||||
$sql.= ')';
|
||||
|
||||
dol_syslog(get_class($this)."::insert sql=".$sql);
|
||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -3591,7 +3583,6 @@ class FactureLigne extends CommonInvoiceLine
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -3671,7 +3662,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -3706,7 +3697,6 @@ class FactureLigne extends CommonInvoiceLine
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -3726,7 +3716,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
// Appel des triggers
|
||||
@ -3749,7 +3739,6 @@ class FactureLigne extends CommonInvoiceLine
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dol_syslog(get_class($this)."::delete Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -3778,7 +3767,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql.= ",total_ttc=".price2num($this->total_ttc)."";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::update_total sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_total", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -3789,7 +3778,6 @@ class FactureLigne extends CommonInvoiceLine
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_total Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ class PaymentTerm // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -185,7 +185,7 @@ class PaymentTerm // extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -213,7 +213,6 @@ class PaymentTerm // extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -235,7 +234,7 @@ class PaymentTerm // extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||
$sql.= " WHERE t.code = 'RECEP'";
|
||||
|
||||
dol_syslog(get_class($this)."::getDefaultId sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -250,7 +249,6 @@ class PaymentTerm // extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::getDefaultId ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -301,7 +299,7 @@ class PaymentTerm // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -357,7 +355,7 @@ class PaymentTerm // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -384,21 +384,19 @@ if ($object->id > 0)
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->country_code=='ES')
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Alexandre spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
@ -117,7 +117,6 @@ if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start
|
||||
// TODO Find a better trick to avoid problem with some mysql installations
|
||||
if (in_array($db->type, array('mysql', 'mysqli'))) $db->query('SET SQL_BIG_SELECTS=1');
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -150,9 +149,9 @@ if ($result)
|
||||
$compta_localtax1 = (! empty($obj->account_localtax1)?$obj->account_localtax1:$langs->trans("CodeNotDef"));
|
||||
$compta_localtax2 = (! empty($obj->account_localtax2)?$obj->account_localtax2:$langs->trans("CodeNotDef"));
|
||||
|
||||
$account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $mysoc);
|
||||
$account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $mysoc, $obj->thirdparty);
|
||||
$compta_localtax1= (! empty($account_localtax1[2])?$account_localtax1[2]:$langs->trans("CodeNotDef"));
|
||||
$account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc);
|
||||
$account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc, $obj->thirdparty);
|
||||
$compta_localtax2= (! empty($account_localtax2[2])?$account_localtax2[2]:$langs->trans("CodeNotDef"));
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
@ -121,7 +121,6 @@ $sql.= " ORDER BY f.rowid";
|
||||
// TODO Find a better trick to avoid problem with some mysql installations
|
||||
if (in_array($db->type, array('mysql', 'mysqli'))) $db->query('SET SQL_BIG_SELECTS=1');
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -153,9 +152,9 @@ if ($result)
|
||||
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
$compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva);
|
||||
|
||||
$account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $mysoc);
|
||||
$account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $obj->thirdparty, $mysoc);
|
||||
$compta_localtax1= (! empty($account_localtax1[3])?$account_localtax1[3]:$langs->trans("CodeNotDef"));
|
||||
$account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc);
|
||||
$account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $obj->thirdparty, $mysoc);
|
||||
$compta_localtax2= (! empty($account_localtax2[3])?$account_localtax2[3]:$langs->trans("CodeNotDef"));
|
||||
|
||||
//la ligne facture
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -31,6 +31,7 @@ class Localtax extends CommonObject
|
||||
{
|
||||
var $id;
|
||||
var $ref;
|
||||
var $ltt;
|
||||
var $tms;
|
||||
var $datep;
|
||||
var $datev;
|
||||
@ -74,6 +75,7 @@ class Localtax extends CommonObject
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."localtax(";
|
||||
$sql.= "localtaxtype,";
|
||||
$sql.= "tms,";
|
||||
$sql.= "datep,";
|
||||
$sql.= "datev,";
|
||||
@ -84,6 +86,7 @@ class Localtax extends CommonObject
|
||||
$sql.= "fk_user_creat,";
|
||||
$sql.= "fk_user_modif";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " ".$this->ltt.",";
|
||||
$sql.= " '".$this->db->idate($this->tms)."',";
|
||||
$sql.= " '".$this->db->idate($this->datep)."',";
|
||||
$sql.= " '".$this->db->idate($this->datev)."',";
|
||||
@ -95,7 +98,7 @@ class Localtax extends CommonObject
|
||||
$sql.= " '".$this->fk_user_modif."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -113,7 +116,6 @@ class Localtax extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -141,6 +143,7 @@ class Localtax extends CommonObject
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
|
||||
$sql.= " localtaxtype=".$this->ltt.",";
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
@ -152,12 +155,11 @@ class Localtax extends CommonObject
|
||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -186,6 +188,7 @@ class Localtax extends CommonObject
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.localtaxtype,";
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.datep,";
|
||||
$sql.= " t.datev,";
|
||||
@ -202,7 +205,7 @@ class Localtax extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -212,6 +215,7 @@ class Localtax extends CommonObject
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->ltt = $obj->localtaxtype;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->datep = $this->db->jdate($obj->datep);
|
||||
$this->datev = $this->db->jdate($obj->datev);
|
||||
@ -232,7 +236,6 @@ class Localtax extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -253,12 +256,11 @@ class Localtax extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -285,6 +287,7 @@ class Localtax extends CommonObject
|
||||
$this->id=0;
|
||||
|
||||
$this->tms='';
|
||||
$this->ltt=0;
|
||||
$this->datep='';
|
||||
$this->datev='';
|
||||
$this->amount='';
|
||||
@ -476,19 +479,19 @@ class Localtax extends CommonObject
|
||||
}
|
||||
|
||||
// Insertion dans table des paiement localtax
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."localtax (datep, datev, amount";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."localtax (localtaxtype, datep, datev, amount";
|
||||
if ($this->note) $sql.=", note";
|
||||
if ($this->label) $sql.=", label";
|
||||
$sql.= ", fk_user_creat, fk_bank";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES ('".$this->db->idate($this->datep)."',";
|
||||
$sql.= " VALUES (".$this->ltt.", '".$this->db->idate($this->datep)."',";
|
||||
$sql.= "'".$this->db->idate($this->datev)."'," . $this->amount;
|
||||
if ($this->note) $sql.=", '".$this->db->escape($this->note)."'";
|
||||
if ($this->label) $sql.=", '".$this->db->escape($this->label)."'";
|
||||
$sql.=", '".$user->id."', NULL";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::addPayment sql=".$sql);
|
||||
dol_syslog(get_class($this)."::addPayment", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
/* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -33,6 +33,8 @@ $langs->load("compta");
|
||||
$langs->load("companies");
|
||||
$langs->load("products");
|
||||
|
||||
$local=GETPOST('localTaxType', 'int');
|
||||
|
||||
// Date range
|
||||
$year=GETPOST("year");
|
||||
if (empty($year))
|
||||
@ -102,15 +104,17 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
||||
$fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
|
||||
|
||||
$calc=MAIN_INFO_LOCALTAX_CALC.$local;
|
||||
// Affiche en-tete du rapport
|
||||
if ($modetax==1) // Calculate on invoice for goods and services
|
||||
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
|
||||
{
|
||||
$nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
|
||||
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
|
||||
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$description=$langs->trans("RulesVATDue");
|
||||
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
|
||||
$builddate=time();
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
@ -120,14 +124,15 @@ if ($modetax==1) // Calculate on invoice for goods and services
|
||||
$productsup=$langs->trans("Description");
|
||||
$amountsup=$langs->trans("AmountHT");
|
||||
}
|
||||
if ($modetax==0) // Invoice for goods, payment for services
|
||||
if ($conf->global->$calc==2) // Invoice for goods, payment for services
|
||||
{
|
||||
$nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
|
||||
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
|
||||
$calcmode=$langs->trans("CalcModeLT2Debt");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$description=$langs->trans("RulesVATIn");
|
||||
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
|
||||
$builddate=time();
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
@ -137,173 +142,179 @@ if ($modetax==0) // Invoice for goods, payment for services
|
||||
$productsup=$langs->trans("Description");
|
||||
$amountsup=$langs->trans("AmountHT");
|
||||
}
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
$vatcust=$langs->transcountry("LT2",$mysoc->country_code);
|
||||
$vatsup=$langs->transcountry("LT2",$mysoc->country_code);
|
||||
|
||||
$vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
|
||||
$vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
|
||||
|
||||
// IRPF that the customer has retained me
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 2){
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Customer")."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalHT")."</td>";
|
||||
print "<td align=\"right\">".$vatcust."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Customer")."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalHT")."</td>";
|
||||
print "<td align=\"right\">".$vatcust."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
|
||||
|
||||
$action = "tvaclient";
|
||||
$object = &$coll_list;
|
||||
$parameters["mode"] = $modetax;
|
||||
$parameters["start"] = $date_start;
|
||||
$parameters["end"] = $date_end;
|
||||
$parameters["direction"] = 'sell';
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (is_array($coll_list))
|
||||
{
|
||||
$var=true;
|
||||
$total = 0; $totalamount = 0;
|
||||
$i = 1;
|
||||
foreach($coll_list as $coll)
|
||||
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
|
||||
|
||||
$action = "tvaclient";
|
||||
$object = &$coll_list;
|
||||
$parameters["mode"] = $modetax;
|
||||
$parameters["start"] = $date_start;
|
||||
$parameters["end"] = $date_end;
|
||||
$parameters["direction"] = 'sell';
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (is_array($coll_list))
|
||||
{
|
||||
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2!=0)
|
||||
$var=true;
|
||||
$total = 0; $totalamount = 0;
|
||||
$i = 1;
|
||||
foreach($coll_list as $coll)
|
||||
{
|
||||
$var=!$var;
|
||||
$intra = str_replace($find,$replace,$coll->tva_intra);
|
||||
if(empty($intra))
|
||||
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) !=0)
|
||||
{
|
||||
if($coll->assuj == '1')
|
||||
$var=!$var;
|
||||
$intra = str_replace($find,$replace,$coll->tva_intra);
|
||||
if(empty($intra))
|
||||
{
|
||||
$intra = $langs->trans('Unknown');
|
||||
}
|
||||
else
|
||||
{
|
||||
$intra = '';
|
||||
if($coll->assuj == '1')
|
||||
{
|
||||
$intra = $langs->trans('Unknown');
|
||||
}
|
||||
else
|
||||
{
|
||||
$intra = '';
|
||||
}
|
||||
}
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">'.$i."</td>";
|
||||
$company_static->id=$coll->socid;
|
||||
$company_static->nom=$coll->nom;
|
||||
print '<td class="nowrap">'.$company_static->getNomUrl(1).'</td>';
|
||||
$find = array(' ','.');
|
||||
$replace = array('','');
|
||||
print '<td class="nowrap">'.$intra."</td>";
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>";
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($local==1?$coll->localtax1:$coll->localtax2)."</td>";
|
||||
$totalamount = $totalamount + $coll->amount;
|
||||
$total = $total + ($local==1?$coll->localtax1:$coll->localtax2);
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">'.$i."</td>";
|
||||
$company_static->id=$coll->socid;
|
||||
$company_static->nom=$coll->nom;
|
||||
print '<td class="nowrap">'.$company_static->getNomUrl(1).'</td>';
|
||||
$find = array(' ','.');
|
||||
$replace = array('','');
|
||||
print '<td class="nowrap">'.$intra."</td>";
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>";
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($coll->localtax2)."</td>";
|
||||
$totalamount = $totalamount + $coll->amount;
|
||||
$total = $total + $coll->localtax2;
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$x_coll_sum = $total;
|
||||
|
||||
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
|
||||
print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($total).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$x_coll_sum = $total;
|
||||
|
||||
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
|
||||
print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($total).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($coll_list == -1)
|
||||
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
|
||||
else if ($coll_list == -2)
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
else
|
||||
print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($coll_list == -1)
|
||||
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
|
||||
else if ($coll_list == -2)
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
else
|
||||
print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// IRPF I retained my supplier
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 1){
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Supplier")."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalHT")."</td>";
|
||||
print "<td align=\"right\">".$vatsup."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Supplier")."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalHT")."</td>";
|
||||
print "<td align=\"right\">".$vatsup."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$company_static=new Societe($db);
|
||||
|
||||
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
|
||||
$parameters["direction"] = 'buy';
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (is_array($coll_list))
|
||||
{
|
||||
$var=true;
|
||||
$total = 0; $totalamount = 0;
|
||||
$i = 1;
|
||||
foreach($coll_list as $coll)
|
||||
$company_static=new Societe($db);
|
||||
|
||||
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
|
||||
$parameters["direction"] = 'buy';
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (is_array($coll_list))
|
||||
{
|
||||
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2!=0)
|
||||
$var=true;
|
||||
$total = 0; $totalamount = 0;
|
||||
$i = 1;
|
||||
foreach($coll_list as $coll)
|
||||
{
|
||||
$var=!$var;
|
||||
$intra = str_replace($find,$replace,$coll->tva_intra);
|
||||
if(empty($intra))
|
||||
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) != 0)
|
||||
{
|
||||
if($coll->assuj == '1')
|
||||
$var=!$var;
|
||||
$intra = str_replace($find,$replace,$coll->tva_intra);
|
||||
if(empty($intra))
|
||||
{
|
||||
$intra = $langs->trans('Unknown');
|
||||
}
|
||||
else
|
||||
{
|
||||
$intra = '';
|
||||
if($coll->assuj == '1')
|
||||
{
|
||||
$intra = $langs->trans('Unknown');
|
||||
}
|
||||
else
|
||||
{
|
||||
$intra = '';
|
||||
}
|
||||
}
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">'.$i."</td>";
|
||||
$company_static->id=$coll->socid;
|
||||
$company_static->nom=$coll->nom;
|
||||
print '<td class="nowrap">'.$company_static->getNomUrl(1).'</td>';
|
||||
$find = array(' ','.');
|
||||
$replace = array('','');
|
||||
print '<td class="nowrap">'.$intra."</td>";
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>";
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($local==1?$coll->localtax1:$coll->localtax2)."</td>";
|
||||
$totalamount = $totalamount + $coll->amount;
|
||||
$total = $total + ($local==1?$coll->localtax1:$coll->localtax2);
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">'.$i."</td>";
|
||||
$company_static->id=$coll->socid;
|
||||
$company_static->nom=$coll->nom;
|
||||
print '<td class="nowrap">'.$company_static->getNomUrl(1).'</td>';
|
||||
$find = array(' ','.');
|
||||
$replace = array('','');
|
||||
print '<td class="nowrap">'.$intra."</td>";
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>";
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($coll->localtax2)."</td>";
|
||||
$totalamount = $totalamount + $coll->amount;
|
||||
$total = $total + $coll->localtax2;
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$x_paye_sum = $total;
|
||||
|
||||
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
|
||||
print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($total).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
}
|
||||
$x_paye_sum = $total;
|
||||
|
||||
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
|
||||
print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($total).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Total to pay
|
||||
print '<br><br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
$diff = $x_paye_sum;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="liste_total" colspan="4">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').'</td>';
|
||||
print '<td class="liste_total nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($coll_list == -1)
|
||||
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
|
||||
else if ($coll_list == -2)
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
else
|
||||
print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($coll_list == -1)
|
||||
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
|
||||
else if ($coll_list == -2)
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
else
|
||||
print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if($conf->global->$calc ==0){
|
||||
// Total to pay
|
||||
print '<br><br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
$diff = $x_coll_sum - $x_paye_sum ;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="liste_total" colspan="4">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').'</td>';
|
||||
print '<td class="liste_total nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -30,7 +30,7 @@ $langs->load("banks");
|
||||
$langs->load("bills");
|
||||
|
||||
$id=$_REQUEST["id"];
|
||||
|
||||
$lttype=GETPOST('localTaxType', 'int');
|
||||
$mesg = '';
|
||||
|
||||
// Security check
|
||||
@ -44,6 +44,11 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
*/
|
||||
|
||||
//add payment of localtax
|
||||
if($_POST["cancel"] == $langs->trans("Cancel")){
|
||||
header("Location: reglement.php?localTaxType=".$lttype);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
{
|
||||
$localtax = new Localtax($db);
|
||||
@ -59,12 +64,13 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$localtax->datep=$datep;
|
||||
$localtax->amount=$_POST["amount"];
|
||||
$localtax->label=$_POST["label"];
|
||||
$localtax->ltt=$lttype;
|
||||
|
||||
$ret=$localtax->addPayment($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: reglement.php");
|
||||
header("Location: reglement.php?localTaxType=".$lttype);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -145,10 +151,11 @@ if ($_GET["action"] == 'create')
|
||||
{
|
||||
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="localTaxType" value="'.$lttype.'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print_fiche_titre($langs->transcountry("newLT2Payment",$mysoc->country_code));
|
||||
|
||||
print_fiche_titre($langs->transcountry($lttype==2?"newLT2Payment":"newLT1Payment",$mysoc->country_code));
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
@ -163,7 +170,7 @@ if ($_GET["action"] == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->transcountry("LT2Payment",$mysoc->country_code)).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->transcountry(($lttype==2?"LT2Payment":"LT1Payment"),$mysoc->country_code)).'"></td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("other");
|
||||
$localTaxType=GETPOST('localTaxType', 'int');
|
||||
|
||||
$year=$_GET["year"];
|
||||
if ($year == 0 )
|
||||
@ -95,24 +96,41 @@ function pt ($db, $sql, $date)
|
||||
|
||||
llxHeader();
|
||||
|
||||
$tva = new Tva($db);
|
||||
if($localTaxType==1)
|
||||
{
|
||||
$LT='LT1';
|
||||
$LTSummary='LT1Summary';
|
||||
$LTPaid='LT1Paid';
|
||||
$LTCustomer='LT1Customer';
|
||||
$LTSupplier='LT1Supplier';
|
||||
$CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$LT='LT2';
|
||||
$LTSummary='LT2Summary';
|
||||
$LTPaid='LT2Paid';
|
||||
$LTCustomer='LT2Customer';
|
||||
$LTSupplier='LT2Supplier';
|
||||
$CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC2;
|
||||
}
|
||||
|
||||
|
||||
$textprevyear="<a href=\"index.php?year=" . ($year_current-1) . "\">".img_previous()."</a>";
|
||||
$textnextyear=" <a href=\"index.php?year=" . ($year_current+1) . "\">".img_next()."</a>";
|
||||
$textprevyear="<a href=\"index.php?localTaxType=".$localTaxType."&year=" . ($year_current-1) . "\">".img_previous()."</a>";
|
||||
$textnextyear=" <a href=\"index.php?localTaxType=".$localTaxType."&year=" . ($year_current+1) . "\">".img_next()."</a>";
|
||||
|
||||
print_fiche_titre($langs->transcountry("LT2",$mysoc->country_code),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear");
|
||||
print_fiche_titre($langs->transcountry($LT,$mysoc->country_code),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear");
|
||||
|
||||
print $langs->trans("VATReportBuildWithOptionDefinedInModule").'<br>';
|
||||
print '('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')<br>';
|
||||
print $langs->trans("LTReportBuildWithOptionDefinedInModule").'<br>';
|
||||
print '('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr><td>';
|
||||
print_titre($langs->transcountry("LT2Summary",$mysoc->country_code));
|
||||
print_titre($langs->transcountry($LTSummary,$mysoc->country_code));
|
||||
|
||||
print '</td><td width="5"> </td><td>';
|
||||
print_titre($langs->transcountry("LT2Paid",$mysoc->country_code));
|
||||
print_titre($langs->transcountry($LTPaid,$mysoc->country_code));
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td width="50%" valign="top">';
|
||||
@ -120,8 +138,20 @@ print '<tr><td width="50%" valign="top">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td width=\"30%\">".$langs->trans("Year")." $y</td>";
|
||||
print "<td align=\"right\">".$langs->transcountry("LT2Customer",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->transcountry("LT2Supplier",$mysoc->country_code)."</td>";
|
||||
if($CalcLT==0)
|
||||
{
|
||||
print "<td align=\"right\">".$langs->transcountry($LTCustomer,$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->transcountry($LTSupplier,$mysoc->country_code)."</td>";
|
||||
}
|
||||
if($CalcLT==1)
|
||||
{
|
||||
print "<td align=\"right\">".$langs->transcountry($LTSupplier,$mysoc->country_code)."</td><td></td>";
|
||||
}
|
||||
if($CalcLT==2)
|
||||
{
|
||||
print "<td align=\"right\">".$langs->transcountry($LTCustomer,$mysoc->country_code)."</td><td></td>";
|
||||
}
|
||||
|
||||
print "<td align=\"right\">".$langs->trans("TotalToPay")."</td>";
|
||||
print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
@ -160,24 +190,59 @@ for ($m = 1 ; $m < 13 ; $m++ )
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">'.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").'</td>';
|
||||
|
||||
$x_coll = 0;
|
||||
foreach($coll_listsell as $vatrate=>$val)
|
||||
if($CalcLT==0)
|
||||
{
|
||||
$x_coll+=$val['localtax2'];
|
||||
}
|
||||
$subtotalcoll = $subtotalcoll + $x_coll;
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($x_coll)."</td>";
|
||||
$x_coll = 0;
|
||||
foreach($coll_listsell as $vatrate=>$val)
|
||||
{
|
||||
$x_coll+=$val[$localTaxType==1?'localtax1':'localtax2'];
|
||||
}
|
||||
$subtotalcoll = $subtotalcoll + $x_coll;
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($x_coll)."</td>";
|
||||
|
||||
$x_paye = 0;
|
||||
foreach($coll_listbuy as $vatrate=>$val)
|
||||
$x_paye = 0;
|
||||
foreach($coll_listbuy as $vatrate=>$val)
|
||||
{
|
||||
$x_paye+=$val[$localTaxType==1?'localtax1':'localtax2'];
|
||||
}
|
||||
$subtotalpaye = $subtotalpaye + $x_paye;
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td>";
|
||||
}
|
||||
elseif($CalcLT==1)
|
||||
{
|
||||
$x_paye+=$val['localtax2'];
|
||||
$x_paye = 0;
|
||||
foreach($coll_listbuy as $vatrate=>$val)
|
||||
{
|
||||
$x_paye+=$val[$localTaxType==1?'localtax1':'localtax2'];
|
||||
}
|
||||
$subtotalpaye = $subtotalpaye + $x_paye;
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td><td></td>";
|
||||
}
|
||||
$subtotalpaye = $subtotalpaye + $x_paye;
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td>";
|
||||
|
||||
$diff = $x_coll - $x_paye;
|
||||
elseif($CalcLT==2)
|
||||
{
|
||||
$x_coll = 0;
|
||||
foreach($coll_listsell as $vatrate=>$val)
|
||||
{
|
||||
$x_coll+=$val[$localTaxType==1?'localtax1':'localtax2'];
|
||||
}
|
||||
$subtotalcoll = $subtotalcoll + $x_coll;
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($x_coll)."</td><td></td>";
|
||||
|
||||
}
|
||||
|
||||
if($CalcLT==0)
|
||||
{
|
||||
$diff= $x_coll - $x_paye;
|
||||
}
|
||||
elseif($CalcLT==1)
|
||||
{
|
||||
$diff= $x_paye;
|
||||
}
|
||||
elseif($CalcLT==2)
|
||||
{
|
||||
$diff= $x_coll;
|
||||
}
|
||||
|
||||
$total = $total + $diff;
|
||||
$subtotal = $subtotal + $diff;
|
||||
|
||||
@ -186,12 +251,26 @@ for ($m = 1 ; $m < 13 ; $m++ )
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
if ($i > 2) {
|
||||
if ($i > 2)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="right">'.$langs->trans("SubTotal").':</td>';
|
||||
print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
|
||||
if($CalcLT==0)
|
||||
{
|
||||
print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
|
||||
}
|
||||
elseif($CalcLT==1)
|
||||
{
|
||||
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td><td></td>';
|
||||
print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
|
||||
}
|
||||
elseif($CalcLT==2)
|
||||
{
|
||||
print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td><td></td>';
|
||||
print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
|
||||
}
|
||||
print '<td> </td></tr>';
|
||||
$i = 0;
|
||||
$subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
|
||||
@ -214,6 +293,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."localtax as f";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'";
|
||||
$sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'";
|
||||
$sql.= " AND localtaxtype=".$localTaxType;
|
||||
$sql.= " GROUP BY dm ASC";
|
||||
|
||||
pt($db, $sql,$langs->trans("Year")." $y");
|
||||
|
||||
669
htdocs/compta/localtax/quadri_detail.php
Normal file
669
htdocs/compta/localtax/quadri_detail.php
Normal file
@ -0,0 +1,669 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2014 Rosana Romero <rromero@2byte.es>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/tva/quadri_detail.php
|
||||
* \ingroup tax
|
||||
* \brief Trimestrial page - detailed version
|
||||
* TODO Deal with recurrent invoices as well
|
||||
*/
|
||||
global $mysoc;
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
$langs->load("companies");
|
||||
$langs->load("products");
|
||||
|
||||
$local=GETPOST('localTaxType', 'int');
|
||||
// Date range
|
||||
$year=GETPOST("year");
|
||||
if (empty($year))
|
||||
{
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
}
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
// Quarter
|
||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
{
|
||||
$q=GETPOST("q");
|
||||
if (empty($q))
|
||||
{
|
||||
if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); }
|
||||
else
|
||||
{
|
||||
$month_current = strftime("%m",dol_now());
|
||||
if ($month_current >= 10) $q=4;
|
||||
elseif ($month_current >= 7) $q=3;
|
||||
elseif ($month_current >= 4) $q=2;
|
||||
else $q=1;
|
||||
}
|
||||
}
|
||||
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
||||
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||
}
|
||||
|
||||
$min = GETPOST("min");
|
||||
if (empty($min)) $min = 0;
|
||||
|
||||
// Define modetax (0 or 1)
|
||||
// 0=normal, 1=option vat for services is on debit
|
||||
$modetax = $conf->global->TAX_MODE;
|
||||
if (isset($_REQUEST["modetax"])) $modetax=$_REQUEST["modetax"];
|
||||
if (empty($modetax)) $modetax=0;
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$morequerystring='';
|
||||
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
||||
foreach($listofparams as $param)
|
||||
{
|
||||
if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
|
||||
}
|
||||
|
||||
llxHeader('','','','',0,0,'','',$morequerystring);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$company_static=new Societe($db);
|
||||
$invoice_customer=new Facture($db);
|
||||
$invoice_supplier=new FactureFournisseur($db);
|
||||
$product_static=new Product($db);
|
||||
$payment_static=new Paiement($db);
|
||||
$paymentfourn_static=new PaiementFourn($db);
|
||||
|
||||
//print_fiche_titre($langs->trans("VAT"),"");
|
||||
|
||||
//$fsearch.='<br>';
|
||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
||||
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
|
||||
|
||||
$calc=MAIN_INFO_LOCALTAX_CALC.$local;
|
||||
// Affiche en-tete du rapport
|
||||
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
|
||||
{
|
||||
$nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode");
|
||||
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$prevyear=$year_start; $prevquarter=$q;
|
||||
if ($prevquarter > 1) $prevquarter--;
|
||||
else { $prevquarter=4; $prevyear--; }
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
$amountcust=$langs->trans("AmountHT");
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
||||
$elementsup=$langs->trans("SuppliersInvoices");
|
||||
$productsup=$langs->trans("ProductOrService");
|
||||
$amountsup=$langs->trans("AmountHT");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
}
|
||||
if ($conf->global->$calc==2) // Invoice for goods, payment for services
|
||||
{
|
||||
$nom=$langs->trans($local==1?"LT1ReportByQuartersInInputOutputMode":"LT2ReportByQuartersInInputOutputMode");
|
||||
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$prevyear=$year_start; $prevquarter=$q;
|
||||
if ($prevquarter > 1) $prevquarter--;
|
||||
else { $prevquarter=4; $prevyear--; }
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
$amountcust=$langs->trans("AmountHT");
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
||||
$elementsup=$langs->trans("SuppliersInvoices");
|
||||
$productsup=$langs->trans("ProductOrService");
|
||||
$amountsup=$langs->trans("AmountHT");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
}
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
|
||||
if($local==1){
|
||||
$vatcust=$langs->transcountry("LocalTax1", $mysoc->country_code);
|
||||
$vatsup=$langs->transcountry("LocalTax1", $mysoc->country_code);
|
||||
}else{
|
||||
$vatcust=$langs->transcountry("LocalTax2", $mysoc->country_code);
|
||||
$vatsup=$langs->transcountry("LocalTax2", $mysoc->country_code);
|
||||
}
|
||||
|
||||
// VAT Received and paid
|
||||
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
$total = 0;
|
||||
$i=0;
|
||||
|
||||
// Load arrays of datas
|
||||
$x_coll= local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell', $local);
|
||||
//$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||
$x_paye = local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy', $local);
|
||||
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
|
||||
if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($x_coll == -1)
|
||||
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
|
||||
else if ($x_coll == -2)
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
else
|
||||
print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$x_both = array();
|
||||
//now, from these two arrays, get another array with one rate per line
|
||||
foreach(array_keys($x_coll) as $my_coll_rate)
|
||||
{
|
||||
//foreach($x_coll[$my_coll_rate][localtax1_list]){
|
||||
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
|
||||
$x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat'];
|
||||
$x_both[$my_coll_rate]['paye']['totalht'] = 0;
|
||||
$x_both[$my_coll_rate]['paye']['vat'] = 0;
|
||||
$x_both[$my_coll_rate]['coll']['links'] = '';
|
||||
$x_both[$my_coll_rate]['coll']['detail'] = array();
|
||||
foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy)
|
||||
{
|
||||
$invoice_customer->id=$x_coll[$my_coll_rate]['facid'][$id];
|
||||
$invoice_customer->ref=$x_coll[$my_coll_rate]['facnum'][$id];
|
||||
$invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id];
|
||||
$x_both[$my_coll_rate]['coll']['detail'][] = array(
|
||||
'id' =>$x_coll[$my_coll_rate]['facid'][$id],
|
||||
'descr' =>$x_coll[$my_coll_rate]['descr'][$id],
|
||||
'pid' =>$x_coll[$my_coll_rate]['pid'][$id],
|
||||
'pref' =>$x_coll[$my_coll_rate]['pref'][$id],
|
||||
'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id],
|
||||
'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id],
|
||||
'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id],
|
||||
'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id],
|
||||
'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id],
|
||||
'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id],
|
||||
'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id],
|
||||
'localtax1'=> $x_coll[$my_coll_rate]['localtax1_list'][$id],
|
||||
'localtax2'=> $x_coll[$my_coll_rate]['localtax2_list'][$id],
|
||||
'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id],
|
||||
'link' =>$invoice_customer->getNomUrl(1,'',12));
|
||||
}
|
||||
}
|
||||
// tva paid
|
||||
foreach(array_keys($x_paye) as $my_paye_rate){
|
||||
$x_both[$my_paye_rate]['paye']['totalht'] = $x_paye[$my_paye_rate]['totalht'];
|
||||
$x_both[$my_paye_rate]['paye']['vat'] = $x_paye[$my_paye_rate]['vat'];
|
||||
if(!isset($x_both[$my_paye_rate]['coll']['totalht'])){
|
||||
$x_both[$my_paye_rate]['coll']['totalht'] = 0;
|
||||
$x_both[$my_paye_rate]['coll']['vat'] = 0;
|
||||
}
|
||||
$x_both[$my_paye_rate]['paye']['links'] = '';
|
||||
$x_both[$my_paye_rate]['paye']['detail'] = array();
|
||||
|
||||
foreach($x_paye[$my_paye_rate]['facid'] as $id=>$dummy)
|
||||
{
|
||||
$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];
|
||||
$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];
|
||||
$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id];
|
||||
$x_both[$my_paye_rate]['paye']['detail'][] = array(
|
||||
'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
||||
'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
||||
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
||||
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
||||
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
||||
'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id],
|
||||
'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
||||
'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
||||
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
||||
'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
||||
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
||||
'localtax1'=> $x_paye[$my_paye_rate]['localtax1_list'][$id],
|
||||
'localtax2'=> $x_paye[$my_paye_rate]['localtax2_list'][$id],
|
||||
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
||||
'link' =>$invoice_supplier->getNomUrl(1,'',12));
|
||||
}
|
||||
}
|
||||
//now we have an array (x_both) indexed by rates for coll and paye
|
||||
|
||||
|
||||
//print table headers for this quadri - incomes first
|
||||
|
||||
$x_coll_sum = 0;
|
||||
$x_coll_ht = 0;
|
||||
$x_paye_sum = 0;
|
||||
$x_paye_ht = 0;
|
||||
|
||||
$span=3;
|
||||
if ($modetax == 0) $span+=2;
|
||||
|
||||
//print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
|
||||
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 2){
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementcust.'</td>';
|
||||
print '<td align="left">'.$productcust.'</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td align="right">'.$amountcust.'</td>';
|
||||
print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
}
|
||||
print '<td align="right">'.$langs->trans("BI").'</td>';
|
||||
print '<td align="right">'.$vatcust.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$LT=0;
|
||||
$sameLT=false;
|
||||
foreach(array_keys($x_coll) as $rate)
|
||||
{
|
||||
$subtot_coll_total_ht = 0;
|
||||
$subtot_coll_vat = 0;
|
||||
|
||||
if (is_array($x_both[$rate]['coll']['detail']))
|
||||
{
|
||||
// VAT Rate
|
||||
$var=true;
|
||||
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
//print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
/**/
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
foreach($x_both[$rate]['coll']['detail'] as $index => $fields)
|
||||
{
|
||||
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0)){
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($fields['ddate_start'])) $type=1;
|
||||
if (! empty($fields['ddate_end'])) $type=1;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg))
|
||||
{
|
||||
if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit');
|
||||
elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
|
||||
else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||
}
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
|
||||
// Show range
|
||||
print_date_range($fields['ddate_start'],$fields['ddate_end']);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right">';
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax == 0)
|
||||
{
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap" align="right">';
|
||||
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$payment_static->id=$fields['payment_id'];
|
||||
print $payment_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0)
|
||||
{
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
}
|
||||
else {
|
||||
print $fields['payment_amount'];
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Total collected
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_ht=$fields['totalht'];
|
||||
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_ht,'MT'));
|
||||
print '</td>';
|
||||
|
||||
// Localtax
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_vat= $local==1?$fields['localtax1']:$fields['localtax2'];
|
||||
print price(price2num($temp_vat,'MT'));
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_coll_total_ht += $temp_ht;
|
||||
$subtot_coll_vat += $temp_vat;
|
||||
$x_coll_sum += $temp_vat;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($rate!=0){
|
||||
// Total customers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num($subtot_coll_total_ht,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtot_coll_vat,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if (count($x_coll) == 0) // Show a total ine if nothing shown
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Blank line
|
||||
print '<tr><td colspan="'.($span+1).'"> </td></tr>';
|
||||
print '</table>';
|
||||
$diff=$x_coll_sum;
|
||||
}
|
||||
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 1){
|
||||
echo '<table class="noborder" width="100%">';
|
||||
//print table headers for this quadri - expenses now
|
||||
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td align="right">'.$amountsup.'</td>';
|
||||
print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
}
|
||||
print '<td align="right">'.$langs->trans("BI").'</td>';
|
||||
print '<td align="right">'.$vatsup.'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach(array_keys($x_paye) as $rate)
|
||||
{
|
||||
$subtot_paye_total_ht = 0;
|
||||
$subtot_paye_vat = 0;
|
||||
|
||||
if(is_array($x_both[$rate]['paye']['detail']))
|
||||
{
|
||||
$var=true;
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
foreach($x_both[$rate]['paye']['detail'] as $index=>$fields)
|
||||
{
|
||||
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0)){
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($fields['ddate_start'])) $type=1;
|
||||
if (! empty($fields['ddate_end'])) $type=1;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
|
||||
// Show range
|
||||
print_date_range($fields['ddate_start'],$fields['ddate_end']);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right">';
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax == 0)
|
||||
{
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap" align="right">';
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$paymentfourn_static->id=$fields['payment_id'];
|
||||
print $paymentfourn_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0)
|
||||
{
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
}
|
||||
else
|
||||
{
|
||||
print $fields['payment_amount'];
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// VAT paid
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_ht=$fields['totalht'];
|
||||
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_ht,'MT'));
|
||||
print '</td>';
|
||||
|
||||
// Localtax
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_vat= $local==1?$fields['localtax1']:$fields['localtax2'];
|
||||
print price(price2num($temp_vat,'MT'));
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_paye_total_ht += $temp_ht;
|
||||
$subtot_paye_vat += $temp_vat;
|
||||
$x_paye_sum += $temp_vat;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($rate!=0){
|
||||
// Total suppliers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num($subtot_paye_total_ht,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtot_paye_vat,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if (count($x_paye) == 0) // Show a total ine if nothing shown
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
$diff=$x_paye_sum;
|
||||
}
|
||||
|
||||
if($conf->global->$calc ==0){$diff=$x_coll_sum - $x_paye_sum;}
|
||||
echo '<table class="noborder" width="100%">';
|
||||
// Total to pay
|
||||
print '<br><br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
//$diff = $local==1?$x_coll_sum:$x_paye_sum;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="liste_total" colspan="'.$span.'">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').'</td>';
|
||||
print '<td class="liste_total nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
echo '</table>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -31,6 +31,7 @@ $langs->load("compta");
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
$ltt=$_REQUEST["localTaxType"];
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -40,11 +41,11 @@ llxHeader();
|
||||
|
||||
$localtax_static = new Localtax($db);
|
||||
|
||||
print_fiche_titre($langs->transcountry("LT2Payments",$mysoc->country_code));
|
||||
print_fiche_titre($langs->transcountry($ltt==2?"LT2Payments":"LT1Payments",$mysoc->country_code));
|
||||
|
||||
$sql = "SELECT rowid, amount, label, f.datev as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."localtax as f ";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " WHERE f.entity = ".$conf->entity." AND localtaxtype=".$ltt;
|
||||
$sql.= " ORDER BY dm DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -73,7 +73,7 @@ class RemiseCheque extends CommonObject
|
||||
if ($id) $sql.= " AND bc.rowid = ".$id;
|
||||
if ($ref) $sql.= " AND bc.number = '".$this->db->escape($ref)."'";
|
||||
|
||||
dol_syslog("RemiseCheque::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -155,7 +155,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= ", ''";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
@ -172,7 +172,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " SET number='(PROV".$this->id.")'";
|
||||
$sql.= " WHERE rowid='".$this->id."';";
|
||||
|
||||
dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -192,7 +192,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " AND b.fk_account='".$account_id."'";
|
||||
if ($limit) $sql.= $this->db->plimit($limit);
|
||||
|
||||
dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -225,7 +225,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " SET fk_bordereau = ".$this->id;
|
||||
$sql.= " WHERE rowid = ".$lineid;
|
||||
|
||||
dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
@ -250,7 +250,6 @@ class RemiseCheque extends CommonObject
|
||||
$this->errno = -1;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->errno=$this->db->lasterrno();
|
||||
dol_syslog("RemiseCheque::Create Error ".$this->error, LOG_ERR);
|
||||
}
|
||||
|
||||
if (! $this->errno && ! empty($conf->global->MAIN_DISABLEDRAFTSTATUS))
|
||||
@ -351,7 +350,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND statut = 0";
|
||||
|
||||
dol_syslog("RemiseCheque::Validate sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::Validate", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
@ -410,7 +409,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " AND number not like '(%'";
|
||||
|
||||
dol_syslog("Remisecheque::getNextNumber sql=".$sql);
|
||||
dol_syslog("Remisecheque::getNextNumber", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -510,7 +509,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " AND bc.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY b.dateo ASC, b.rowid ASC";
|
||||
|
||||
dol_syslog("RemiseCheque::generatePdf sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::generatePdf", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -705,7 +704,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " SET date_bordereau = ".($date ? $this->db->idate($date) : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("RemiseCheque::set_date sql=$sql",LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::set_date", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -715,7 +714,6 @@ class RemiseCheque extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("RemiseCheque::set_date ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -740,7 +738,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " SET number = '".$number."'" ;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("RemiseCheque::set_number sql=$sql",LOG_DEBUG);
|
||||
dol_syslog("RemiseCheque::set_number", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -750,7 +748,6 @@ class RemiseCheque extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("RemiseCheque::set_number ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,7 +609,6 @@ else
|
||||
$sql.= " AND b.fk_bordereau = ".$object->id;
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -81,7 +81,7 @@ class Paiement extends CommonObject
|
||||
$sql.= ' WHERE p.fk_paiement = c.id';
|
||||
$sql.= ' AND p.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
@ -161,7 +161,7 @@ class Paiement extends CommonObject
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)";
|
||||
$sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")";
|
||||
|
||||
dol_syslog(get_class($this)."::Create insert paiement sql=".$sql);
|
||||
dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -177,7 +177,7 @@ class Paiement extends CommonObject
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiement_facture (fk_facture, fk_paiement, amount)';
|
||||
$sql .= ' VALUES ('.$facid.', '. $this->id.', \''.$amount.'\')';
|
||||
|
||||
dol_syslog(get_class($this).'::Create Amount line '.$key.' insert paiement_facture sql='.$sql);
|
||||
dol_syslog(get_class($this).'::Create Amount line '.$key.' insert paiement_facture', LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -235,7 +235,6 @@ class Paiement extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::Create insert paiement_facture error='.$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -256,7 +255,6 @@ class Paiement extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::Create insert paiement error='.$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -559,7 +557,7 @@ class Paiement extends CommonObject
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' set fk_bank = '.$id_bank;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this).'::update_fk_bank sql='.$sql);
|
||||
dol_syslog(get_class($this).'::update_fk_bank', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -587,7 +585,7 @@ class Paiement extends CommonObject
|
||||
$sql.= " SET datep = '".$this->db->idate($date)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_date sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_date", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -598,7 +596,6 @@ class Paiement extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error='Error -1 '.$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_date ".$this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -619,7 +616,7 @@ class Paiement extends CommonObject
|
||||
$sql.= " SET num_paiement = '".$this->db->escape($num)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_num sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_num", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -629,7 +626,6 @@ class Paiement extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error='Error -1 '.$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_num ".$this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -645,7 +641,7 @@ class Paiement extends CommonObject
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this).'::valide sql='.$sql);
|
||||
dol_syslog(get_class($this).'::valide', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -669,7 +665,7 @@ class Paiement extends CommonObject
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p';
|
||||
$sql.= ' WHERE p.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this).'::info sql='.$sql);
|
||||
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
@ -732,7 +728,7 @@ class Paiement extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' - sql='.$sql);
|
||||
dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' -', LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ $sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id';
|
||||
$sql.= ' AND f.entity = '.$conf->entity;
|
||||
$sql.= ' AND pf.rowid = '.$paiement->id;
|
||||
|
||||
dol_syslog("compta/payment_sc/fiche.php sql=".$sql);
|
||||
dol_syslog("compta/payment_sc/fiche.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -279,7 +279,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= " WHERE p.rowid = ".$rowid;
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -314,7 +314,6 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this)."::Fetch Erreur sql=".$sql, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -557,8 +556,6 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_infotrans Erreur 1", LOG_ERR);
|
||||
dol_syslog($this->db->error());
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -705,6 +702,7 @@ class BonPrelevement extends CommonObject
|
||||
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
|
||||
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
|
||||
|
||||
dol_syslog(get_class($this)."::SommeAPrelever");
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
@ -718,7 +716,6 @@ class BonPrelevement extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=get_class($this)."::SommeAPrelever Erreur -1 sql=".$this->db->error();
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -779,7 +776,7 @@ class BonPrelevement extends CommonObject
|
||||
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
|
||||
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
|
||||
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -896,7 +893,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= " WHERE ref LIKE '".$ref."%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
@ -922,7 +919,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
@ -983,7 +980,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= ", fk_prelevement_bons = ".$prev_id;
|
||||
$sql.= " WHERE rowid = ".$fac[1];
|
||||
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -1040,7 +1037,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= " WHERE rowid = ".$prev_id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
|
||||
@ -190,7 +190,7 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY s.nom, s.rowid";
|
||||
$sql.= " ORDER BY s.nom, s.rowid";
|
||||
|
||||
dol_syslog("get customer invoices sql=".$sql);
|
||||
dol_syslog("get customer invoices", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -235,7 +235,7 @@ if ($modecompta != 'CREANCES-DETTES')
|
||||
$sql.= " GROUP BY nom, idp";
|
||||
$sql.= " ORDER BY nom";
|
||||
|
||||
dol_syslog("get old customer payments not linked to invoices sql=".$sql);
|
||||
dol_syslog("get old customer payments not linked to invoices", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -320,7 +320,7 @@ print '<tr><td colspan="4">'.$langs->trans("SuppliersInvoices").'</td></tr>';
|
||||
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
dol_syslog("get suppliers invoices sql=".$sql);
|
||||
dol_syslog("get suppliers invoices", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -401,7 +401,7 @@ $sql.= " AND cs.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY c.libelle, c.id";
|
||||
$sql.= " ORDER BY c.libelle, c.id";
|
||||
|
||||
dol_syslog("get social contributions deductible=0 sql=".$sql);
|
||||
dol_syslog("get social contributions deductible=0", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
@ -478,7 +478,7 @@ else
|
||||
$sql.= " ORDER BY c.libelle, c.id";
|
||||
}
|
||||
|
||||
dol_syslog("get social contributions deductible=1 sql=".$sql);
|
||||
dol_syslog("get social contributions deductible=1", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
@ -564,7 +564,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
dol_syslog("get vat to pay sql=".$sql);
|
||||
dol_syslog("get vat to pay", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -609,7 +609,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
dol_syslog("get vat received back sql=".$sql);
|
||||
dol_syslog("get vat received back", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -653,7 +653,7 @@ else
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
dol_syslog("get vat really paid sql=".$sql);
|
||||
dol_syslog("get vat really paid", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -694,7 +694,7 @@ else
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
dol_syslog("get vat really received back sql=".$sql);
|
||||
dol_syslog("get vat really received back", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@ -123,7 +123,7 @@ $sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
//print $sql;
|
||||
dol_syslog("get customers invoices sql=".$sql);
|
||||
dol_syslog("get customers invoices", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -157,7 +157,7 @@ if ($modecompta != 'CREANCES-DETTES')
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
dol_syslog("get old customers payments not linked to invoices sql=".$sql);
|
||||
dol_syslog("get old customers payments not linked to invoices", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -208,7 +208,7 @@ $sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
dol_syslog("get suppliers invoices sql=".$sql);
|
||||
dol_syslog("get suppliers invoices", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -249,7 +249,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
dol_syslog("get vat to pay sql=".$sql);
|
||||
dol_syslog("get vat to pay", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -280,7 +280,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
dol_syslog("get vat to receive back sql=".$sql);
|
||||
dol_syslog("get vat to receive back", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -311,7 +311,7 @@ else {
|
||||
$sql.= " AND t.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
dol_syslog("get vat really paid sql=".$sql);
|
||||
dol_syslog("get vat really paid", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -340,7 +340,7 @@ else {
|
||||
$sql.= " AND t.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
dol_syslog("get vat really received back sql=".$sql);
|
||||
dol_syslog("get vat really received back", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -390,7 +390,7 @@ else
|
||||
$sql.= " AND cs.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY c.libelle, dm";
|
||||
|
||||
dol_syslog("get social contributions deductible=0 sql=".$sql);
|
||||
dol_syslog("get social contributions deductible=0 ", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -440,7 +440,7 @@ else
|
||||
$sql.= " AND cs.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY c.libelle, dm";
|
||||
|
||||
dol_syslog("get social contributions paid deductible=1 sql=".$sql);
|
||||
dol_syslog("get social contributions paid deductible=1", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@ -114,12 +114,11 @@ class PaymentSalary extends CommonObject
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -174,7 +173,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
||||
$sql.= " WHERE s.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -209,7 +208,6 @@ class PaymentSalary extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -230,12 +228,11 @@ class PaymentSalary extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -355,7 +352,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -74,7 +74,7 @@ class ChargeSociales extends CommonObject
|
||||
$sql.= " WHERE cs.fk_type = c.id";
|
||||
$sql.= " AND cs.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -137,7 +137,7 @@ class ChargeSociales extends CommonObject
|
||||
$sql.= " ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -192,7 +192,7 @@ class ChargeSociales extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge where fk_charge='".$this->id."'";
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -204,7 +204,7 @@ class ChargeSociales extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid='".$this->id."'";
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -243,7 +243,7 @@ class ChargeSociales extends CommonObject
|
||||
$sql.= " periode='".$this->db->idate($this->periode)."'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -419,7 +419,7 @@ class ChargeSociales extends CommonObject
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$table;
|
||||
$sql.= ' WHERE '.$field.' = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::getSommePaiement sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -449,7 +449,7 @@ class ChargeSociales extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
|
||||
$sql.= " WHERE e.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::info sql=".$sql);
|
||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -116,7 +116,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
$sql.= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.",";
|
||||
$sql.= " 0)";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -139,7 +139,6 @@ class PaymentSocialContribution extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -173,7 +172,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
||||
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -209,7 +208,6 @@ class PaymentSocialContribution extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -263,7 +261,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -321,7 +319,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url";
|
||||
$sql.= " WHERE type='payment_sc' AND url_id=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
@ -331,7 +329,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
@ -560,7 +558,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_fk_bank sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -569,7 +567,6 @@ class PaymentSocialContribution extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_fk_bank ".$this->error, LOG_ERR);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql.= " GROUP BY p.rowid";
|
||||
$sql.= " ORDER BY p.ref";
|
||||
|
||||
dol_syslog("cabyprodserv sql=".$sql);
|
||||
dol_syslog("cabyprodserv", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@ -250,7 +250,7 @@ $sql.= " GROUP BY s.rowid, s.nom";
|
||||
$sql.= " ORDER BY s.rowid";
|
||||
//echo $sql;
|
||||
|
||||
dol_syslog("casoc sql=".$sql);
|
||||
dol_syslog("casoc", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@ -115,7 +115,7 @@ class Tva extends CommonObject
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -133,7 +133,6 @@ class Tva extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -178,12 +177,11 @@ class Tva extends CommonObject
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -233,7 +231,7 @@ class Tva extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -265,7 +263,6 @@ class Tva extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -286,12 +283,11 @@ class Tva extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."tva";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -539,7 +535,7 @@ class Tva extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::addPayment sql=".$sql);
|
||||
dol_syslog(get_class($this)."::addPayment", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -155,7 +155,7 @@ class Contact extends CommonObject
|
||||
$sql.= " ".(! empty($this->import_key)?"'".$this->import_key."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -276,7 +276,7 @@ class Contact extends CommonObject
|
||||
$sql .= ", no_email=".($this->no_email?"'".$this->no_email."'":"0");
|
||||
$sql .= " WHERE rowid=".$this->db->escape($id);
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -328,7 +328,6 @@ class Contact extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror().' sql='.$sql;
|
||||
dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -444,7 +443,7 @@ class Contact extends CommonObject
|
||||
if ($user) $sql .= ", fk_user_modif=".$user->id;
|
||||
$sql.= " WHERE rowid=".$this->db->escape($id);
|
||||
|
||||
dol_syslog(get_class($this)."::update_perso this->birthday=".$this->birthday." - sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_perso this->birthday=".$this->birthday." -", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -523,7 +522,7 @@ class Contact extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
$sql.= " WHERE c.rowid = ". $id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -599,7 +598,6 @@ class Contact extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -624,7 +622,6 @@ class Contact extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -640,7 +637,6 @@ class Contact extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -664,7 +660,7 @@ class Contact extends CommonObject
|
||||
$sql.=" AND fk_socpeople = ". $this->id;
|
||||
$sql.=" GROUP BY tc.element";
|
||||
|
||||
dol_syslog(get_class($this)."::load_ref_elements sql=".$sql);
|
||||
dol_syslog(get_class($this)."::load_ref_elements", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -685,7 +681,6 @@ class Contact extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." - ".$sql;
|
||||
dol_syslog(get_class($this)."::load_ref_elements Error ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -716,7 +711,7 @@ class Contact extends CommonObject
|
||||
$sql.= " WHERE ec.fk_socpeople=".$this->id;
|
||||
$sql.= " AND ec.fk_c_type_contact=tc.rowid";
|
||||
$sql.= " AND tc.source='external'";
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -729,7 +724,7 @@ class Contact extends CommonObject
|
||||
|
||||
$sqldel = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
|
||||
$sqldel.=" WHERE rowid = ".$obj->rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sqldel);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sqldel);
|
||||
if (! $result)
|
||||
{
|
||||
@ -751,14 +746,13 @@ class Contact extends CommonObject
|
||||
{
|
||||
// Remove category
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".$this->id;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error .= $this->db->lasterror();
|
||||
$errorflag=-1;
|
||||
dol_syslog(get_class($this)."::delete error ".$errorflag." ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,7 +760,7 @@ class Contact extends CommonObject
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople";
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
@ -866,7 +860,7 @@ class Contact extends CommonObject
|
||||
$sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'";
|
||||
$sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes
|
||||
|
||||
dol_syslog(get_class($this)."::getNbOfEMailings sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getNbOfEMailings", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -1070,7 +1064,7 @@ class Contact extends CommonObject
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
dol_syslog(get_class($this)."::setstatus sql=".$sql);
|
||||
dol_syslog(get_class($this)."::setstatus", LOG_DEBUG);
|
||||
if ($result)
|
||||
{
|
||||
// Appel des triggers
|
||||
|
||||
@ -1071,11 +1071,14 @@ else
|
||||
|
||||
print "</div><br>";
|
||||
|
||||
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
|
||||
|
||||
print show_actions_todo($conf,$langs,$db,$objsoc,$object);
|
||||
print show_actions_todo($conf,$langs,$db,$objsoc,$object);
|
||||
|
||||
print show_actions_done($conf,$langs,$db,$objsoc,$object);
|
||||
print show_actions_done($conf,$langs,$db,$objsoc,$object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ else
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
dol_syslog("contact/list.php sql=".$sql);
|
||||
dol_syslog("contact/list.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
@ -154,16 +154,14 @@ class Contrat extends CommonObject
|
||||
$sql.= " commentaire = '".$this->db->escape($comment)."'";
|
||||
$sql.= " WHERE rowid = ".$line_id . " AND (statut = 0 OR statut = 3 OR statut = 5)";
|
||||
|
||||
dol_syslog(get_class($this)."::active_line sql=".$sql);
|
||||
dol_syslog(get_class($this)."::active_line", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_SERVICE_ACTIVATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_SERVICE_ACTIVATE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -171,7 +169,6 @@ class Contrat extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::active_line error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -206,12 +203,10 @@ class Contrat extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_SERVICE_CLOSE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_SERVICE_CLOSE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -219,7 +214,6 @@ class Contrat extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::close_line error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -315,13 +309,13 @@ class Contrat extends CommonObject
|
||||
//$sql.= ", fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'";
|
||||
$sql .= " WHERE rowid = ".$this->id . " AND statut = 0";
|
||||
|
||||
dol_syslog(get_class($this)."::validate sql=".$sql);
|
||||
dol_syslog(get_class($this)."::validate", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate Echec update - 10 - sql=".$sql, LOG_ERR);
|
||||
dol_print_error($this->db);
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -365,12 +359,10 @@ class Contrat extends CommonObject
|
||||
// Trigger calls
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_VALIDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_VALIDATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -386,7 +378,6 @@ class Contrat extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -416,7 +407,7 @@ class Contrat extends CommonObject
|
||||
}
|
||||
else $sql.= " WHERE rowid=".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -505,7 +496,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid";
|
||||
$sql.= " ORDER by d.rowid ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_lines sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -756,12 +747,10 @@ class Contrat extends CommonObject
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -776,7 +765,6 @@ class Contrat extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$interface->error;
|
||||
dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR);
|
||||
|
||||
$this->db->rollback();
|
||||
@ -794,8 +782,7 @@ class Contrat extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("UnknownError: ".$this->db->error()." - sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create - 10 - ".$this->error, LOG_ERR);
|
||||
$this->error=$langs->trans("UnknownError: ".$this->db->error()." -", LOG_DEBUG);
|
||||
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
@ -840,7 +827,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet_log as cdl, ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " WHERE cdl.fk_contratdet=cd.rowid AND cd.fk_contrat=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete contratdet_log sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete contratdet_log", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -861,7 +848,7 @@ class Contrat extends CommonObject
|
||||
$sql= "DELETE FROM ".MAIN_DB_PREFIX."contratdet_log ";
|
||||
$sql.= " WHERE ".MAIN_DB_PREFIX."contratdet_log.rowid IN (".implode(",",$tab_resql).")";
|
||||
|
||||
dol_syslog(get_class($this)."::delete contratdet_log sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete contratdet_log", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -877,7 +864,7 @@ class Contrat extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
|
||||
$sql.= " WHERE fk_contrat=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete contratdet sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete contratdet", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -892,7 +879,7 @@ class Contrat extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete contrat sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete contrat", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -903,14 +890,10 @@ class Contrat extends CommonObject
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_DELETE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -939,8 +922,7 @@ class Contrat extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::delete ERROR ".$this->error, LOG_ERR);
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1008,7 +990,7 @@ class Contrat extends CommonObject
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,'', $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
@ -1067,7 +1049,7 @@ class Contrat extends CommonObject
|
||||
if ($date_end > 0) { $sql.= ",'".$this->db->idate($date_end)."'"; }
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::addline sql=".$sql);
|
||||
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1080,7 +1062,6 @@ class Contrat extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1089,7 +1070,6 @@ class Contrat extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dol_syslog(get_class($this)."::addline ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1156,7 +1136,7 @@ class Contrat extends CommonObject
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($tvatx,0,$mysoc);
|
||||
$localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc);
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
@ -1214,7 +1194,7 @@ class Contrat extends CommonObject
|
||||
else { $sql.=",date_cloture=null"; }
|
||||
$sql .= " WHERE rowid = ".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::updateline sql=".$sql);
|
||||
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1255,25 +1235,27 @@ class Contrat extends CommonObject
|
||||
|
||||
if ($this->statut >= 0)
|
||||
{
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
|
||||
$sql.= " WHERE rowid=".$idline;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('LINECONTRACT_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_DELETE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -1468,7 +1450,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " WHERE fk_contrat =".$this->id;
|
||||
if ($statut >= 0) $sql.= " AND statut = '$statut'";
|
||||
|
||||
dol_syslog(get_class($this)."::array_detail() sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::array_detail()", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1504,7 +1486,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " WHERE fk_soc =".$this->socid;
|
||||
if ($option == 'others') $sql.= " AND c.rowid != ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::getOtherContracts() sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getOtherContracts()", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1944,7 +1926,7 @@ class ContratLigne
|
||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||
if ($ref) $sql.= " WHERE t.rowid = '".$ref."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1997,7 +1979,6 @@ class ContratLigne
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2064,6 +2045,8 @@ class ContratLigne
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||
$sql.= " fk_contrat='".$this->fk_contrat."',";
|
||||
@ -2099,7 +2082,7 @@ class ContratLigne
|
||||
$sql.= " commentaire='".$this->db->escape($this->commentaire)."'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2110,20 +2093,19 @@ class ContratLigne
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('LINECONTRACT_UPDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2147,7 +2129,7 @@ class ContratLigne
|
||||
$sql.= ",total_ttc=".price2num($this->total_ttc,'MT')."";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::update_total sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_total", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -2158,7 +2140,6 @@ class ContratLigne
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_total Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -2180,7 +2161,7 @@ class ContratLigne
|
||||
if (! $sql) return -1;
|
||||
|
||||
//print $sql;
|
||||
dol_syslog(get_class($this)."::get_element_list sql=" . $sql);
|
||||
dol_syslog(get_class($this)."::get_element_list", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -312,7 +312,7 @@ $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid";
|
||||
$sql.= " ORDER BY c.tms DESC";
|
||||
$sql.= " LIMIT ".$max;
|
||||
|
||||
dol_syslog("contrat/index.php sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("contrat/index.php", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -113,7 +113,7 @@ $sql .= $db->order($sortfield,$sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
//print $sql;
|
||||
dol_syslog("contrat/services.php sql=".$sql);
|
||||
dol_syslog("contrat/services.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -77,7 +77,7 @@ class box_actions extends ModeleBoxes
|
||||
$sql.= " ORDER BY a.datec DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
dol_syslog("Box_actions::loadBox sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("Box_actions::loadBox", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -73,7 +73,7 @@ class box_clients extends ModeleBoxes
|
||||
$sql.= " ORDER BY s.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
dol_syslog(get_class($this)."::loadBox sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -90,7 +90,7 @@ class box_comptes extends ModeleBoxes
|
||||
$sql.= " ORDER BY label";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
dol_syslog(get_class($this)."::loadBox sql=".$sql);
|
||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -79,7 +79,7 @@ class box_ficheinter extends ModeleBoxes
|
||||
$sql.= " ORDER BY f.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
dol_syslog(get_class($this).'::loadBox sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::loadBox', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -73,7 +73,7 @@ class box_prospect extends ModeleBoxes
|
||||
$sql.= " ORDER BY s.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
dol_syslog(get_class($this)."::loadBox sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -47,7 +47,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$table;
|
||||
$sql.= ' WHERE '.$field.' = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::getSommePaiement sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -308,7 +308,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement;
|
||||
else $sqltemp.= " WHERE c.code='".$this->db->escape($cond_reglement)."'";
|
||||
|
||||
dol_syslog(get_class($this).'::calculate_date_lim_reglement sql='.$sqltemp);
|
||||
dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG);
|
||||
$resqltemp=$this->db->query($sqltemp);
|
||||
if ($resqltemp)
|
||||
{
|
||||
|
||||
@ -78,7 +78,7 @@ abstract class CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
dol_syslog(get_class()."::isExistingObject sql=".$sql);
|
||||
dol_syslog(get_class()."::isExistingObject", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -213,7 +213,7 @@ abstract class CommonObject
|
||||
$sql.= "'".$this->db->idate($datecreate)."'";
|
||||
$sql.= ", 4, '". $id_type_contact . "' ";
|
||||
$sql.= ")";
|
||||
dol_syslog(get_class($this)."::add_contact sql=".$sql);
|
||||
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -238,7 +238,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog($this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -261,7 +260,6 @@ abstract class CommonObject
|
||||
if ($this->add_contact($contact['id'], $contact['fk_c_type_contact'], $contact['source']) < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::copy_contact error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -314,7 +312,7 @@ abstract class CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql.= " WHERE rowid =".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete_contact sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete_contact", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $notrigger)
|
||||
@ -330,7 +328,6 @@ abstract class CommonObject
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::delete_contact error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -355,7 +352,7 @@ abstract class CommonObject
|
||||
$sql.= " WHERE element_id =".$this->id;
|
||||
$sql.= " AND fk_c_type_contact IN (".$listId.")";
|
||||
|
||||
dol_syslog(get_class($this)."::delete_linked_contact sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
@ -363,7 +360,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete_linked_contact error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -400,7 +396,7 @@ abstract class CommonObject
|
||||
if ($statut >= 0) $sql.= " AND ec.statut = '".$statut."'";
|
||||
$sql.=" ORDER BY t.lastname ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::liste_contact sql=".$sql);
|
||||
dol_syslog(get_class($this)."::liste_contact", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -455,7 +451,7 @@ abstract class CommonObject
|
||||
$sql.= " AND ec.fk_c_type_contact=tc.rowid";
|
||||
$sql.= " AND tc.element = '".$this->element."'";
|
||||
|
||||
dol_syslog(get_class($this)."::swapContactStatus sql=".$sql);
|
||||
dol_syslog(get_class($this)."::swapContactStatus", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -557,7 +553,7 @@ abstract class CommonObject
|
||||
$sql.= " AND tc.active = 1";
|
||||
if ($status) $sql.= " AND ec.statut = ".$status;
|
||||
|
||||
dol_syslog(get_class($this)."::getIdContact sql=".$sql);
|
||||
dol_syslog(get_class($this)."::getIdContact", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -570,7 +566,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::getIdContact ".$this->error, LOG_ERR);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -647,7 +642,7 @@ abstract class CommonObject
|
||||
$sql = "SELECT rowid, code, libelle as label, coder";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql.= " WHERE rowid = ".$idtype;
|
||||
dol_syslog(get_class($this).'::fetch_barcode sql='.$sql);
|
||||
dol_syslog(get_class($this).'::fetch_barcode', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -733,7 +728,7 @@ abstract class CommonObject
|
||||
$sql.= " WHERE ".$field." = '".$key."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this).'::fetchObjectFrom sql='.$sql);
|
||||
dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -759,7 +754,7 @@ abstract class CommonObject
|
||||
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this).'::getValueFrom sql='.$sql);
|
||||
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -799,7 +794,7 @@ abstract class CommonObject
|
||||
if (is_object($user)) $sql.=", fk_user_modif = ".$user->id;
|
||||
$sql.= " WHERE ".$id_field." = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -925,7 +920,7 @@ abstract class CommonObject
|
||||
else $sql.= ' SET fk_projet = NULL';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setProject sql=".$sql);
|
||||
dol_syslog(get_class($this)."::setProject", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->fk_project = $projectid;
|
||||
@ -1069,7 +1064,7 @@ abstract class CommonObject
|
||||
// if ($this->element == 'facture') $sql.= " AND fk_statut < 2";
|
||||
// if ($this->element == 'propal') $sql.= " AND fk_statut = 0";
|
||||
|
||||
dol_syslog(get_class($this)."::setDocModel sql=".$sql);
|
||||
dol_syslog(get_class($this)."::setDocModel", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1113,7 +1108,7 @@ abstract class CommonObject
|
||||
if (! $renum) $sql.= ' AND rang = 0';
|
||||
if ($renum) $sql.= ' AND rang <> 0';
|
||||
|
||||
dol_syslog(get_class($this)."::line_order sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1133,7 +1128,7 @@ abstract class CommonObject
|
||||
if ($fk_parent_line) $sql.= ' AND fk_parent_line IS NULL';
|
||||
$sql.= ' ORDER BY rang ASC, rowid '.$rowidorder;
|
||||
|
||||
dol_syslog(get_class($this)."::line_order search all parent lines sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1185,7 +1180,7 @@ abstract class CommonObject
|
||||
$sql.= ' AND fk_parent_line = '.$id;
|
||||
$sql.= ' ORDER BY rang ASC';
|
||||
|
||||
dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id." sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id."", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1253,7 +1248,7 @@ abstract class CommonObject
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang;
|
||||
$sql.= ' WHERE rowid = '.$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::updateRangOfLine sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::updateRangOfLine", LOG_DEBUG);
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
@ -1347,7 +1342,7 @@ abstract class CommonObject
|
||||
$sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql.= ' WHERE rowid ='.$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::getRangOfLine sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1390,7 +1385,7 @@ abstract class CommonObject
|
||||
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
|
||||
$sql.= ' AND fk_parent_line = '.$fk_parent_line;
|
||||
|
||||
dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::line_max", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1411,7 +1406,7 @@ abstract class CommonObject
|
||||
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::line_max", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1439,7 +1434,7 @@ abstract class CommonObject
|
||||
$sql.= " SET ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||
$sql.= " WHERE ".(isset($this->table_rowid)?$this->table_rowid:'rowid')." = ". $this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_ref_ext sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_ref_ext", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->ref_ext = $ref_ext;
|
||||
@ -1448,7 +1443,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_ref_ext error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1477,7 +1471,7 @@ abstract class CommonObject
|
||||
$sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL");
|
||||
$sql.= " WHERE rowid =". $this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_note", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($suffix == '_public') $this->note_public = $note;
|
||||
@ -1488,7 +1482,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update_note error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1552,7 +1545,7 @@ abstract class CommonObject
|
||||
}
|
||||
$sql.= ' ORDER by rowid'; // We want to be sure to always use same order of line to not change lines differently when option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND is used
|
||||
|
||||
dol_syslog(get_class($this)."::update_price sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1652,13 +1645,12 @@ abstract class CommonObject
|
||||
$sql .= ' WHERE rowid = '.$this->id;
|
||||
|
||||
//print "xx".$sql;
|
||||
dol_syslog(get_class($this)."::update_price sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_price error=".$this->error,LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1704,7 +1696,7 @@ abstract class CommonObject
|
||||
$sql.= ", '".$this->element."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::add_object_linked sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -1781,7 +1773,7 @@ abstract class CommonObject
|
||||
$sql .= ' ORDER BY sourcetype';
|
||||
//print $sql;
|
||||
|
||||
dol_syslog(get_class($this)."::fetchObjectLink sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetchObjectLink", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1906,7 +1898,7 @@ abstract class CommonObject
|
||||
$sql.= " AND sourcetype = '".$this->element."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::updateObjectLinked sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
@ -1914,7 +1906,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::updateObjectLinked error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1960,7 +1951,7 @@ abstract class CommonObject
|
||||
$sql.= " (fk_target = ".$this->id." AND targettype = '".$this->element."')";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::deleteObjectLinked sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
@ -1968,7 +1959,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::deleteObjectLinked error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1995,7 +1985,7 @@ abstract class CommonObject
|
||||
$sql.= " SET ".$fieldstatus." = ".$status;
|
||||
$sql.= " WHERE rowid=".$elementId;
|
||||
|
||||
dol_syslog(get_class($this)."::setStatut sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -2005,7 +1995,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2104,7 +2093,7 @@ abstract class CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
|
||||
$sql.= " WHERE fk_object = ".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_optionals sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch_optionals", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2152,12 +2141,11 @@ abstract class CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
|
||||
dol_syslog(get_class($this)."::deleteExtraFields delete sql=".$sql_del);
|
||||
dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql_del);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::deleteExtraFields ".$this->error,LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2223,7 +2211,7 @@ abstract class CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
|
||||
dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del);
|
||||
dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG);
|
||||
$this->db->query($sql_del);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
|
||||
foreach($this->array_options as $key => $value)
|
||||
@ -2252,12 +2240,11 @@ abstract class CommonObject
|
||||
}
|
||||
$sql.=")";
|
||||
|
||||
dol_syslog(get_class($this)."::insertExtraFields insert sql=".$sql);
|
||||
dol_syslog(get_class($this)."::insertExtraFields insert", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2430,7 +2417,6 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete error -1 ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2479,7 +2465,7 @@ abstract class CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."det";
|
||||
$sql.= " WHERE ".$this->fk_element." = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this).'::getTotalDiscount sql='.$sql);
|
||||
dol_syslog(get_class($this).'::getTotalDiscount', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2500,7 +2486,6 @@ abstract class CommonObject
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_syslog(get_class($this).'::getTotalDiscount '.$this->db->lasterror(), LOG_ERR);
|
||||
|
||||
//print $total_discount; exit;
|
||||
return price2num($total_discount);
|
||||
@ -2521,12 +2506,11 @@ abstract class CommonObject
|
||||
$sql.= " SET extraparams = ".(! empty($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null");
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setExtraParameters", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setExtraParameters ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -3327,7 +3311,7 @@ abstract class CommonObject
|
||||
$sql.= ", '".$mandatory."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::add_element_resource sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::add_element_resource", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -3359,7 +3343,7 @@ abstract class CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
|
||||
$sql.= " WHERE rowid =".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete_resource sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $notrigger)
|
||||
@ -3374,7 +3358,6 @@ abstract class CommonObject
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::delete_resource error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ class Cpays // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -158,7 +158,7 @@ class Cpays // extends CommonObject
|
||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -179,7 +179,6 @@ class Cpays // extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -217,7 +216,7 @@ class Cpays // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -273,7 +272,7 @@ class Cpays // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ class Ctypent // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -163,7 +163,7 @@ class Ctypent // extends CommonObject
|
||||
if ($id) $sql.= " WHERE t.id = ".$id;
|
||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -184,7 +184,6 @@ class Ctypent // extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -222,7 +221,7 @@ class Ctypent // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
@ -278,7 +277,7 @@ class Ctypent // extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ class DiscountAbsolute
|
||||
if ($rowid) $sql.= " sr.rowid=".$rowid;
|
||||
if ($fk_facture_source) $sql.= " sr.fk_facture_source=".$fk_facture_source;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -159,7 +159,7 @@ class DiscountAbsolute
|
||||
$sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -169,7 +169,6 @@ class DiscountAbsolute
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror().' - sql='.$sql;
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -195,7 +194,7 @@ class DiscountAbsolute
|
||||
$sql.=" AND fk_facture_source = ".$this->fk_facture_source;
|
||||
//$sql.=" AND rowid != ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete Check if we can remove discount sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete Check if we can remove discount", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -222,7 +221,7 @@ class DiscountAbsolute
|
||||
$sql.= " AND (fk_facture_line IS NULL"; // Not used as absolute simple discount
|
||||
$sql.= " AND fk_facture IS NULL)"; // Not used as credit note and not used as deposit
|
||||
|
||||
dol_syslog(get_class($this)."::delete Delete discount sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete Delete discount", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -233,7 +232,7 @@ class DiscountAbsolute
|
||||
$sql.=" set paye=0, fk_statut=1";
|
||||
$sql.=" WHERE (type = 2 or type = 3) AND rowid=".$this->fk_facture_source;
|
||||
|
||||
dol_syslog(get_class($this)."::delete Update credit note or deposit invoice statut sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete Update credit note or deposit invoice statut", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -291,7 +290,7 @@ class DiscountAbsolute
|
||||
if ($rowidinvoice) $sql.=" SET fk_facture = ".$rowidinvoice;
|
||||
$sql.=" WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::link_to_invoice sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::link_to_invoice", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -302,7 +301,6 @@ class DiscountAbsolute
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::link_to_invoice ".$this->error,LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
@ -320,7 +318,7 @@ class DiscountAbsolute
|
||||
$sql.=" SET fk_facture_line = NULL, fk_facture = NULL";
|
||||
$sql.=" WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::unlink_invoice sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::unlink_invoice", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -329,7 +327,6 @@ class DiscountAbsolute
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::unlink_invoice ".$this->error,LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
@ -355,7 +352,7 @@ class DiscountAbsolute
|
||||
if ($filter) $sql.=' AND ('.$filter.')';
|
||||
if ($maxvalue) $sql.=' AND rc.amount_ttc <= '.price2num($maxvalue);
|
||||
|
||||
dol_syslog(get_class($this)."::getAvailableDiscounts sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getAvailableDiscounts", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -384,7 +381,7 @@ class DiscountAbsolute
|
||||
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
|
||||
$sql.= ' AND f.type = 2';
|
||||
|
||||
dol_syslog(get_class($this)."::getSumCreditNotesUsed sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -410,7 +407,7 @@ class DiscountAbsolute
|
||||
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
|
||||
$sql.= ' AND f.type = 3';
|
||||
|
||||
dol_syslog(get_class($this)."::getSumDepositsUsed sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -132,7 +132,7 @@ class Events // extends CommonObject
|
||||
$sql.= " '".$this->db->escape($this->description)."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -142,7 +142,6 @@ class Events // extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -174,12 +173,11 @@ class Events // extends CommonObject
|
||||
$sql.= " description='".$this->db->escape($this->description)."'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
@ -209,7 +207,7 @@ class Events // extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."events as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -233,7 +231,6 @@ class Events // extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -252,12 +249,11 @@ class Events // extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."events";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ class ExtraFields
|
||||
$sql.= " '".$params."'";
|
||||
$sql.=')';
|
||||
|
||||
dol_syslog(get_class($this)."::create_label sql=".$sql);
|
||||
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
@ -286,7 +286,6 @@ class ExtraFields
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
}
|
||||
|
||||
$result=$this->delete_label($attrname,$elementtype);
|
||||
@ -318,7 +317,7 @@ class ExtraFields
|
||||
$sql.= " AND entity IN (0,".$conf->entity.')';
|
||||
$sql.= " AND elementtype = '".$elementtype."'";
|
||||
|
||||
dol_syslog(get_class($this)."::delete_label sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete_label", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -399,7 +398,7 @@ class ExtraFields
|
||||
{
|
||||
$sql="ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname;
|
||||
}
|
||||
dol_syslog(get_class($this).'::update sql='.$sql);
|
||||
dol_syslog(get_class($this).'::update', LOG_DEBUG);
|
||||
$resql=$this->db->query($sql,1,'dml');
|
||||
return 1;
|
||||
}
|
||||
@ -454,7 +453,7 @@ class ExtraFields
|
||||
$sql_del.= " WHERE name = '".$attrname."'";
|
||||
$sql_del.= " AND entity = ".$conf->entity;
|
||||
$sql_del.= " AND elementtype = '".$elementtype."'";
|
||||
dol_syslog(get_class($this)."::update_label sql=".$sql_del);
|
||||
dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
|
||||
$resql1=$this->db->query($sql_del);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(";
|
||||
@ -480,7 +479,7 @@ class ExtraFields
|
||||
$sql.= " '".$pos."',";
|
||||
$sql.= " '".$param."'";
|
||||
$sql.= ")";
|
||||
dol_syslog(get_class($this)."::update_label sql=".$sql);
|
||||
dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
|
||||
$resql2=$this->db->query($sql);
|
||||
|
||||
if ($resql1 && $resql2)
|
||||
@ -537,7 +536,7 @@ class ExtraFields
|
||||
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";
|
||||
$sql.= " ORDER BY pos";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_name_optionals_label sql=".$sql);
|
||||
dol_syslog(get_class($this)."::fetch_name_optionals_label", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -754,7 +753,7 @@ class ExtraFields
|
||||
$sql.=preg_replace('/^ AND /','',$sqlwhere);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql);
|
||||
dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -964,7 +963,7 @@ class ExtraFields
|
||||
$sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
|
||||
//$sql.= ' AND entity = '.$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql);
|
||||
dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -486,7 +486,7 @@ class Form
|
||||
$sql.= " WHERE active = 1";
|
||||
//$sql.= " ORDER BY code ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_country sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_country", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -604,7 +604,7 @@ class Form
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees as c";
|
||||
$sql.= " ORDER BY lower(c.libelle) ASC";
|
||||
|
||||
dol_syslog(get_class($this).'::load_cache_types_fees sql='.$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::load_cache_types_fees', LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -795,7 +795,7 @@ class Form
|
||||
$sql.=$this->db->order("nom","ASC");
|
||||
if ($limit > 0) $sql.=$this->db->plimit($limit);
|
||||
|
||||
dol_syslog(get_class($this)."::select_thirdparty_list sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -889,7 +889,7 @@ class Form
|
||||
if ($filter) $sql.= " AND ".$filter;
|
||||
$sql.= " ORDER BY re.description ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_remises sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -995,7 +995,7 @@ class Form
|
||||
if (! empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND sp.statut<>0 ";
|
||||
$sql.= " ORDER BY sp.lastname ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_contacts sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_contacts", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1163,7 +1163,7 @@ class Form
|
||||
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND u.statut<>0 ";
|
||||
$sql.= " ORDER BY u.lastname ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_dolusers sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1413,7 +1413,7 @@ class Form
|
||||
$sql.= $db->plimit($limit);
|
||||
|
||||
// Build output string
|
||||
dol_syslog(get_class($this)."::select_produits_list search product sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1436,7 +1436,7 @@ class Form
|
||||
$sql.= " WHERE fk_product_price=".$objp->price_rowid;
|
||||
$sql.= " ORDER BY quantity ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_produits_list search price by qty sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_produits_list search price by qty", LOG_DEBUG);
|
||||
$result2 = $this->db->query($sql);
|
||||
if ($result2)
|
||||
{
|
||||
@ -1555,7 +1555,7 @@ class Form
|
||||
$sql.= " ORDER BY date_price";
|
||||
$sql.= " DESC LIMIT 1";
|
||||
|
||||
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.' sql='.$sql);
|
||||
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
|
||||
$result2 = $this->db->query($sql);
|
||||
if ($result2)
|
||||
{
|
||||
@ -1776,7 +1776,7 @@ class Form
|
||||
|
||||
// Build output string
|
||||
|
||||
dol_syslog(get_class($this)."::select_produits_fournisseurs_list sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1922,7 +1922,7 @@ class Form
|
||||
$sql.= " AND p.rowid = ".$productid;
|
||||
$sql.= " ORDER BY s.nom, pfp.ref_fourn DESC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_product_fourn_price sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
@ -2006,7 +2006,7 @@ class Form
|
||||
$sql .= " WHERE a.fk_soc = ".$socid;
|
||||
$sql .= " ORDER BY a.label ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_address sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_address", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2056,7 +2056,7 @@ class Form
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
|
||||
$sql.= " WHERE active=1";
|
||||
$sql.= " ORDER BY sortorder";
|
||||
dol_syslog(get_class($this).'::load_cache_conditions_paiements sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::load_cache_conditions_paiements', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2095,7 +2095,7 @@ class Form
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_availability';
|
||||
$sql.= " WHERE active=1";
|
||||
$sql.= " ORDER BY rowid";
|
||||
dol_syslog(get_class($this).'::load_cache_availability sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::load_cache_availability', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2168,7 +2168,7 @@ class Form
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_input_reason';
|
||||
$sql.= " WHERE active=1";
|
||||
$sql.= " ORDER BY rowid";
|
||||
dol_syslog(get_class($this)."::loadCacheInputReason sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::loadCacheInputReason", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2249,7 +2249,7 @@ class Form
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE active > 0";
|
||||
$sql.= " ORDER BY id";
|
||||
dol_syslog(get_class($this)."::load_cache_types_paiements sql=".$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::load_cache_types_paiements", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2438,7 +2438,7 @@ class Form
|
||||
if ($filtre) $sql.=" AND ".$filtre;
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
dol_syslog(get_class($this)."::select_comptes sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -4231,7 +4231,7 @@ class Form
|
||||
if (is_array($include) && $includeGroups) $sql.= " AND ug.rowid IN ('".$includeGroups."')";
|
||||
$sql.= " ORDER BY ug.nom ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_dolgroups sql=".$sql);
|
||||
dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user