Merge remote-tracking branch 'origin_dolibarr/develop' into develop
This commit is contained in:
commit
4aa4f5f5e9
@ -18,6 +18,7 @@ php:
|
|||||||
- "5.3"
|
- "5.3"
|
||||||
- "5.4"
|
- "5.4"
|
||||||
- "5.5"
|
- "5.5"
|
||||||
|
- "5.6"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- DB=mysql
|
- DB=mysql
|
||||||
|
|||||||
12
.tx/config
12
.tx/config
@ -236,6 +236,18 @@ source_file = htdocs/langs/en_US/paypal.lang
|
|||||||
source_lang = en_US
|
source_lang = en_US
|
||||||
type = MOZILLAPROPERTIES
|
type = MOZILLAPROPERTIES
|
||||||
|
|
||||||
|
[dolibarr.printgcp]
|
||||||
|
file_filter = htdocs/langs/<lang>/printgcp.lang
|
||||||
|
source_file = htdocs/langs/en_US/printgcp.lang
|
||||||
|
source_lang = en_US
|
||||||
|
type = MOZILLAPROPERTIES
|
||||||
|
|
||||||
|
[dolibarr.printing]
|
||||||
|
file_filter = htdocs/langs/<lang>/printing.lang
|
||||||
|
source_file = htdocs/langs/en_US/printing.lang
|
||||||
|
source_lang = en_US
|
||||||
|
type = MOZILLAPROPERTIES
|
||||||
|
|
||||||
[dolibarr.printipp]
|
[dolibarr.printipp]
|
||||||
file_filter = htdocs/langs/<lang>/printipp.lang
|
file_filter = htdocs/langs/<lang>/printipp.lang
|
||||||
source_file = htdocs/langs/en_US/printipp.lang
|
source_file = htdocs/langs/en_US/printipp.lang
|
||||||
|
|||||||
@ -52,6 +52,9 @@ http://www.fsf.org/licensing/licenses/index_html
|
|||||||
Copyright
|
Copyright
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
Copyright (C) 2015
|
||||||
|
- Marcos García <marcosgdf@gmail.com>
|
||||||
|
|
||||||
Copyright (C) 2014
|
Copyright (C) 2014
|
||||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
- Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
- Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
|||||||
25
ChangeLog
25
ChangeLog
@ -1,6 +1,9 @@
|
|||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
English Dolibarr ChangeLog
|
English Dolibarr ChangeLog
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
***** ChangeLog for 3.8 compared to 3.7.* *****
|
||||||
|
- New: Add Option to not change date on cloning project
|
||||||
|
- New: Add check list from table for extrafield type
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 3.8 compared to 3.7.* *****
|
***** ChangeLog for 3.8 compared to 3.7.* *****
|
||||||
@ -8,7 +11,11 @@ For users:
|
|||||||
- New: Use new combobox.
|
- New: Use new combobox.
|
||||||
- New: Add hidden option MAXTABS_IN_CARD.
|
- New: Add hidden option MAXTABS_IN_CARD.
|
||||||
- Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined'
|
- Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined'
|
||||||
|
- Add Weighted average price as default price for buying price for margin calculation. Add option
|
||||||
|
MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
|
||||||
|
- Introduce option MAIN_HTML_TITLE to start to control format of html title content.
|
||||||
|
- Add extrafields on bank account cards.
|
||||||
|
- Added delay between mails in Newsletter module
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- Update language files.
|
- Update language files.
|
||||||
@ -188,6 +195,20 @@ Dolibarr better:
|
|||||||
|
|
||||||
***** ChangeLog for 3.6.3 compared to 3.6.2 *****
|
***** ChangeLog for 3.6.3 compared to 3.6.2 *****
|
||||||
- Fix: ref_ext was not saved when recording a customer order from web service
|
- Fix: ref_ext was not saved when recording a customer order from web service
|
||||||
|
- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
|
||||||
|
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
|
||||||
|
- Fix: [ bug #1788 ] Duplicated doActions hook in product/fournisseurs.php
|
||||||
|
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
|
||||||
|
- Fix: [ bug #1801 ] FAC_FORCE_DATE_VALIDATION constant alters supplier invoice date given to numeration modules
|
||||||
|
- Fix: [ bug #1802 ] SQL error when updating a task with PostgreSQL database
|
||||||
|
- Fix: [ bug #1785 ] Start date is lost in Project > Linked objects
|
||||||
|
- Fix: [ bug #1804 ] SQL error when sending email without addresee
|
||||||
|
- Fix: [ bug #1803 ] AJAX company contact input is not aligned
|
||||||
|
- Fix: [ bug #1787 ] Incorrect behaviour of doActions hook
|
||||||
|
- Fix: [ bug #1796 ] Unable to use numeration modules from an external module
|
||||||
|
- Fix: [ bug #1783 ] SQL error when enabling 3rd party module with PostgreSQL and MySQL strict mode ON
|
||||||
|
- Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount
|
||||||
|
- Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme
|
||||||
|
|
||||||
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
||||||
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
||||||
@ -352,6 +373,8 @@ Fix: Paypal link were broken dur to SSL v3 closed.
|
|||||||
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
||||||
Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
|
Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
|
||||||
Fix: [ bug #1757 ] Sorting breaks product/service statistics
|
Fix: [ bug #1757 ] Sorting breaks product/service statistics
|
||||||
|
Fix: [ bug #1797 ] Tulip supplier invoice module takes creation date instead of invoice date
|
||||||
|
Fix: [ bug #1792 ] Users are not allowed to see margins module index page when no product view permission is enabled
|
||||||
|
|
||||||
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
||||||
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
||||||
|
|||||||
@ -11,7 +11,6 @@ beta version of Dolibarr, step by step.
|
|||||||
- Update version/info in /ChangeLog
|
- Update version/info in /ChangeLog
|
||||||
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
|
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
|
||||||
- Update version number with x.y.z-w in build/debian/changelog
|
- Update version number with x.y.z-w in build/debian/changelog
|
||||||
- Update version number with x.y.z-w in build/exe/doliwamp/doliwamp.iss
|
|
||||||
- Update version number with x.y.z-w in build/rpm/*.spec
|
- Update version number with x.y.z-w in build/rpm/*.spec
|
||||||
- Commit all changes.
|
- Commit all changes.
|
||||||
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
|
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
|
||||||
@ -30,10 +29,9 @@ This files describe steps made by Dolibarr packaging team to make a
|
|||||||
complete release of Dolibarr, step by step.
|
complete release of Dolibarr, step by step.
|
||||||
|
|
||||||
- Check all files are commited.
|
- Check all files are commited.
|
||||||
- Update version/info in ChangeLog
|
- Update version/info in ChangeLog. To generate a changelog, you can do "git log x.y.z..HEAD --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^Fix\|New\|Sec'"
|
||||||
- Update version number with x.y.z in htdocs/filefunc.inc.php
|
- Update version number with x.y.z in htdocs/filefunc.inc.php
|
||||||
- Update version number with x.y.z in build/debian/changelog
|
- Update version number with x.y.z in build/debian/changelog
|
||||||
- Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss
|
|
||||||
- Update version number with x.y.z in build/rpm/*.spec
|
- Update version number with x.y.z in build/rpm/*.spec
|
||||||
- Commit all changes.
|
- Commit all changes.
|
||||||
|
|
||||||
|
|||||||
@ -253,14 +253,80 @@
|
|||||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
|
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="PEAR.Commenting.ClassComment.Missing" />
|
|
||||||
|
|
||||||
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn" />
|
<!-- TODO Remove this and fix reported errors -->
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.Missing">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.Missing">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired" />
|
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<rule ref="PEAR.Commenting.FunctionComment.Missing" />
|
<rule ref="PEAR.Commenting.ClassComment.MissingAuthorTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.MissingCategoryTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.MissingLicenseTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.MissingLinkTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.MissingPackageTag">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<!-- TODO Remove this and fix reported errors -->
|
||||||
|
<rule ref="PEAR.Commenting.ClassComment.Missing">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PEAR.Commenting.FunctionComment.Missing">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
>>>>>>> refs/remotes/origin/3.7
|
||||||
<!--
|
<!--
|
||||||
<rule ref="PEAR.Commenting.FileComment" />
|
<rule ref="PEAR.Commenting.FileComment" />
|
||||||
<rule ref="PEAR.Commenting.FileComment.WrongStyle">
|
<rule ref="PEAR.Commenting.FileComment.WrongStyle">
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,4 +1,5 @@
|
|||||||
# ldapadd_sample1.txt
|
# ldapadd_sample1.txt
|
||||||
|
# ldapadd is into package ldap-utils on debian.
|
||||||
#
|
#
|
||||||
# Use this sample to add a dc "my-domain".
|
# Use this sample to add a dc "my-domain".
|
||||||
# This is the first thing to create
|
# This is the first thing to create
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# ldapadd_sample2.txt
|
# ldapadd_sample2.txt
|
||||||
|
# ldapadd is into package ldap-utils on debian.
|
||||||
#
|
#
|
||||||
# Use this sample to add a ou "contacts"
|
# Use this sample to add a ou "contacts"
|
||||||
# This is the second thing to create after creating the root my-domain
|
# This is the second thing to create after creating the root my-domain
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# ldapadd_sample3.txt
|
# ldapadd_sample3.txt
|
||||||
|
# ldapadd is into package ldap-utils on debian.
|
||||||
#
|
#
|
||||||
# Use this sample to add cn records
|
# Use this sample to add cn records
|
||||||
# This is the step to create records inside tree ou=contacts,dc=my-domain,dc=com
|
# This is the step to create records inside tree ou=contacts,dc=my-domain,dc=com
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# ldapdelete_sample1.txt
|
# ldapdelete_sample1.txt
|
||||||
|
# ldapdelete is into package ldap-utils on debian.
|
||||||
#
|
#
|
||||||
# Use this sample to delete a dc "my-domain"
|
# Use this sample to delete a dc "my-domain"
|
||||||
# This delete the first level of LDAP tree.
|
# This delete the first level of LDAP tree.
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# ldapdelete_sample3.txt
|
# ldapdelete_sample3.txt
|
||||||
|
# ldapdelete is into package ldap-utils on debian.
|
||||||
#
|
#
|
||||||
# Use this sample to delete cn records
|
# Use this sample to delete cn records
|
||||||
# This is the step to delete a cn record stored inside tree ou=contacts,dc=my-domain,dc=com
|
# This is the step to delete a cn record stored inside tree ou=contacts,dc=my-domain,dc=com
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# ldapmodify_sample1.txt
|
# ldapmodify_sample1.txt
|
||||||
|
# ldapmodify is into package ldap-utils on debian.
|
||||||
#
|
#
|
||||||
# Use this sample to modify a dc "my-domain"
|
# Use this sample to modify a dc "my-domain"
|
||||||
#
|
#
|
||||||
|
|||||||
9
dev/ldap/ldapsearch_sample1.txt
Normal file
9
dev/ldap/ldapsearch_sample1.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# ldapsearch_sample1.txt
|
||||||
|
# ldapsearch is into package ldap-utils on debian.
|
||||||
|
#
|
||||||
|
# Use this sample to search into a ldap
|
||||||
|
#
|
||||||
|
# ldapsearch -h hostname -x
|
||||||
|
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
|
||||||
|
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -W "(objectclass=*)"
|
||||||
|
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -W "(objectclass=*)"
|
||||||
@ -27,7 +27,7 @@
|
|||||||
/**
|
/**
|
||||||
* Class to manage accounting accounts
|
* Class to manage accounting accounts
|
||||||
*/
|
*/
|
||||||
class AccountingAccount
|
class AccountingAccount extends CommonObject
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
@ -126,6 +126,7 @@ class AccountingAccount
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
|||||||
@ -221,7 +221,7 @@ class BookKeeping extends CommonObject
|
|||||||
* Insert line into bookkeeping
|
* Insert line into bookkeeping
|
||||||
*
|
*
|
||||||
* @param User $user User who inserted operation
|
* @param User $user User who inserted operation
|
||||||
* @return $result Result
|
* @return int <0 KO >0 OK
|
||||||
*/
|
*/
|
||||||
function create($user='')
|
function create($user='')
|
||||||
{
|
{
|
||||||
@ -276,8 +276,9 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
if (empty($this->date_create))
|
if (empty($this->date_create)) {
|
||||||
$this->date_create = $now();
|
$this->date_create = $now;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping (doc_date, ";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping (doc_date, ";
|
||||||
$sql .= "doc_type, doc_ref,fk_doc,fk_docdet,code_tiers,numero_compte,label_compte,";
|
$sql .= "doc_type, doc_ref,fk_doc,fk_docdet,code_tiers,numero_compte,label_compte,";
|
||||||
@ -330,24 +331,20 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " WHERE import_key = '" . $importkey . "'";
|
$sql .= " WHERE import_key = '" . $importkey . "'";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
|
||||||
$error ++;
|
|
||||||
$this->errors[] = "Error " . $this->db->lasterror();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Commit or rollback
|
if (! $resql) {
|
||||||
if ($error) {
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
foreach ( $this->errors as $errmsg ) {
|
foreach ( $this->errors as $errmsg ) {
|
||||||
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
||||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return - 1 * $error;
|
return - 1;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create object into database
|
* Create object into database
|
||||||
@ -595,16 +592,13 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $error)
|
// if (! $notrigger)
|
||||||
{
|
// {
|
||||||
if (! $notrigger)
|
// // Call trigger
|
||||||
{
|
// $result=$this->call_trigger('ACCOUNTING_NUMPIECE_DELETE',$user);
|
||||||
// Call trigger
|
// if ($result < 0) $error++;
|
||||||
$result=$this->call_trigger('ACCOUNTING_NUMPIECE_DELETE',$user);
|
// // End call triggers
|
||||||
if ($result < 0) $error++;
|
// }
|
||||||
// End call triggers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||||
|
|||||||
@ -169,6 +169,9 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
$links = $object->get_url($obj->rowid);
|
$links = $object->get_url($obj->rowid);
|
||||||
|
|
||||||
|
// get_url may return -1 which is not traversable
|
||||||
|
if (is_array($links))
|
||||||
|
{
|
||||||
foreach ($links as $key => $val)
|
foreach ($links as $key => $val)
|
||||||
{
|
{
|
||||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||||
@ -196,6 +199,24 @@ if ($result) {
|
|||||||
$chargestatic->id = $links[$key]['url_id'];
|
$chargestatic->id = $links[$key]['url_id'];
|
||||||
$chargestatic->ref = $links[$key]['url_id'];
|
$chargestatic->ref = $links[$key]['url_id'];
|
||||||
|
|
||||||
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
|
||||||
|
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
||||||
|
if ($reg[1] == 'socialcontribution')
|
||||||
|
$reg[1] = 'SocialContribution';
|
||||||
|
$chargestatic->lib = $langs->trans($reg[1]);
|
||||||
|
}
|
||||||
|
else if ($links[$key]['type'] == 'company')
|
||||||
|
{
|
||||||
|
$societestatic->id = $links[$key]['url_id'];
|
||||||
|
$societestatic->name = $links[$key]['label'];
|
||||||
|
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||||
|
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||||
|
}
|
||||||
|
else if ($links[$key]['type'] == 'sc')
|
||||||
|
{
|
||||||
|
$chargestatic->id = $links[$key]['url_id'];
|
||||||
|
$chargestatic->ref = $links[$key]['url_id'];
|
||||||
|
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
|
||||||
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
||||||
if ($reg[1] == 'socialcontribution')
|
if ($reg[1] == 'socialcontribution')
|
||||||
@ -247,6 +268,31 @@ if ($result) {
|
|||||||
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
|
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
else if ($links[$key]['type'] == 'payment_vat')
|
||||||
|
{
|
||||||
|
$paymentvatstatic->id = $links[$key]['url_id'];
|
||||||
|
$paymentvatstatic->ref = $links[$key]['url_id'];
|
||||||
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
|
||||||
|
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
|
||||||
|
}
|
||||||
|
else if ($links[$key]['type'] == 'payment_salary')
|
||||||
|
{
|
||||||
|
$paymentsalstatic->id = $links[$key]['url_id'];
|
||||||
|
$paymentsalstatic->ref = $links[$key]['url_id'];
|
||||||
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
|
||||||
|
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
|
||||||
|
}
|
||||||
|
else if ($links[$key]['type'] == 'banktransfert')
|
||||||
|
{
|
||||||
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
|
||||||
|
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
|
||||||
|
}
|
||||||
|
/*else {
|
||||||
|
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
||||||
|
|
||||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||||
|
|||||||
@ -131,7 +131,8 @@ if ($result) {
|
|||||||
$tabtype = array ();
|
$tabtype = array ();
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ($i < $num)
|
||||||
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// controls
|
// controls
|
||||||
@ -155,8 +156,11 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
$links = $object->get_url($obj->rowid);
|
$links = $object->get_url($obj->rowid);
|
||||||
|
|
||||||
foreach ( $links as $key => $val ) {
|
// get_url may return -1 which is not traversable
|
||||||
|
if (is_array($links))
|
||||||
|
{
|
||||||
|
foreach ( $links as $key => $val )
|
||||||
|
{
|
||||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||||
|
|
||||||
if ($links[$key]['type'] == 'payment') {
|
if ($links[$key]['type'] == 'payment') {
|
||||||
@ -200,20 +204,13 @@ if ($result) {
|
|||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
|
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
|
||||||
}
|
}
|
||||||
} else if ($links[$key]['type'] == 'payment_vat') {
|
|
||||||
|
|
||||||
$paymentvatstatic->id = $links[$key]['url_id'];
|
|
||||||
$paymentvatstatic->ref = $links[$key]['url_id'];
|
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
|
|
||||||
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
|
|
||||||
} else if ($links[$key]['type'] == 'banktransfert') {
|
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
|
|
||||||
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
|
|
||||||
}
|
|
||||||
/*else {
|
/*else {
|
||||||
$tabtp [$obj->rowid] [$cptsociale] += $obj->amount;
|
$tabtp [$obj->rowid] [$cptsociale] += $obj->amount;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
||||||
|
|
||||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||||
@ -229,11 +226,14 @@ if ($result) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// write bookkeeping
|
// write bookkeeping
|
||||||
if ($action == 'writeBookKeeping') {
|
if ($action == 'writeBookKeeping')
|
||||||
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ( $tabpay as $key => $val ) {
|
foreach ( $tabpay as $key => $val )
|
||||||
|
{
|
||||||
// cash
|
// cash
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt )
|
||||||
|
{
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
@ -249,8 +249,8 @@ if ($action == 'writeBookKeeping') {
|
|||||||
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
|
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
|
||||||
|
|
||||||
if ($tabtype[$key] == 'payment') {
|
if ($tabtype[$key] == 'payment')
|
||||||
|
{
|
||||||
$sqlmid = 'SELECT fac.facnumber';
|
$sqlmid = 'SELECT fac.facnumber';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||||
|
|||||||
@ -241,7 +241,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$companystatic = new Societe($db);
|
$companystatic = new Fournisseur($db);
|
||||||
|
|
||||||
// export csv
|
// export csv
|
||||||
if ($action == 'export_csv')
|
if ($action == 'export_csv')
|
||||||
@ -406,7 +406,6 @@ if ($action == 'export_csv')
|
|||||||
$r = '';
|
$r = '';
|
||||||
|
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
$companystatic = new Fournisseur($db);
|
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val ) {
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -100,9 +101,9 @@ if (! empty($conf->multicompany->enabled)) {
|
|||||||
}
|
}
|
||||||
$sql .= " AND f.fk_statut > 0";
|
$sql .= " AND f.fk_statut > 0";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||||
$sql .= " AND f.type IN (0,1,2)";
|
$sql .= " AND f.type IN (0,1,2,5)";
|
||||||
else
|
else
|
||||||
$sql .= " AND f.type IN (0,1,2,3)";
|
$sql .= " AND f.type IN (0,1,2,3,5)";
|
||||||
$sql .= " AND fd.product_type IN (0,1)";
|
$sql .= " AND fd.product_type IN (0,1)";
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
@ -136,6 +137,16 @@ if ($result) {
|
|||||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef");
|
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef");
|
||||||
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
|
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
|
||||||
|
|
||||||
|
// Situation invoices handling
|
||||||
|
$line = new FactureLigne($db);
|
||||||
|
$line->fetch($obj->id);
|
||||||
|
$prev_progress = $line->get_prev_progress();
|
||||||
|
if ($obj->situation_percent == 0) { // Avoid divide by 0
|
||||||
|
$situation_ratio = 0;
|
||||||
|
} else {
|
||||||
|
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||||
|
}
|
||||||
|
|
||||||
// Invoice lines
|
// Invoice lines
|
||||||
$tabfac[$obj->rowid]["date"] = $obj->df;
|
$tabfac[$obj->rowid]["date"] = $obj->df;
|
||||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||||
@ -148,9 +159,9 @@ if ($result) {
|
|||||||
$tabht[$obj->rowid][$compta_prod] = 0;
|
$tabht[$obj->rowid][$compta_prod] = 0;
|
||||||
if (! isset($tabtva[$obj->rowid][$compta_tva]))
|
if (! isset($tabtva[$obj->rowid][$compta_tva]))
|
||||||
$tabtva[$obj->rowid][$compta_tva] = 0;
|
$tabtva[$obj->rowid][$compta_tva] = 0;
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
'id' => $obj->socid,
|
'id' => $obj->socid,
|
||||||
'name' => $obj->name,
|
'name' => $obj->name,
|
||||||
|
|||||||
@ -119,6 +119,8 @@ $parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
|
|||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -682,7 +684,7 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -45,7 +45,10 @@ class Adherent extends CommonObject
|
|||||||
var $mesgs;
|
var $mesgs;
|
||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
|
|
||||||
var $ref;
|
var $ref;
|
||||||
|
public $ref_ext;
|
||||||
|
|
||||||
var $civility_id;
|
var $civility_id;
|
||||||
var $firstname;
|
var $firstname;
|
||||||
var $lastname;
|
var $lastname;
|
||||||
@ -107,6 +110,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
var $oldcopy; // To contains a clone of this when we need to save old properties of object
|
var $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||||
|
|
||||||
|
public $entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -1237,7 +1241,7 @@ class Adherent extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Insert subscription into database and eventually add links to banks, mailman, etc...
|
* Insert subscription into database and eventually add links to banks, mailman, etc...
|
||||||
*
|
*
|
||||||
* @param timestamp $date Date of effect of subscription
|
* @param int $date Date of effect of subscription
|
||||||
* @param double $montant Amount of subscription (0 accepted for some members)
|
* @param double $montant Amount of subscription (0 accepted for some members)
|
||||||
* @param int $accountid Id bank account
|
* @param int $accountid Id bank account
|
||||||
* @param string $operation Type operation (if Id bank account provided)
|
* @param string $operation Type operation (if Id bank account provided)
|
||||||
@ -1245,7 +1249,7 @@ class Adherent extends CommonObject
|
|||||||
* @param string $num_chq Numero cheque (if Id bank account provided)
|
* @param string $num_chq Numero cheque (if Id bank account provided)
|
||||||
* @param string $emetteur_nom Name of cheque writer
|
* @param string $emetteur_nom Name of cheque writer
|
||||||
* @param string $emetteur_banque Name of bank of cheque
|
* @param string $emetteur_banque Name of bank of cheque
|
||||||
* @param timestamp $datesubend Date end subscription
|
* @param int $datesubend Date end subscription
|
||||||
* @return int rowid of record added, <0 if KO
|
* @return int rowid of record added, <0 if KO
|
||||||
*/
|
*/
|
||||||
function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)
|
function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)
|
||||||
@ -1559,25 +1563,26 @@ class Adherent extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowMember").': '.$this->ref;
|
||||||
|
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
|
||||||
if ($option == 'card')
|
if ($option == 'card')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
}
|
}
|
||||||
if ($option == 'subscription')
|
if ($option == 'subscription')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
}
|
}
|
||||||
if ($option == 'category')
|
if ($option == 'category')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose;
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$picto='user';
|
$picto='user';
|
||||||
$label=$langs->trans("ShowMember");
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
@ -1601,7 +1606,7 @@ class Adherent extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $need_subscription 1 si type adherent avec cotisation, 0 sinon
|
* @param int $need_subscription 1 si type adherent avec cotisation, 0 sinon
|
||||||
* @param timestamp $date_end_subscription Date fin adhesion
|
* @param int $date_end_subscription Date fin adhesion
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -60,7 +60,7 @@ class AdherentType extends CommonObject
|
|||||||
* Fonction qui permet de creer le status de l'adherent
|
* Fonction qui permet de creer le status de l'adherent
|
||||||
*
|
*
|
||||||
* @param User $user User making creation
|
* @param User $user User making creation
|
||||||
* @return >0 if OK, < 0 if KO
|
* @return int >0 if OK, < 0 if KO
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
@ -248,13 +248,13 @@ class AdherentType extends CommonObject
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $projets;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $projets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -270,12 +270,12 @@ class AdherentType extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowTypeCard",$this->libelle);
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='group';
|
$picto='group';
|
||||||
$label=$langs->trans("ShowTypeCard",$this->libelle);
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
@ -287,7 +287,7 @@ class AdherentType extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* getMailOnValid
|
* getMailOnValid
|
||||||
*
|
*
|
||||||
* @return Return mail model
|
* @return string Return mail model
|
||||||
*/
|
*/
|
||||||
function getMailOnValid()
|
function getMailOnValid()
|
||||||
{
|
{
|
||||||
@ -306,7 +306,7 @@ class AdherentType extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* getMailOnSubscription
|
* getMailOnSubscription
|
||||||
*
|
*
|
||||||
* @return Return mail model
|
* @return string Return mail model
|
||||||
*/
|
*/
|
||||||
function getMailOnSubscription()
|
function getMailOnSubscription()
|
||||||
{
|
{
|
||||||
@ -325,7 +325,7 @@ class AdherentType extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* getMailOnResiliate
|
* getMailOnResiliate
|
||||||
*
|
*
|
||||||
* @return Return mail model
|
* @return string Return mail model
|
||||||
*/
|
*/
|
||||||
function getMailOnResiliate()
|
function getMailOnResiliate()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -264,12 +264,12 @@ class Cotisation extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowSubscription").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$picto='payment';
|
||||||
$label=$langs->trans("ShowSubscription");
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
|
|||||||
@ -171,7 +171,7 @@ $message.='<br>';
|
|||||||
print $message;
|
print $message;
|
||||||
|
|
||||||
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
|
//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
@ -86,11 +87,15 @@ $form=new Form($db);
|
|||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup');
|
print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup');
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
|
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
|
||||||
|
|
||||||
|
$head = bank_admin_prepare_head(null);
|
||||||
|
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), 0, 'account');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Parameters").'</td>';
|
print '<td>'.$langs->trans("Parameters").'</td>';
|
||||||
@ -183,7 +188,11 @@ while ($i < $nbofbank)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|||||||
154
htdocs/admin/bank_extrafields.php
Normal file
154
htdocs/admin/bank_extrafields.php
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
*
|
||||||
|
* 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/admin/bank_extrafields.php
|
||||||
|
* \ingroup bank
|
||||||
|
* \brief Page to setup extra fields of bank
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
$langs->load("banks");
|
||||||
|
$langs->load("admin");
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
// List of supported format
|
||||||
|
$tmptype2label=ExtraFields::$type2label;
|
||||||
|
$type2label=array('');
|
||||||
|
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||||
|
|
||||||
|
$action=GETPOST('action', 'alpha');
|
||||||
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
$elementtype='bank_account'; //Must be the $element of the class that manage extrafield
|
||||||
|
|
||||||
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("BankSetupModule"),$help_url);
|
||||||
|
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup');
|
||||||
|
|
||||||
|
|
||||||
|
$head = bank_admin_prepare_head(null);
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'attributes', $langs->trans("BankSetupModule"), 0, 'account');
|
||||||
|
|
||||||
|
|
||||||
|
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
// Load attribute_label
|
||||||
|
$extrafields->fetch_name_optionals_label($elementtype);
|
||||||
|
|
||||||
|
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td align="center">'.$langs->trans("Position").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Label").'</td>';
|
||||||
|
print '<td>'.$langs->trans("AttributeCode").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("Unique").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("Required").'</td>';
|
||||||
|
print '<td width="80"> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$var=True;
|
||||||
|
foreach($extrafields->attribute_type as $key => $value)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
|
||||||
|
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
|
||||||
|
print "<td>".$key."</td>\n";
|
||||||
|
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
||||||
|
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
||||||
|
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
|
||||||
|
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
||||||
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||||
|
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||||
|
print "</tr>";
|
||||||
|
// $i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
if ($action != 'create' && $action != 'edit')
|
||||||
|
{
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||||
|
print "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Creation d'un champ optionnel
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
if ($action == 'create')
|
||||||
|
{
|
||||||
|
print "<br>";
|
||||||
|
print_titre($langs->trans('NewAttribute'));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Edition d'un champ optionnel */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
if ($action == 'edit' && ! empty($attrname))
|
||||||
|
{
|
||||||
|
print "<br>";
|
||||||
|
print_titre($langs->trans("FieldEdition", $attrname));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -348,15 +348,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$commande->type=0;
|
$commande->type=0;
|
||||||
$nextval=$module->getNextValue($mysoc,$commande);
|
$nextval=$module->getNextValue($mysoc,$commande);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -299,15 +299,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval=$module->getNextValue($mysoc,$contract);
|
$nextval=$module->getNextValue($mysoc,$contract);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -324,15 +324,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval=$module->getNextValue($mysoc,$expedition);
|
$nextval=$module->getNextValue($mysoc,$expedition);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -393,30 +393,26 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$facture->type=0;
|
$facture->type=0;
|
||||||
$nextval=$module->getNextValue($mysoc,$facture);
|
$nextval=$module->getNextValue($mysoc,$facture);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans("NextValueForInvoices").': ';
|
$htmltooltip.=$langs->trans("NextValueForInvoices").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Example for remplacement
|
// Example for remplacement
|
||||||
$facture->type=1;
|
$facture->type=1;
|
||||||
$nextval=$module->getNextValue($mysoc,$facture);
|
$nextval=$module->getNextValue($mysoc,$facture);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans("NextValueForReplacements").': ';
|
$htmltooltip.=$langs->trans("NextValueForReplacements").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -424,30 +420,26 @@ foreach ($dirmodels as $reldir)
|
|||||||
// Example for credit invoice
|
// Example for credit invoice
|
||||||
$facture->type=2;
|
$facture->type=2;
|
||||||
$nextval=$module->getNextValue($mysoc,$facture);
|
$nextval=$module->getNextValue($mysoc,$facture);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans("NextValueForCreditNotes").': ';
|
$htmltooltip.=$langs->trans("NextValueForCreditNotes").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Example for deposit invoice
|
// Example for deposit invoice
|
||||||
$facture->type=3;
|
$facture->type=3;
|
||||||
$nextval=$module->getNextValue($mysoc,$facture);
|
$nextval=$module->getNextValue($mysoc,$facture);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans("NextValueForDeposit").': ';
|
$htmltooltip.=$langs->trans("NextValueForDeposit").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval;
|
$htmltooltip.=$nextval;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error);
|
$htmltooltip.=$langs->trans($module->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -328,9 +328,15 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval=$module->getNextValue($mysoc,$ficheinter);
|
$nextval=$module->getNextValue($mysoc,$ficheinter);
|
||||||
if ($nextval != $langs->trans("NotAvailable"))
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': '.$nextval;
|
if ($nextval) {
|
||||||
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
|
$htmltooltip.=$nextval.'<br>';
|
||||||
|
} else {
|
||||||
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||||
|
|||||||
@ -309,15 +309,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval=$module->getNextValue($mysoc,$livraison);
|
$nextval=$module->getNextValue($mysoc,$livraison);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,11 +48,14 @@ if ($action == 'setvalue')
|
|||||||
$mailerror = GETPOST('MAILING_EMAIL_ERRORSTO','alpha');
|
$mailerror = GETPOST('MAILING_EMAIL_ERRORSTO','alpha');
|
||||||
$checkread = GETPOST('value','alpha');
|
$checkread = GETPOST('value','alpha');
|
||||||
$checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY','alpha');
|
$checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY','alpha');
|
||||||
|
$mailingdelay = GETPOST('MAILING_DELAY', 'int');
|
||||||
|
|
||||||
$res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
$res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
$res=dolibarr_set_const($db, "MAILING_DELAY",$mailingdelay,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
// Create temporary encryption key if nedded
|
// Create temporary encryption key if nedded
|
||||||
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity);
|
||||||
@ -124,6 +127,12 @@ print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf
|
|||||||
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail"));
|
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail"));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print $langs->trans("MailingDelay").'</td><td>';
|
||||||
|
print '<input size="32" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Constant to add salt into the unsubscribe and check read tag.
|
// Constant to add salt into the unsubscribe and check read tag.
|
||||||
// It is also used as a security key parameter.
|
// It is also used as a security key parameter.
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|||||||
@ -65,12 +65,12 @@ if ($action == 'update' && empty($_POST["cancel"]))
|
|||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity);
|
||||||
// Send mode parameters
|
// Send mode parameters
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',0);
|
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',$conf->entity);
|
||||||
if (isset($_POST["MAIN_MAIL_SMTP_PORT"])) dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',0);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',$conf->entity);
|
||||||
if (isset($_POST["MAIN_MAIL_SMTP_SERVER"])) dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"),'chaine',0,'',0);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"),'chaine',0,'',$conf->entity);
|
||||||
if (isset($_POST["MAIN_MAIL_SMTPS_ID"])) dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine',0,'',0);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine',0,'',$conf->entity);
|
||||||
if (isset($_POST["MAIN_MAIL_SMTPS_PW"])) dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine',0,'',0);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine',0,'',$conf->entity);
|
||||||
if (isset($_POST["MAIN_MAIL_EMAIL_TLS"])) dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"),'chaine',0,'',0);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"),'chaine',0,'',$conf->entity);
|
||||||
// Content parameters
|
// Content parameters
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine',0,'',$conf->entity);
|
||||||
|
|||||||
@ -344,15 +344,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$propal->type=0;
|
$propal->type=0;
|
||||||
$nextval=$module->getNextValue($mysoc,$propal);
|
$nextval=$module->getNextValue($mysoc,$propal);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -278,15 +278,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval=$module->getNextValue($mysoc,$invoice);
|
$nextval=$module->getNextValue($mysoc,$invoice);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -279,15 +279,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval=$module->getNextValue($mysoc,$commande);
|
$nextval=$module->getNextValue($mysoc,$commande);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
{
|
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval)
|
if ($nextval) {
|
||||||
{
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip.=$nextval.'<br>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -278,7 +278,7 @@ if ($socid)
|
|||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">';
|
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">';
|
||||||
print dol_print_address($soc->address,'gmap','thirdparty',$object->id);
|
print dol_print_address($soc->address,'gmap','thirdparty',$soc->id);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Zip / Town
|
// Zip / Town
|
||||||
|
|||||||
@ -1274,9 +1274,9 @@ class Categorie extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'">';
|
|
||||||
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
|
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
|
||||||
|
|
||||||
|
$lien = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='category';
|
$picto='category';
|
||||||
|
|||||||
@ -118,6 +118,13 @@ class ActionComm extends CommonObject
|
|||||||
$error=0;
|
$error=0;
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (empty($this->userownerid))
|
||||||
|
{
|
||||||
|
$this->errors[]='ErrorPropertyUserowneridNotDefined';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->label=dol_trunc(trim($this->label),128);
|
$this->label=dol_trunc(trim($this->label),128);
|
||||||
$this->location=dol_trunc(trim($this->location),128);
|
$this->location=dol_trunc(trim($this->location),128);
|
||||||
@ -138,9 +145,20 @@ class ActionComm extends CommonObject
|
|||||||
if ($this->elementtype=='commande') $this->elementtype='order';
|
if ($this->elementtype=='commande') $this->elementtype='order';
|
||||||
if ($this->elementtype=='contrat') $this->elementtype='contract';
|
if ($this->elementtype=='contrat') $this->elementtype='contract';
|
||||||
|
|
||||||
|
if (! is_array($this->userassigned)) // For backward compatibility
|
||||||
|
{
|
||||||
|
$tmpid=$this->userassigned;
|
||||||
|
$this->userassigned=array();
|
||||||
|
$this->userassigned[$tmpid]=array('id'=>$tmpid);
|
||||||
|
}
|
||||||
|
|
||||||
$userownerid=$this->userownerid;
|
$userownerid=$this->userownerid;
|
||||||
$userdoneid=$this->userdoneid;
|
$userdoneid=$this->userdoneid;
|
||||||
|
|
||||||
|
// Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...).
|
||||||
|
if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned))
|
||||||
|
$this->userassigned = array($userownerid=>array('id'=>$userownerid));
|
||||||
|
|
||||||
if (! $this->type_id || ! $this->type_code)
|
if (! $this->type_id || ! $this->type_code)
|
||||||
{
|
{
|
||||||
$key=empty($this->type_id)?$this->type_code:$this->type_id;
|
$key=empty($this->type_id)?$this->type_code:$this->type_id;
|
||||||
@ -226,6 +244,12 @@ class ActionComm extends CommonObject
|
|||||||
{
|
{
|
||||||
foreach($this->userassigned as $key => $val)
|
foreach($this->userassigned as $key => $val)
|
||||||
{
|
{
|
||||||
|
if (! is_array($val)) // For backward compatibility when val=id
|
||||||
|
{
|
||||||
|
$tmpid=$val;
|
||||||
|
$val=array('id'=>$val);
|
||||||
|
}
|
||||||
|
|
||||||
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||||
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['mandatory']?$val['mandatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")";
|
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['mandatory']?$val['mandatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")";
|
||||||
|
|
||||||
@ -873,11 +897,12 @@ class ActionComm extends CommonObject
|
|||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.'">';
|
|
||||||
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.'">';
|
|
||||||
$lienfin='</a>';
|
|
||||||
$label=$this->label;
|
$label=$this->label;
|
||||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||||
|
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
|
||||||
|
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
|
||||||
|
$lienfin='</a>';
|
||||||
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
||||||
|
|
||||||
if ($withpicto == 2)
|
if ($withpicto == 2)
|
||||||
@ -973,7 +998,7 @@ class ActionComm extends CommonObject
|
|||||||
$sql.= " a.label, a.code, a.note, a.fk_action as type_id,";
|
$sql.= " a.label, a.code, a.note, a.fk_action as type_id,";
|
||||||
$sql.= " a.fk_soc,";
|
$sql.= " a.fk_soc,";
|
||||||
$sql.= " a.fk_user_author, a.fk_user_mod,";
|
$sql.= " a.fk_user_author, a.fk_user_mod,";
|
||||||
$sql.= " a.fk_user_action, a.fk_user_done,";
|
$sql.= " a.fk_user_action,";
|
||||||
$sql.= " a.fk_contact, a.percent as percentage,";
|
$sql.= " a.fk_contact, a.percent as percentage,";
|
||||||
$sql.= " a.fk_element, a.elementtype,";
|
$sql.= " a.fk_element, a.elementtype,";
|
||||||
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
|
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
|
||||||
@ -981,8 +1006,10 @@ class ActionComm extends CommonObject
|
|||||||
$sql.= " s.nom as socname,";
|
$sql.= " s.nom as socname,";
|
||||||
$sql.= " c.id as type_id, c.code as type_code, c.libelle";
|
$sql.= " c.id as type_id, c.code as type_code, c.libelle";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
|
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
||||||
|
// We must filter on assignement table
|
||||||
|
if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
$sql.= " WHERE a.fk_action=c.id";
|
$sql.= " WHERE a.fk_action=c.id";
|
||||||
$sql.= " AND a.entity = ".$conf->entity;
|
$sql.= " AND a.entity = ".$conf->entity;
|
||||||
foreach ($filters as $key => $value)
|
foreach ($filters as $key => $value)
|
||||||
@ -993,17 +1020,8 @@ class ActionComm extends CommonObject
|
|||||||
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);
|
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);
|
||||||
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
|
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
|
||||||
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
|
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
|
||||||
if ($key == 'login')
|
// We must filter on assignement table
|
||||||
{
|
if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||||
$login=$value;
|
|
||||||
$userforfilter=new User($this->db);
|
|
||||||
$result=$userforfilter->fetch('',$value);
|
|
||||||
$sql.= " AND (";
|
|
||||||
$sql.= " a.fk_user_author = ".$userforfilter->id;
|
|
||||||
$sql.= " OR a.fk_user_action = ".$userforfilter->id;
|
|
||||||
$sql.= " OR a.fk_user_done = ".$userforfilter->id;
|
|
||||||
$sql.= ")";
|
|
||||||
}
|
|
||||||
if ($key == 'logina')
|
if ($key == 'logina')
|
||||||
{
|
{
|
||||||
$logina=$value;
|
$logina=$value;
|
||||||
@ -1011,19 +1029,12 @@ class ActionComm extends CommonObject
|
|||||||
$result=$userforfilter->fetch('',$value);
|
$result=$userforfilter->fetch('',$value);
|
||||||
$sql.= " AND a.fk_user_author = ".$userforfilter->id;
|
$sql.= " AND a.fk_user_author = ".$userforfilter->id;
|
||||||
}
|
}
|
||||||
if ($key == 'logint')
|
if ($key == 'logint' || $key == 'login')
|
||||||
{
|
{
|
||||||
$logint=$value;
|
$logint=$value;
|
||||||
$userforfilter=new User($this->db);
|
$userforfilter=new User($this->db);
|
||||||
$result=$userforfilter->fetch('',$value);
|
$result=$userforfilter->fetch('',$value);
|
||||||
$sql.= " AND a.fk_user_action = ".$userforfilter->id;
|
$sql.= " AND ar.fk_element = ".$userforfilter->id;
|
||||||
}
|
|
||||||
if ($key == 'logind')
|
|
||||||
{
|
|
||||||
$logind=$value;
|
|
||||||
$userforfilter=new User($this->db);
|
|
||||||
$result=$userforfilter->fetch('',$value);
|
|
||||||
$sql.= " AND a.fk_user_done = ".$userforfilter->id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
||||||
|
|||||||
@ -40,9 +40,7 @@ if (! empty($conf->projet->enabled)) {
|
|||||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||||
|
|
||||||
$filter=GETPOST("filter",'',3);
|
$filter=GETPOST("filter",'',3);
|
||||||
$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3);
|
|
||||||
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
||||||
$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
|
|
||||||
$usergroup = GETPOST("usergroup","int",3);
|
$usergroup = GETPOST("usergroup","int",3);
|
||||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||||
|
|
||||||
@ -72,9 +70,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden();
|
|||||||
if (! $user->rights->agenda->allactions->read) $canedit=0;
|
if (! $user->rights->agenda->allactions->read) $canedit=0;
|
||||||
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
|
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
|
||||||
{
|
{
|
||||||
$filtera=$user->id;
|
|
||||||
$filtert=$user->id;
|
$filtert=$user->id;
|
||||||
$filterd=$user->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
@ -283,9 +279,7 @@ $param='';
|
|||||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtera) $param.="&filtera=".$filtera;
|
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
if ($filterd) $param.="&filterd=".$filterd;
|
|
||||||
if ($socid) $param.="&socid=".$socid;
|
if ($socid) $param.="&socid=".$socid;
|
||||||
if ($showbirthday) $param.="&showbirthday=1";
|
if ($showbirthday) $param.="&showbirthday=1";
|
||||||
if ($pid) $param.="&projectid=".$pid;
|
if ($pid) $param.="&projectid=".$pid;
|
||||||
@ -340,7 +334,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
|||||||
$head = calendars_prepare_head($paramnoaction);
|
$head = calendars_prepare_head($paramnoaction);
|
||||||
|
|
||||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
|
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
$showextcals=$listofextcals;
|
$showextcals=$listofextcals;
|
||||||
@ -405,27 +399,29 @@ print_fiche_titre($s,$link.' '.$nav, '');
|
|||||||
// Get event in an array
|
// Get event in an array
|
||||||
$eventarray=array();
|
$eventarray=array();
|
||||||
|
|
||||||
$sql = 'SELECT a.id,a.label,';
|
$sql = 'SELECT ';
|
||||||
|
if ($usergroup > 0) $sql.=" DISTINCT";
|
||||||
|
$sql.= ' a.id, a.label,';
|
||||||
$sql.= ' a.datep,';
|
$sql.= ' a.datep,';
|
||||||
$sql.= ' a.datep2,';
|
$sql.= ' a.datep2,';
|
||||||
$sql.= ' a.datea,';
|
|
||||||
$sql.= ' a.datea2,';
|
|
||||||
$sql.= ' a.percent,';
|
$sql.= ' a.percent,';
|
||||||
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
|
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
||||||
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||||
$sql.= ' a.fk_soc, a.fk_contact,';
|
$sql.= ' a.fk_soc, a.fk_contact,';
|
||||||
$sql.= ' ca.code as type_code, ca.libelle as type_label';
|
$sql.= ' ca.code as type_code, ca.libelle as type_label';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
|
// We must filter on assignement table
|
||||||
|
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
|
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||||
$sql.= ' WHERE a.fk_action = ca.id';
|
$sql.= ' WHERE a.fk_action = ca.id';
|
||||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||||
// FIXME: We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action";
|
if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||||
if ($action == 'show_day')
|
if ($action == 'show_day')
|
||||||
{
|
{
|
||||||
$sql.= " AND (";
|
$sql.= " AND (";
|
||||||
@ -459,14 +455,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
|
|||||||
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
|
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
|
||||||
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
|
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
|
||||||
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
|
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
|
||||||
// FIXME: We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
|
if ($filtert > 0 || $usergroup > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND (";
|
$sql.= " AND (";
|
||||||
if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera;
|
if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
|
||||||
if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert;
|
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
||||||
if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
|
|
||||||
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
}
|
}
|
||||||
// Sort on date
|
// Sort on date
|
||||||
@ -1000,7 +994,7 @@ elseif ($action == 'show_week') // View by week
|
|||||||
{
|
{
|
||||||
// Show days of the current week
|
// Show days of the current week
|
||||||
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
|
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
|
||||||
$tmparray = dol_getdate($curtime,'fast');
|
$tmparray = dol_getdate($curtime, true);
|
||||||
$tmpday = $tmparray['mday'];
|
$tmpday = $tmparray['mday'];
|
||||||
$tmpmonth = $tmparray['mon'];
|
$tmpmonth = $tmparray['mon'];
|
||||||
$tmpyear = $tmparray['year'];
|
$tmpyear = $tmparray['year'];
|
||||||
@ -1094,7 +1088,7 @@ $db->close();
|
|||||||
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
|
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
|
global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form
|
||||||
global $theme_datacolor;
|
global $theme_datacolor;
|
||||||
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
|
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
|
||||||
|
|
||||||
@ -1383,7 +1377,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year;
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year;
|
||||||
print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
|
print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
|
||||||
print ($filtera?'&filtera='.$filtera:'').($filtert?'&filtert='.$filtert:'').($filterd?'&filterd='.$filterd:'');
|
print ($filtert?'&filtert='.$filtert:'');
|
||||||
print ($actioncode!=''?'&actioncode='.$actioncode:'');
|
print ($actioncode!=''?'&actioncode='.$actioncode:'');
|
||||||
print '">'.img_picto("all","1downarrow_selected.png").' ...';
|
print '">'.img_picto("all","1downarrow_selected.png").' ...';
|
||||||
print ' +'.(count($eventarray[$daykey])-$maxprint);
|
print ' +'.(count($eventarray[$daykey])-$maxprint);
|
||||||
|
|||||||
@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||||
|
|
||||||
|
$langs->load("users");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("agenda");
|
$langs->load("agenda");
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
@ -52,9 +53,7 @@ if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $s
|
|||||||
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
||||||
|
|
||||||
$filter=GETPOST("filter",'',3);
|
$filter=GETPOST("filter",'',3);
|
||||||
$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3);
|
|
||||||
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
||||||
$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
|
|
||||||
$usergroup = GETPOST("usergroup","int",3);
|
$usergroup = GETPOST("usergroup","int",3);
|
||||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||||
|
|
||||||
@ -94,9 +93,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden();
|
|||||||
if (! $user->rights->agenda->allactions->read) $canedit=0;
|
if (! $user->rights->agenda->allactions->read) $canedit=0;
|
||||||
if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permission to see all, we show only affected to me
|
if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permission to see all, we show only affected to me
|
||||||
{
|
{
|
||||||
$filtera=$user->id;
|
|
||||||
$filtert=$user->id;
|
$filtert=$user->id;
|
||||||
$filterd=$user->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
@ -133,15 +130,14 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
$userstatic=new User($db);
|
||||||
|
|
||||||
$nav='';
|
$nav='';
|
||||||
$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">';
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">';
|
||||||
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
||||||
if ($filtera) $nav.='<input type="hidden" name="filtera" value="'.$filtera.'">';
|
|
||||||
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||||
if ($filterd) $nav.='<input type="hidden" name="filterd" value="'.$filterd.'">';
|
|
||||||
if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
|
if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
|
||||||
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">';
|
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">';
|
||||||
if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
|
if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
|
||||||
@ -163,65 +159,57 @@ $param='';
|
|||||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtera) $param.="&filtera=".$filtera;
|
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
if ($filterd) $param.="&filterd=".$filterd;
|
|
||||||
if ($socid) $param.="&socid=".$socid;
|
if ($socid) $param.="&socid=".$socid;
|
||||||
if ($showbirthday) $param.="&showbirthday=1";
|
if ($showbirthday) $param.="&showbirthday=1";
|
||||||
if ($pid) $param.="&projectid=".$pid;
|
if ($pid) $param.="&projectid=".$pid;
|
||||||
if ($type) $param.="&type=".$type;
|
if ($type) $param.="&type=".$type;
|
||||||
if ($usergroup) $param.="&usergroup=".$usergroup;
|
if ($usergroup) $param.="&usergroup=".$usergroup;
|
||||||
|
|
||||||
$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,";
|
$sql = "SELECT";
|
||||||
$sql.= " a.id, a.datep as dp, a.datep2 as dp2,";
|
if ($usergroup > 0) $sql.=" DISTINCT";
|
||||||
$sql.= " a.fk_contact, a.note, a.label, a.percent as percent,";
|
$sql.= " s.nom as societe, s.rowid as socid, s.client,";
|
||||||
|
$sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,";
|
||||||
|
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
||||||
|
$sql.= " a.fk_contact, a.note, a.percent as percent,";
|
||||||
$sql.= " c.code as type_code, c.libelle as type_label,";
|
$sql.= " c.code as type_code, c.libelle as type_label,";
|
||||||
$sql.= " ua.login as loginauthor, ua.rowid as useridauthor,";
|
|
||||||
$sql.= " ut.login as logintodo, ut.rowid as useridtodo,";
|
|
||||||
//$sql.= " ud.login as logindone, ud.rowid as useriddone,";
|
|
||||||
$sql.= " sp.lastname, sp.firstname";
|
$sql.= " sp.lastname, sp.firstname";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||||
$sql.= " ".MAIN_DB_PREFIX.'user as u,';
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
|
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON a.fk_user_author = ua.rowid";
|
// We must filter on assignement table
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid";
|
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid";
|
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||||
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
|
|
||||||
$sql.= " WHERE c.id = a.fk_action";
|
$sql.= " WHERE c.id = a.fk_action";
|
||||||
$sql.= ' AND a.fk_user_author = u.rowid';
|
|
||||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||||
if ($actioncode) $sql.=" AND c.code='".$db->escape($actioncode)."'";
|
if ($actioncode) $sql.=" AND c.code='".$db->escape($actioncode)."'";
|
||||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||||
// FIXME: We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action";
|
if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||||
if ($type) $sql.= " AND c.id = ".$type;
|
if ($type) $sql.= " AND c.id = ".$type;
|
||||||
if ($status == '0') { $sql.= " AND a.percent = 0"; }
|
if ($status == '0') { $sql.= " AND a.percent = 0"; }
|
||||||
if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
|
if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
|
||||||
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
|
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
|
||||||
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
|
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
|
||||||
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
|
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
|
||||||
// FIXME: We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
|
if ($filtert > 0 || $usergroup > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND (";
|
$sql.= " AND (";
|
||||||
if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera;
|
if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
|
||||||
if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert;
|
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
||||||
if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
|
|
||||||
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
// The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case)
|
// The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case)
|
||||||
if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))";
|
if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))";
|
||||||
if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'";
|
if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'";
|
||||||
if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'";
|
if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'";
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit + 1, $offset);
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
dol_syslog("comm/action/listactions.php", LOG_DEBUG);
|
dol_syslog("comm/action/listactions.php", LOG_DEBUG);
|
||||||
@ -246,7 +234,7 @@ if ($resql)
|
|||||||
$head = calendars_prepare_head($param);
|
$head = calendars_prepare_head($param);
|
||||||
|
|
||||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,-1,$actioncode,$usergroup);
|
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
// Add link to show birthdays
|
// Add link to show birthdays
|
||||||
@ -275,14 +263,11 @@ if ($resql)
|
|||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||||
//print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||||
//print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder);
|
|
||||||
//print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -375,46 +360,16 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// User author
|
|
||||||
/*
|
|
||||||
print '<td align="left">';
|
|
||||||
if ($obj->useridauthor)
|
|
||||||
{
|
|
||||||
$userstatic=new User($db);
|
|
||||||
$userstatic->id=$obj->useridauthor;
|
|
||||||
$userstatic->login=$obj->loginauthor;
|
|
||||||
print $userstatic->getLoginUrl(1);
|
|
||||||
}
|
|
||||||
else print ' ';
|
|
||||||
print '</td>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
// User to do
|
// User to do
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($obj->useridtodo)
|
if ($obj->fk_user_action > 0)
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
$userstatic->fetch($obj->fk_user_action);
|
||||||
$userstatic->id=$obj->useridtodo;
|
|
||||||
$userstatic->login=$obj->logintodo;
|
|
||||||
print $userstatic->getLoginUrl(1);
|
print $userstatic->getLoginUrl(1);
|
||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// User did
|
|
||||||
/*
|
|
||||||
print '<td align="left">';
|
|
||||||
if ($obj->useriddone)
|
|
||||||
{
|
|
||||||
$userstatic=new User($db);
|
|
||||||
$userstatic->id=$obj->useriddone;
|
|
||||||
$userstatic->login=$obj->logindone;
|
|
||||||
print $userstatic->getLoginUrl(1);
|
|
||||||
}
|
|
||||||
else print ' ';
|
|
||||||
print '</td>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Status/Percent
|
// Status/Percent
|
||||||
print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
|
print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
|
||||||
|
|
||||||
@ -434,6 +389,6 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|||||||
@ -39,9 +39,7 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
|
|||||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||||
|
|
||||||
$filter=GETPOST("filter",'',3);
|
$filter=GETPOST("filter",'',3);
|
||||||
$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3);
|
|
||||||
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
||||||
$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
|
|
||||||
$usergroup = GETPOST("usergroup","int",3);
|
$usergroup = GETPOST("usergroup","int",3);
|
||||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||||
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||||
@ -73,9 +71,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden();
|
|||||||
if (! $user->rights->agenda->allactions->read) $canedit=0;
|
if (! $user->rights->agenda->allactions->read) $canedit=0;
|
||||||
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
|
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
|
||||||
{
|
{
|
||||||
$filtera=$user->id;
|
|
||||||
$filtert=$user->id;
|
$filtert=$user->id;
|
||||||
$filterd=$user->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//$action=GETPOST('action','alpha');
|
//$action=GETPOST('action','alpha');
|
||||||
@ -130,6 +126,7 @@ if (GETPOST('viewday') || $action == 'show_day') {
|
|||||||
} // View by day
|
} // View by day
|
||||||
|
|
||||||
|
|
||||||
|
$langs->load("users");
|
||||||
$langs->load("agenda");
|
$langs->load("agenda");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
@ -198,9 +195,7 @@ $param='';
|
|||||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtera) $param.="&filtera=".$filtera;
|
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
if ($filterd) $param.="&filterd=".$filterd;
|
|
||||||
if ($usergroup) $param.="&usergroup=".$usergroup;
|
if ($usergroup) $param.="&usergroup=".$usergroup;
|
||||||
if ($socid) $param.="&socid=".$socid;
|
if ($socid) $param.="&socid=".$socid;
|
||||||
if ($showbirthday) $param.="&showbirthday=1";
|
if ($showbirthday) $param.="&showbirthday=1";
|
||||||
@ -280,7 +275,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
|||||||
$head = calendars_prepare_head($paramnoaction);
|
$head = calendars_prepare_head($paramnoaction);
|
||||||
|
|
||||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||||
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
|
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
$showextcals=$listofextcals;
|
$showextcals=$listofextcals;
|
||||||
@ -332,27 +327,29 @@ print_fiche_titre($s,$link.' '.$nav, '');
|
|||||||
// Get event in an array
|
// Get event in an array
|
||||||
$eventarray=array();
|
$eventarray=array();
|
||||||
|
|
||||||
$sql = 'SELECT a.id,a.label,';
|
$sql = 'SELECT';
|
||||||
|
if ($usergroup > 0) $sql.=" DISTINCT";
|
||||||
|
$sql.= ' a.id, a.label,';
|
||||||
$sql.= ' a.datep,';
|
$sql.= ' a.datep,';
|
||||||
$sql.= ' a.datep2,';
|
$sql.= ' a.datep2,';
|
||||||
$sql.= ' a.datea,';
|
|
||||||
$sql.= ' a.datea2,';
|
|
||||||
$sql.= ' a.percent,';
|
$sql.= ' a.percent,';
|
||||||
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
|
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
||||||
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||||
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
||||||
$sql.= ' ca.code, ca.color';
|
$sql.= ' ca.code, ca.color';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
|
// We must filter on assignement table
|
||||||
|
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
|
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||||
$sql.= ' WHERE a.fk_action = ca.id';
|
$sql.= ' WHERE a.fk_action = ca.id';
|
||||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||||
// FIXME: We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action";
|
if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||||
if ($action == 'show_day')
|
if ($action == 'show_day')
|
||||||
{
|
{
|
||||||
$sql.= " AND (";
|
$sql.= " AND (";
|
||||||
@ -386,14 +383,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
|
|||||||
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
|
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
|
||||||
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
|
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
|
||||||
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
|
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
|
||||||
// FIXME: We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
|
if ($filtert > 0 || $usergroup > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND (";
|
$sql.= " AND (";
|
||||||
if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera;
|
if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
|
||||||
if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert;
|
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
||||||
if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
|
|
||||||
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
}
|
}
|
||||||
// Sort on date
|
// Sort on date
|
||||||
@ -679,7 +674,7 @@ foreach ($usernames as $username)
|
|||||||
{
|
{
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo '<td class="cal_current_month"'.($var?' style="background: #F8F8F8"':'').'>' . $username->getNomUrl(1). '</td>';
|
echo '<td class="cal_current_month cal_peruserviewname"'.($var?' style="background: #F8F8F8"':'').'>' . $username->getNomUrl(1). '</td>';
|
||||||
$tmpday = $sav;
|
$tmpday = $sav;
|
||||||
|
|
||||||
// Lopp on each day of week
|
// Lopp on each day of week
|
||||||
@ -809,7 +804,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
global $user, $conf, $langs, $hookmanager, $action;
|
global $user, $conf, $langs, $hookmanager, $action;
|
||||||
global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
|
global $filter, $filtert, $status, $actioncode; // Filters used into search form
|
||||||
global $theme_datacolor; // Array with a list of different we can use (come from theme)
|
global $theme_datacolor; // Array with a list of different we can use (come from theme)
|
||||||
global $cachethirdparties, $cachecontacts, $colorindexused;
|
global $cachethirdparties, $cachecontacts, $colorindexused;
|
||||||
global $begin_h, $end_h;
|
global $begin_h, $end_h;
|
||||||
@ -905,9 +900,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
$newcolor = ''; //init
|
$newcolor = ''; //init
|
||||||
if (empty($event->fulldayevent))
|
if (empty($event->fulldayevent))
|
||||||
{
|
{
|
||||||
$a = dol_mktime((int) $h,0,0,$month,$day,$year,false,false);
|
$a = dol_mktime((int) $h,0,0,$month,$day,$year,false,0);
|
||||||
$b = dol_mktime((int) $h,30,0,$month,$day,$year,false,false);
|
$b = dol_mktime((int) $h,30,0,$month,$day,$year,false,0);
|
||||||
$c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,false);
|
$c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,0);
|
||||||
|
|
||||||
$dateendtouse=$event->date_end_in_calendar;
|
$dateendtouse=$event->date_end_in_calendar;
|
||||||
if ($dateendtouse==$event->date_start_in_calendar) $dateendtouse++;
|
if ($dateendtouse==$event->date_start_in_calendar) $dateendtouse++;
|
||||||
|
|||||||
@ -66,6 +66,7 @@ $pageprev = $page - 1;
|
|||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if (! $sortfield) $sortfield="nom";
|
if (! $sortfield) $sortfield="nom";
|
||||||
|
$cancelbutton = GETPOST('cancel');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('commcard','globalcard'));
|
$hookmanager->initHooks(array('commcard','globalcard'));
|
||||||
@ -80,12 +81,14 @@ $parameters = array('socid' => $id);
|
|||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
//Some actions show a "cancel" input submit button with name="cancel"
|
if (empty($reshook))
|
||||||
$cancelbutton = GETPOST('cancel');
|
{
|
||||||
|
if ($cancelbutton)
|
||||||
|
{
|
||||||
|
$action="";
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'setcustomeraccountancycode')
|
if ($action == 'setcustomeraccountancycode')
|
||||||
{
|
|
||||||
if (! $cancelbutton)
|
|
||||||
{
|
{
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
$object->code_compta=$_POST["customeraccountancycode"];
|
$object->code_compta=$_POST["customeraccountancycode"];
|
||||||
@ -95,8 +98,6 @@ if ($action == 'setcustomeraccountancycode')
|
|||||||
setEventMessage($object->errors, 'errors');
|
setEventMessage($object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$action="";
|
|
||||||
}
|
|
||||||
|
|
||||||
// conditions de reglement
|
// conditions de reglement
|
||||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||||
@ -105,6 +106,7 @@ if ($action == 'setconditions' && $user->rights->societe->creer)
|
|||||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mode de reglement
|
// mode de reglement
|
||||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
@ -112,16 +114,14 @@ if ($action == 'setmode' && $user->rights->societe->creer)
|
|||||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// assujetissement a la TVA
|
// assujetissement a la TVA
|
||||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->tva_assuj=$_POST['assujtva_value'];
|
$object->tva_assuj=$_POST['assujtva_value'];
|
||||||
|
$result=$object->update($object->id);
|
||||||
// TODO move to DAO class
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'";
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if (! $result) dol_print_error($result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set prospect level
|
// set prospect level
|
||||||
@ -133,7 +133,7 @@ if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
|||||||
if ($result < 0) setEventMessage($object->error,'errors');
|
if ($result < 0) setEventMessage($object->error,'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update communication level
|
// update prospect level
|
||||||
if ($action == 'cstc')
|
if ($action == 'cstc')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -142,10 +142,8 @@ if ($action == 'cstc')
|
|||||||
if ($result < 0) setEventMessage($object->error,'errors');
|
if ($result < 0) setEventMessage($object->error,'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update communication level
|
// update outstandng limit
|
||||||
if ($action == 'setOutstandingBill')
|
if ($action == 'setOutstandingBill')
|
||||||
{
|
|
||||||
if (!$cancelbutton)
|
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->outstanding_limit=GETPOST('OutstandingBill');
|
$object->outstanding_limit=GETPOST('OutstandingBill');
|
||||||
@ -159,14 +157,24 @@ if ($action == 'setOutstandingBill')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans('CustomerCard'));
|
|
||||||
|
|
||||||
|
|
||||||
$contactstatic = new Contact($db);
|
$contactstatic = new Contact($db);
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formcompany=new FormCompany($db);
|
$formcompany=new FormCompany($db);
|
||||||
|
|
||||||
|
if ($id > 0 && empty($object->id))
|
||||||
|
{
|
||||||
|
// Load data of third party
|
||||||
|
$res=$object->fetch($id);
|
||||||
|
if ($object->id <= 0) dol_print_error($db,$object->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$title=$langs->trans("CustomerCard");
|
||||||
|
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name;
|
||||||
|
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||||
|
llxHeader('',$title,$help_url);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($mode == 'search')
|
if ($mode == 'search')
|
||||||
{
|
{
|
||||||
@ -196,14 +204,6 @@ if ($mode == 'search')
|
|||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
// Load data of third party
|
|
||||||
$object->fetch($id);
|
|
||||||
if ($object->id <= 0)
|
|
||||||
{
|
|
||||||
dol_print_error($db,$object->error);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$head = societe_prepare_head($object);
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company');
|
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company');
|
||||||
@ -519,7 +519,7 @@ if ($id > 0)
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>';
|
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' <span class="badge">'.$num.'</span></a></td>';
|
||||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||||
print '</tr></table></td>';
|
print '</tr></table></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -531,9 +531,11 @@ if ($id > 0)
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td class="nowrap"><a href="propal.php?id='.$objp->propalid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.'</a>'."\n";
|
print '<td class="nowrap">';
|
||||||
if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 )
|
$propal_static->id=$objp->propalid;
|
||||||
{
|
$propal_static->ref=$objp->ref;
|
||||||
|
print $propal_static->getNomUrl(1);
|
||||||
|
if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) {
|
||||||
print " ".img_warning();
|
print " ".img_warning();
|
||||||
}
|
}
|
||||||
print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||||
@ -592,7 +594,7 @@ if ($id > 0)
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' ('.$num.')</a></td>';
|
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
|
||||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||||
//if($num2 > 0) print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'</a></td>';
|
//if($num2 > 0) print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'</a></td>';
|
||||||
//else print '<td width="20px" align="right"><a href="#">'.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'</a></td>';
|
//else print '<td width="20px" align="right"><a href="#">'.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'</a></td>';
|
||||||
@ -606,7 +608,10 @@ if ($id > 0)
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$objp->cid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."</a>\n";
|
print '<td class="nowrap">';
|
||||||
|
$commande_static->id=$objp->cid;
|
||||||
|
$commande_static->ref=$objp->ref;
|
||||||
|
print $commande_static->getNomUrl(1);
|
||||||
print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
|
print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
|
||||||
print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
||||||
print '<td align="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).'</td></tr>';
|
print '<td align="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).'</td></tr>';
|
||||||
@ -647,7 +652,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
||||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' ('.$num.')</a></td></tr></table></td>';
|
print '<td align="right"><a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' <span class="badge">'.$num.'</span></a></td></tr></table></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -706,7 +711,7 @@ if ($id > 0)
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' ('.$num.')</td></tr></table></td>';
|
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td></tr></table></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
}
|
}
|
||||||
@ -769,7 +774,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
$tableaushown=1;
|
$tableaushown=1;
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' ('.$num.')</a></td>';
|
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
|
||||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||||
print '</tr></table></td>';
|
print '</tr></table></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -142,7 +142,7 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
|
|||||||
*/
|
*/
|
||||||
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||||
{
|
{
|
||||||
$sql = "SELECT p.rowid, p.ref, p.total_ht, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -172,6 +172,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||||
$propalstatic->id=$obj->rowid;
|
$propalstatic->id=$obj->rowid;
|
||||||
$propalstatic->ref=$obj->ref;
|
$propalstatic->ref=$obj->ref;
|
||||||
|
$propalstatic->ref_client=$obj->ref_client;
|
||||||
print $propalstatic->getNomUrl(1);
|
print $propalstatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
@ -209,7 +210,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||||||
{
|
{
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
|
|
||||||
$sql = "SELECT c.rowid, c.ref, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -239,6 +240,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||||
$orderstatic->id=$obj->rowid;
|
$orderstatic->id=$obj->rowid;
|
||||||
$orderstatic->ref=$obj->ref;
|
$orderstatic->ref=$obj->ref;
|
||||||
|
$orderstatic->ref_client=$obj->ref_client;
|
||||||
print $orderstatic->getNomUrl(1);
|
print $orderstatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
@ -467,7 +469,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||||||
{
|
{
|
||||||
$langs->load("propal");
|
$langs->load("propal");
|
||||||
|
|
||||||
$sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
|
$sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -503,6 +505,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||||||
|
|
||||||
$propalstatic->id=$obj->propalid;
|
$propalstatic->id=$obj->propalid;
|
||||||
$propalstatic->ref=$obj->ref;
|
$propalstatic->ref=$obj->ref;
|
||||||
|
$propalstatic->ref_client=$obj->ref_client;
|
||||||
|
|
||||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
print '<td class="nobordernopadding nowrap">';
|
print '<td class="nobordernopadding nowrap">';
|
||||||
|
|||||||
@ -110,6 +110,8 @@ $parameters=array();
|
|||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
@ -323,6 +325,10 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAILING_DELAY))
|
||||||
|
{
|
||||||
|
sleep($conf->global->MAILING_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
//test if CHECK READ change statut prospect contact
|
//test if CHECK READ change statut prospect contact
|
||||||
}
|
}
|
||||||
@ -649,20 +655,19 @@ if (! empty($_POST["cancel"]))
|
|||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$htmlother = new FormOther($db);
|
||||||
|
|
||||||
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
||||||
llxHeader('',$langs->trans("Mailing"),$help_url);
|
llxHeader('',$langs->trans("Mailing"),$help_url);
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
$htmlother = new FormOther($db);
|
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
// EMailing in creation mode
|
// EMailing in creation mode
|
||||||
|
|||||||
@ -108,6 +108,8 @@ $parameters = array('socid' => $socid);
|
|||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
@ -550,7 +552,33 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php';
|
// Classify billed
|
||||||
|
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
|
||||||
|
$object->cloture($user, 4, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reopen proposal
|
||||||
|
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||||
|
// prevent browser refresh from reopening proposal several times
|
||||||
|
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
|
||||||
|
$object->reopen($user, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close proposal
|
||||||
|
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||||
|
if (! GETPOST('statut')) {
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
|
||||||
|
$action = 'statut';
|
||||||
|
} else {
|
||||||
|
// prevent browser refresh from closing proposal several times
|
||||||
|
if ($object->statut == 1) {
|
||||||
|
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1146,6 +1174,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -2550,21 +2550,18 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
|
|
||||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
|
||||||
foreach ($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
$file = $conf->global->PROPALE_ADDON.".php";
|
$file = $conf->global->PROPALE_ADDON.".php";
|
||||||
$classname = $conf->global->PROPALE_ADDON;
|
$classname = $conf->global->PROPALE_ADDON;
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
{
|
foreach ($dirmodels as $reldir) {
|
||||||
$dir = $dirroot.$reldir."/core/modules/propale/";
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/propale/");
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (! $mybool)
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
@ -2608,29 +2605,31 @@ class Propal extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
if ($option == '')
|
$label=$langs->trans("ShowPropal").': '.$this->ref;
|
||||||
{
|
if (! empty($this->ref_client))
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .'">';
|
$label.= '<br>'.$langs->trans('RefCustomer').': '.$this->ref_client;
|
||||||
|
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
if ($option == '') {
|
||||||
|
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||||
}
|
}
|
||||||
if ($option == 'compta') // deprecated
|
if ($option == 'compta') { // deprecated
|
||||||
{
|
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .'">';
|
|
||||||
}
|
}
|
||||||
if ($option == 'expedition')
|
if ($option == 'expedition') {
|
||||||
{
|
$lien = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .'">';
|
|
||||||
}
|
}
|
||||||
if ($option == 'document')
|
if ($option == 'document') {
|
||||||
{
|
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose;
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .'">';
|
|
||||||
}
|
}
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='propal';
|
$picto='propal';
|
||||||
$label=$langs->trans("ShowPropal").': '.$this->ref;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto)
|
||||||
|
$result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
|
if ($withpicto && $withpicto != 2)
|
||||||
|
$result.=' ';
|
||||||
$result.=$lien.$this->ref.$lienfin;
|
$result.=$lien.$this->ref.$lienfin;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -313,7 +313,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=1">('.$num.')</a></td></tr>';
|
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></td></tr>';
|
||||||
|
|
||||||
$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
|
$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||||
while ($i < $nbofloop)
|
while ($i < $nbofloop)
|
||||||
@ -399,7 +399,7 @@ if (! empty($conf->propal->enabled))
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("ProposalsToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1">('.$num.')</a></td></tr>';
|
print '<td colspan="3">'.$langs->trans("ProposalsToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></td></tr>';
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
@ -471,7 +471,7 @@ if (! empty($conf->propal->enabled))
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=2">('.$num.')</a></td></tr>';
|
print '<td colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=2"><span class="badge">'.$num.'</span></a></td></tr>';
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -177,12 +177,14 @@ $parameters=array();
|
|||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook)) {
|
||||||
if ($action == 'cstc')
|
if ($action == 'cstc')
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"];
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"];
|
||||||
$sql .= " WHERE rowid = ".$_GET["socid"];
|
$sql .= " WHERE rowid = ".$_GET["socid"];
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -102,6 +102,8 @@ $parameters = array('socid' => $socid);
|
|||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
@ -1198,6 +1200,8 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
@ -141,20 +141,19 @@ class Commande extends CommonOrder
|
|||||||
if (! empty($conf->global->COMMANDE_ADDON))
|
if (! empty($conf->global->COMMANDE_ADDON))
|
||||||
{
|
{
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
|
||||||
foreach ($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
$file = $conf->global->COMMANDE_ADDON.".php";
|
$file = $conf->global->COMMANDE_ADDON.".php";
|
||||||
$classname = $conf->global->COMMANDE_ADDON;
|
$classname = $conf->global->COMMANDE_ADDON;
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = $dirroot.$reldir."/core/modules/commande/";
|
$dir = dol_buildpath($reldir."core/modules/commande/");
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (! $mybool)
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
@ -2885,11 +2884,13 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if ($short) return $url;
|
if ($short) return $url;
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'">';
|
|
||||||
$linkend='</a>';
|
|
||||||
|
|
||||||
$picto='order';
|
$picto='order';
|
||||||
$label=$langs->trans("ShowOrder").': '.$this->ref;
|
$label=$langs->trans("ShowOrder").': '.$this->ref;
|
||||||
|
if (! empty($this->ref_client))
|
||||||
|
$label.= '<br>'.$langs->trans('RefCustomer').': '.$this->ref_client;
|
||||||
|
|
||||||
|
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
|
|||||||
@ -303,7 +303,7 @@ if (! empty($conf->commande->enabled))
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("OrdersToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1">('.$num.')</a></td></tr>';
|
print '<td colspan="3">'.$langs->trans("OrdersToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></td></tr>';
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
@ -374,7 +374,7 @@ if (! empty($conf->commande->enabled))
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=2">('.$num.')</a></td></tr>';
|
print '<td colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=2"><span class="badge">'.$num.'</span></a></td></tr>';
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||||
|
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
@ -48,6 +49,10 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid';
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid);
|
$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid);
|
||||||
|
|
||||||
|
$account = new Account($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label($account->table_element);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -100,6 +105,9 @@ if ($_POST["action"] == 'add')
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fill array 'array_options' with data from add form
|
||||||
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$account);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$id = $account->create($user);
|
$id = $account->create($user);
|
||||||
@ -172,6 +180,9 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fill array 'array_options' with data from add form
|
||||||
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$account);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result = $account->update($user);
|
$result = $account->update($user);
|
||||||
@ -307,6 +318,15 @@ if ($action == 'create')
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$parameters=array('colspan' => 3);
|
||||||
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
print $account->showOptionals($extrafields,'edit',$parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -464,6 +484,14 @@ else
|
|||||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||||
print '<td colspan="3">'.$account->comment.'</td></tr>';
|
print '<td colspan="3">'.$account->comment.'</td></tr>';
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$parameters=array('colspan' => 3);
|
||||||
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
print $account->showOptionals($extrafields);
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -621,6 +649,15 @@ else
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$parameters=array('colspan' => 3);
|
||||||
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
print $account->showOptionals($extrafields,'edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -167,7 +167,7 @@ class Account extends CommonObject
|
|||||||
* @param int $fk_bank To search using bank transaction id
|
* @param int $fk_bank To search using bank transaction id
|
||||||
* @param int $url_id To search using link to
|
* @param int $url_id To search using link to
|
||||||
* @param string $type To search using type
|
* @param string $type To search using type
|
||||||
* @return array Array of links
|
* @return array|-1 Array of links or -1 on error
|
||||||
*/
|
*/
|
||||||
function get_url($fk_bank='', $url_id='', $type='')
|
function get_url($fk_bank='', $url_id='', $type='')
|
||||||
{
|
{
|
||||||
@ -343,7 +343,7 @@ class Account extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function create($user='')
|
function create($user='')
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf, $hookmanager;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! $this->min_allowed) $this->min_allowed=0;
|
if (! $this->min_allowed) $this->min_allowed=0;
|
||||||
@ -441,6 +441,23 @@ class Account extends CommonObject
|
|||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions on extra fields (by external module or standard code)
|
||||||
|
$hookmanager->initHooks(array('bankdao'));
|
||||||
|
$parameters=array('id'=>$this->id);
|
||||||
|
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
|
{
|
||||||
|
$result=$this->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($reshook < 0) return -5;
|
||||||
}
|
}
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
@ -466,7 +483,7 @@ class Account extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update($user='')
|
function update($user='')
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf, $hookmanager;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! $this->min_allowed) $this->min_allowed=0;
|
if (! $this->min_allowed) $this->min_allowed=0;
|
||||||
@ -517,6 +534,25 @@ class Account extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Actions on extra fields (by external module or standard code)
|
||||||
|
$hookmanager->initHooks(array('bankdao'));
|
||||||
|
$parameters=array('id'=>$this->id);
|
||||||
|
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
|
{
|
||||||
|
$result=$this->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($reshook < 0) return -1;
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -662,6 +698,15 @@ class Account extends CommonObject
|
|||||||
$this->min_allowed = $obj->min_allowed;
|
$this->min_allowed = $obj->min_allowed;
|
||||||
$this->min_desired = $obj->min_desired;
|
$this->min_desired = $obj->min_desired;
|
||||||
$this->comment = $obj->comment;
|
$this->comment = $obj->comment;
|
||||||
|
|
||||||
|
// Retreive all extrafield for thirdparty
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||||
|
$extrafields=new ExtraFields($this->db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||||
|
$this->fetch_optionals($this->id,$extralabels);
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -693,6 +738,18 @@ class Account extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
|
// Remove extrafields
|
||||||
|
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||||
|
{
|
||||||
|
$result=$this->deleteExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -878,15 +935,16 @@ class Account extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$linkclose = '" title="'.dol_escape_htmltag($this->label, 1).'" class="classfortooltip">';
|
||||||
|
|
||||||
if (empty($mode))
|
if (empty($mode))
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
}
|
}
|
||||||
else if ($mode == 'transactions')
|
else if ($mode == 'transactions')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,11 +1484,11 @@ class AccountLine extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowTransaction").': '.$this->rowid;
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowTransaction"), 'account', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' ');
|
||||||
$result.=$lien.$this->rowid.$lienfin;
|
$result.=$lien.$this->rowid.$lienfin;
|
||||||
|
|
||||||
if ($option == 'showall' || $option == 'showconciliated') $result.=' (';
|
if ($option == 'showall' || $option == 'showconciliated') $result.=' (';
|
||||||
|
|||||||
@ -358,7 +358,7 @@ if ($result)
|
|||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
else if ($links[$key]['type']=='user') {
|
else if ($links[$key]['type']=='user') {
|
||||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche?id='.$links[$key]['url_id'].'">';
|
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">';
|
||||||
print img_object($langs->trans('ShowUser'),'user').' ';
|
print img_object($langs->trans('ShowUser'),'user').' ';
|
||||||
print $langs->trans("User");
|
print $langs->trans("User");
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|||||||
@ -357,13 +357,13 @@ class Deplacement extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("Show").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='trip';
|
$picto='trip';
|
||||||
|
|
||||||
$label=$langs->trans("Show").': '.$this->ref;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
|
|||||||
@ -711,13 +711,13 @@ class Don extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowDonation").': '.$this->id;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/dons/card.php?rowid='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/dons/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='generic';
|
$picto='generic';
|
||||||
|
|
||||||
$label=$langs->trans("ShowDonation").': '.$this->id;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
|
|||||||
@ -7,9 +7,10 @@
|
|||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
|
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
|
||||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -105,6 +106,7 @@ $hookmanager->initHooks(array('invoicecard','globalcard'));
|
|||||||
|
|
||||||
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -113,6 +115,8 @@ $parameters = array('socid' => $socid);
|
|||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
@ -802,7 +806,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Standard or deposit or proforma invoice
|
// Standard or deposit or proforma invoice
|
||||||
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT || $_POST['type'] == Facture::TYPE_PROFORMA) && $_POST['fac_rec'] <= 0)
|
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT || $_POST['type'] == Facture::TYPE_PROFORMA || ($_POST['type'] == Facture::TYPE_SITUATION && empty($_POST['situations']))) && $_POST['fac_rec'] <= 0)
|
||||||
{
|
{
|
||||||
if (GETPOST('socid', 'int') < 1)
|
if (GETPOST('socid', 'int') < 1)
|
||||||
{
|
{
|
||||||
@ -837,6 +841,13 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$object->remise_absolue = $_POST['remise_absolue'];
|
$object->remise_absolue = $_POST['remise_absolue'];
|
||||||
$object->remise_percent = $_POST['remise_percent'];
|
$object->remise_percent = $_POST['remise_percent'];
|
||||||
|
|
||||||
|
if (GETPOST('type') == Facture::TYPE_SITUATION)
|
||||||
|
{
|
||||||
|
$object->situation_counter = 1;
|
||||||
|
$object->situation_final = 0;
|
||||||
|
$object->situation_cycle_ref = $object->newCycle();
|
||||||
|
}
|
||||||
|
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
@ -987,6 +998,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
|
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
|
||||||
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
|
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
|
||||||
|
if ($object->situation_counter == 1) $lines[$i]->situation_percent = 0;
|
||||||
|
|
||||||
if ($lines[$i]->subprice < 0)
|
if ($lines[$i]->subprice < 0)
|
||||||
{
|
{
|
||||||
@ -1040,7 +1052,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$array_option = $lines[$i]->array_options;
|
$array_option = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option);
|
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$lineid = $result;
|
$lineid = $result;
|
||||||
@ -1089,6 +1101,45 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations'])))
|
||||||
|
{
|
||||||
|
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
|
if (empty($datefacture)) {
|
||||||
|
$error++;
|
||||||
|
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($_POST['situations'] > 0)) {
|
||||||
|
$error++;
|
||||||
|
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$result = $object->fetch($_POST['situations']);
|
||||||
|
$object->fk_facture_source = $_POST['situations'];
|
||||||
|
$object->type = Facture::TYPE_SITUATION;
|
||||||
|
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
$object->date = $datefacture;
|
||||||
|
$object->note_public = trim($_POST['note_public']);
|
||||||
|
$object->note = trim($_POST['note']);
|
||||||
|
$object->ref_client = $_POST['ref_client'];
|
||||||
|
$object->ref_int = $_POST['ref_int'];
|
||||||
|
$object->modelpdf = $_POST['model'];
|
||||||
|
$object->fk_project = $_POST['projectid'];
|
||||||
|
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||||
|
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||||
|
$object->remise_absolue = $_POST['remise_absolue'];
|
||||||
|
$object->remise_percent = $_POST['remise_percent'];
|
||||||
|
|
||||||
|
// Proprietes particulieres a facture de remplacement
|
||||||
|
|
||||||
|
$object->situation_counter = $object->situation_counter + 1;
|
||||||
|
$id = $object->createFromCurrent($user);
|
||||||
|
if ($id <= 0) $mesg = $object->error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// End of object creation, we show it
|
// End of object creation, we show it
|
||||||
if ($id > 0 && ! $error)
|
if ($id > 0 && ! $error)
|
||||||
{
|
{
|
||||||
@ -1311,7 +1362,7 @@ else if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
setEventMessage($mesg, 'errors');
|
setEventMessage($mesg, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_option);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_option, $_POST['progress']);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -1362,6 +1413,9 @@ else if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
unset($_POST['date_endday']);
|
unset($_POST['date_endday']);
|
||||||
unset($_POST['date_endmonth']);
|
unset($_POST['date_endmonth']);
|
||||||
unset($_POST['date_endyear']);
|
unset($_POST['date_endyear']);
|
||||||
|
|
||||||
|
unset($_POST['situations']);
|
||||||
|
unset($_POST['progress']);
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
@ -1412,9 +1466,22 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$line = new FactureLigne($db);
|
||||||
|
$line->fetch(GETPOST('lineid'));
|
||||||
|
$percent = $line->get_prev_progress();
|
||||||
|
|
||||||
|
if (GETPOST('progress') < $percent)
|
||||||
|
{
|
||||||
|
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
||||||
|
setEventMessages($mesg, null, 'warnings');
|
||||||
|
$error++;
|
||||||
|
$result = -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Check minimum price
|
// Check minimum price
|
||||||
$productid = GETPOST('productid', 'int');
|
$productid = GETPOST('productid', 'int');
|
||||||
if (! empty($productid)) {
|
if (! empty($productid))
|
||||||
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$product->fetch($productid);
|
$product->fetch($productid);
|
||||||
|
|
||||||
@ -1449,7 +1516,7 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
|
|
||||||
// Update line
|
// Update line
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_option);
|
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_option, GETPOST('progress'));
|
||||||
|
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
@ -1483,12 +1550,48 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
unset($_POST['buying_price']);
|
unset($_POST['buying_price']);
|
||||||
unset($_POST['np_marginRate']);
|
unset($_POST['np_marginRate']);
|
||||||
unset($_POST['np_markRate']);
|
unset($_POST['np_markRate']);
|
||||||
|
|
||||||
|
unset($_POST['dp_desc']);
|
||||||
|
unset($_POST['idprod']);
|
||||||
|
|
||||||
|
unset($_POST['date_starthour']);
|
||||||
|
unset($_POST['date_startmin']);
|
||||||
|
unset($_POST['date_startsec']);
|
||||||
|
unset($_POST['date_startday']);
|
||||||
|
unset($_POST['date_startmonth']);
|
||||||
|
unset($_POST['date_startyear']);
|
||||||
|
unset($_POST['date_endhour']);
|
||||||
|
unset($_POST['date_endmin']);
|
||||||
|
unset($_POST['date_endsec']);
|
||||||
|
unset($_POST['date_endday']);
|
||||||
|
unset($_POST['date_endmonth']);
|
||||||
|
unset($_POST['date_endyear']);
|
||||||
|
|
||||||
|
unset($_POST['situations']);
|
||||||
|
unset($_POST['progress']);
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if ($action == 'updatealllines' && $user->rights->facture->creer && $_POST['all_percent'] == $langs->trans('Modifier'))
|
||||||
|
{
|
||||||
|
if (!$object->fetch($id) > 0) dol_print_error($db);
|
||||||
|
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
|
||||||
|
{
|
||||||
|
foreach ($object->lines as $line)
|
||||||
|
{
|
||||||
|
$percent = $line->get_prev_progress();
|
||||||
|
if (GETPOST('all_progress') < $percent) {
|
||||||
|
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
||||||
|
$result = -1;
|
||||||
|
} else
|
||||||
|
$object->update_percent($line, $_POST['all_progress']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) {
|
else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) {
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition
|
||||||
exit();
|
exit();
|
||||||
@ -1574,8 +1677,11 @@ if ($action == 'builddoc') // En get ou en post
|
|||||||
// Save last template used to generate document
|
// Save last template used to generate document
|
||||||
if (GETPOST('model'))
|
if (GETPOST('model'))
|
||||||
$object->setDocModel($user, GETPOST('model', 'alpha'));
|
$object->setDocModel($user, GETPOST('model', 'alpha'));
|
||||||
if (GETPOST('fk_bank')) // this field may come from an external module
|
if (GETPOST('fk_bank')) { // this field may come from an external module
|
||||||
$object->fk_bank = GETPOST('fk_bank');
|
$object->fk_bank = GETPOST('fk_bank');
|
||||||
|
} else {
|
||||||
|
$object->fk_bank = $object->fk_account;
|
||||||
|
}
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
@ -1614,7 +1720,7 @@ else if ($action == 'remove_file') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer)
|
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
@ -1641,7 +1747,8 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bascule du statut d'un contact
|
// bascule du statut d'un contact
|
||||||
else if ($action == 'swapstatut') {
|
else if ($action == 'swapstatut')
|
||||||
|
{
|
||||||
if ($object->fetch($id)) {
|
if ($object->fetch($id)) {
|
||||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||||
} else {
|
} else {
|
||||||
@ -1650,7 +1757,8 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// Efface un contact
|
||||||
else if ($action == 'deletecontact') {
|
else if ($action == 'deletecontact')
|
||||||
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->delete_contact($lineid);
|
$result = $object->delete_contact($lineid);
|
||||||
|
|
||||||
@ -1661,9 +1769,10 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'update_extras') {
|
|
||||||
|
if ($action == 'update_extras')
|
||||||
|
{
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
@ -1689,7 +1798,8 @@ if ($action == 'update_extras') {
|
|||||||
if ($error)
|
if ($error)
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1799,6 +1909,8 @@ if ($action == 'create')
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
print ajax_combobox('fac_replacement');
|
print ajax_combobox('fac_replacement');
|
||||||
print ajax_combobox('fac_avoir');
|
print ajax_combobox('fac_avoir');
|
||||||
|
print ajax_combobox('situations');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||||
@ -1960,6 +2072,32 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
|
if (! empty($conf->global->INVOICE_USE_SITUATION))
|
||||||
|
{
|
||||||
|
// First situation invoice
|
||||||
|
print '<tr height="18"><td width="16px" valign="middle">';
|
||||||
|
print '<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked="checked"' : '') . '>';
|
||||||
|
print '</td><td valign="middle">';
|
||||||
|
$desc = $form->textwithpicto($langs->trans("InvoiceFirstSituationAsk"), $langs->transnoentities("InvoiceFirstSituationDesc"), 1);
|
||||||
|
print $desc;
|
||||||
|
print '</td></tr>' . "\n";
|
||||||
|
|
||||||
|
// Next situation invoice
|
||||||
|
$opt = $form->load_situation_invoices(GETPOST('originid'), $socid);
|
||||||
|
print '<tr height="18"><td valign="middle">';
|
||||||
|
print '<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 && GETPOST('originid') ? ' checked="checked"' : '') . ' ';
|
||||||
|
if ($opt == '<option value ="0" selected="selected">' . $langs->trans('NoSituations') . '</option>' || (GETPOST('origin') && GETPOST('origin') != 'facture')) print 'disabled="disabled"';
|
||||||
|
print '>';
|
||||||
|
print '</td><td valign="middle">';
|
||||||
|
$text = $langs->trans("InvoiceSituationAsk") . ' ';
|
||||||
|
$text .= '<select class="flat" id="situations" name="situations">';
|
||||||
|
$text .= $opt;
|
||||||
|
$text .= '</select>';
|
||||||
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1);
|
||||||
|
print $desc;
|
||||||
|
print '</td></tr>' . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Replacement
|
// Replacement
|
||||||
print '<tr height="18"><td valign="middle">';
|
print '<tr height="18"><td valign="middle">';
|
||||||
print '<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked="checked"' : '');
|
print '<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked="checked"' : '');
|
||||||
@ -2271,7 +2409,7 @@ if ($action == 'create')
|
|||||||
// Button "Create Draft"
|
// Button "Create Draft"
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -3092,6 +3230,54 @@ if ($action == 'create')
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Situations
|
||||||
|
if (! empty($conf->global->INVOICE_US_SITUATION))
|
||||||
|
{
|
||||||
|
if ($object->type == 5 && ($object->situation_counter > 1))
|
||||||
|
{
|
||||||
|
$prevsits = $object->get_prev_sits();
|
||||||
|
print '<tr><td>';
|
||||||
|
print $langs->trans('SituationAmount');
|
||||||
|
print ' ';
|
||||||
|
|
||||||
|
print $prevsits[0]->situation_counter;
|
||||||
|
for ($i = 1; $i < count($prevsits); $i++) {
|
||||||
|
print ' + ';
|
||||||
|
print $prevsits[$i]->situation_counter;
|
||||||
|
}
|
||||||
|
print ' + ';
|
||||||
|
print $object->situation_counter;
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right" colspan="2" nowrap>';
|
||||||
|
|
||||||
|
$prevsits_total_amount = 0;
|
||||||
|
foreach ($prevsits as $situation) {
|
||||||
|
$prevsits_total_amount += $situation->total_ht;
|
||||||
|
}
|
||||||
|
$prevsits_total_amount += $object->total_ht;
|
||||||
|
|
||||||
|
print price($prevsits_total_amount);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
||||||
|
|
||||||
|
// Previous situation(s) deduction(s)
|
||||||
|
for ($i = 0; $i < count($prevsits); $i++) {
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?facid=' . $prevsits[$i]->id . '">';
|
||||||
|
print $langs->trans('SituationDeduction');
|
||||||
|
print ' ';
|
||||||
|
print $prevsits[$i]->situation_counter;
|
||||||
|
print '</a></td>';
|
||||||
|
|
||||||
|
print '<td align="right" colspan="2" nowrap>';
|
||||||
|
print '- ' . price($prevsits[$i]->total_ht);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
|
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
|
||||||
print '<td align="right" colspan="3" nowrap>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
print '<td align="right" colspan="3" nowrap>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||||
@ -3202,12 +3388,61 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||||
|
|
||||||
|
// Show global modifiers
|
||||||
|
if (! empty($conf->global->INVOICE_US_SITUATION))
|
||||||
|
{
|
||||||
|
if ($object->situation_cycle_ref && $object->statut == 0) {
|
||||||
|
print '<tr class="liste_titre nodrag nodrop">';
|
||||||
|
print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '"#updatealllines" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />';
|
||||||
|
print '<input type="hidden" name="action" value="updatealllines" />';
|
||||||
|
print '<input type="hidden" name="id" value="' . $object->id . '" />';
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||||
|
print '<td align="center" width="5"> </td>';
|
||||||
|
}
|
||||||
|
print '<td>' . $langs->trans('ModifyAllLines') . '</td>';
|
||||||
|
print '<td align="right" width="50"> </td>';
|
||||||
|
print '<td align="right" width="80"> </td>';
|
||||||
|
if ($inputalsopricewithtax) print '<td align="right" width="80"> </td>';
|
||||||
|
print '<td align="right" width="50"> </td>';
|
||||||
|
print '<td align="right" width="50"> </td>';
|
||||||
|
print '<td align="right" width="50">' . $langs->trans('Progress') . '</td>';
|
||||||
|
if (! empty($conf->margin->enabled) && empty($user->societe_id))
|
||||||
|
{
|
||||||
|
print '<td align="right" class="margininfos" width="80"> </td>';
|
||||||
|
if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) {
|
||||||
|
print '<td align="right" class="margininfos" width="50"> </td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '<td align="right" width="50"> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td width="10"> </td>';
|
||||||
|
print '<td width="10"> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||||
|
print '<td align="center" width="5"> </td>';
|
||||||
|
}
|
||||||
|
print '<tr width="100%" height="18" class="nodrag nodrop">';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td width="50"> </td>';
|
||||||
|
print '<td width="80"> </td>';
|
||||||
|
print '<td width="50"> </td>';
|
||||||
|
print '<td width="50"> </td>';
|
||||||
|
print '<td align="right" class="nowrap"><input type="text" size="1" value="" name="all_progress">%</td>';
|
||||||
|
print '<td colspan="4" align="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Show object lines
|
// Show object lines
|
||||||
if (! empty($object->lines))
|
if (! empty($object->lines))
|
||||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
|
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
|
||||||
|
|
||||||
// Form to add new line
|
// Form to add new line
|
||||||
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline')
|
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref))
|
||||||
{
|
{
|
||||||
if ($action != 'editline')
|
if ($action != 'editline')
|
||||||
{
|
{
|
||||||
@ -3244,12 +3479,14 @@ if ($action == 'create')
|
|||||||
$ventilExportCompta = $object->getVentilExportCompta();
|
$ventilExportCompta = $object->getVentilExportCompta();
|
||||||
|
|
||||||
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) {
|
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) {
|
||||||
if (! $objectidnext) {
|
if (! $objectidnext && $object->is_last_in_cycle()) {
|
||||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate) {
|
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||||
} else {
|
} else {
|
||||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans('Modify') . '</span></div>';
|
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||||
}
|
}
|
||||||
|
} else if (!$object->is_last_in_cycle()) {
|
||||||
|
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotLastInCycle") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||||
} else {
|
} else {
|
||||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('Modify') . '</span></div>';
|
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||||
}
|
}
|
||||||
@ -3272,7 +3509,7 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == 0 && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
if ($object->statut == 0 && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
||||||
if ($user->rights->facture->valider) {
|
if ($user->rights->facture->valider) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=valid">' . $langs->trans('Validate') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=valid">' . $langs->trans('Validate') . '</a></div>';
|
||||||
}
|
}
|
||||||
@ -3384,6 +3621,17 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Create next situation invoice
|
||||||
|
if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
|
||||||
|
if ($object->is_last_in_cycle() && $object->situation_final != 1) {
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=create&type=5&origin=facture&originid=' . $object->id . '&socid=' . $object->socid . '" >' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||||
|
} else if (!$object->is_last_in_cycle()) {
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotLastInCycle") . '">' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||||
|
} else {
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseFinal") . '">' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($user->rights->facture->supprimer)
|
if ($user->rights->facture->supprimer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -558,13 +558,13 @@ class FactureRec extends Facture
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowInvoice").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='bill';
|
$picto='bill';
|
||||||
|
|
||||||
$label=$langs->trans("ShowInvoice").': '.$this->ref;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
|
|||||||
@ -10,6 +10,8 @@
|
|||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
||||||
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
@ -122,6 +124,21 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
var $fac_rec;
|
var $fac_rec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Situation cycle reference number
|
||||||
|
*/
|
||||||
|
public $situation_cycle_ref;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Situation counter inside the cycle
|
||||||
|
*/
|
||||||
|
public $situation_counter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool Final situation flag
|
||||||
|
*/
|
||||||
|
public $situation_final;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard invoice
|
* Standard invoice
|
||||||
*/
|
*/
|
||||||
@ -147,6 +164,11 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
const TYPE_PROFORMA = 4;
|
const TYPE_PROFORMA = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Situation invoice
|
||||||
|
*/
|
||||||
|
const TYPE_SITUATION = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -248,6 +270,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ", fk_account";
|
$sql.= ", fk_account";
|
||||||
$sql.= ", fk_facture_source, fk_user_author, fk_projet";
|
$sql.= ", fk_facture_source, fk_user_author, fk_projet";
|
||||||
$sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf";
|
$sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf";
|
||||||
|
$sql.= ", situation_cycle_ref, situation_counter, situation_final";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
$sql.= " VALUES (";
|
$sql.= " VALUES (";
|
||||||
$sql.= "'(PROV)'";
|
$sql.= "'(PROV)'";
|
||||||
@ -267,9 +290,13 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ", ".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null");
|
$sql.= ", ".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null");
|
||||||
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
|
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
|
||||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||||
$sql.= ','.$this->cond_reglement_id;
|
$sql.= ", ".$this->cond_reglement_id;
|
||||||
$sql.= ", ".$this->mode_reglement_id;
|
$sql.= ", ".$this->mode_reglement_id;
|
||||||
$sql.= ", '".$this->db->idate($datelim)."', '".$this->modelpdf."')";
|
$sql.= ", '".$this->db->idate($datelim)."', '".$this->modelpdf."'";
|
||||||
|
$sql.= ", ".($this->situation_cycle_ref?"'".$this->db->escape($this->situation_cycle_ref)."'":"null");
|
||||||
|
$sql.= ", ".($this->situation_counter?"'".$this->db->escape($this->situation_counter)."'":"null");
|
||||||
|
$sql.= ", ".($this->situation_final?$this->situation_final:0);
|
||||||
|
$sql.=")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -399,7 +426,9 @@ class Facture extends CommonInvoice
|
|||||||
$this->lines[$i]->fk_fournprice,
|
$this->lines[$i]->fk_fournprice,
|
||||||
$this->lines[$i]->pa_ht,
|
$this->lines[$i]->pa_ht,
|
||||||
$this->lines[$i]->label,
|
$this->lines[$i]->label,
|
||||||
$this->lines[$i]->array_options
|
$this->lines[$i]->array_options,
|
||||||
|
$this->lines[$i]->situation_percent,
|
||||||
|
$this->lines[$i]->fk_prev_id
|
||||||
);
|
);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -451,7 +480,9 @@ class Facture extends CommonInvoice
|
|||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
$_facrec->lines[$i]->label
|
$_facrec->lines[$i]->label,
|
||||||
|
null,
|
||||||
|
$_facrec->lines[$i]->situation_percent
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $result_insert < 0)
|
if ( $result_insert < 0)
|
||||||
@ -556,10 +587,14 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$facture->lines = $this->lines; // Tableau des lignes de factures
|
$facture->lines = $this->lines; // Tableau des lignes de factures
|
||||||
$facture->products = $this->lines; // Tant que products encore utilise
|
$facture->products = $this->lines; // Tant que products encore utilise
|
||||||
|
$facture->situation_counter = $this->situation_counter;
|
||||||
|
$facture->situation_cycle_ref=$this->situation_cycle_ref;
|
||||||
|
$facture->situation_final = $this->situation_final;
|
||||||
|
|
||||||
// Loop on each line of new invoice
|
// Loop on each line of new invoice
|
||||||
foreach($facture->lines as $i => $line)
|
foreach($facture->lines as $i => $line)
|
||||||
{
|
{
|
||||||
|
$facture->lines[$i]->fk_prev_id = $this->lines[$i]->rowid;
|
||||||
if ($invertdetail)
|
if ($invertdetail)
|
||||||
{
|
{
|
||||||
$facture->lines[$i]->subprice = -$facture->lines[$i]->subprice;
|
$facture->lines[$i]->subprice = -$facture->lines[$i]->subprice;
|
||||||
@ -827,9 +862,10 @@ class Facture extends CommonInvoice
|
|||||||
if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
|
if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
|
||||||
if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
|
if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
|
||||||
if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
|
if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
|
||||||
|
if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref;
|
||||||
if ($moretitle) $label.=' - '.$moretitle;
|
if ($moretitle) $label.=' - '.$moretitle;
|
||||||
|
|
||||||
$linkstart='<a href="'.$url.'">';
|
$linkstart='<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($linkstart.img_object(($max?dol_trunc($label,$max):$label), $picto, 'class="classfortooltip"').$linkend);
|
if ($withpicto) $result.=($linkstart.img_object(($max?dol_trunc($label,$max):$label), $picto, 'class="classfortooltip"').$linkend);
|
||||||
@ -863,6 +899,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
|
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
|
||||||
$sql.= ', f.fk_facture_source';
|
$sql.= ', f.fk_facture_source';
|
||||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet, f.extraparams';
|
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet, f.extraparams';
|
||||||
|
$sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
|
||||||
$sql.= ', f.fk_account';
|
$sql.= ', f.fk_account';
|
||||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
||||||
@ -923,7 +960,9 @@ class Facture extends CommonInvoice
|
|||||||
$this->user_author = $obj->fk_user_author;
|
$this->user_author = $obj->fk_user_author;
|
||||||
$this->user_valid = $obj->fk_user_valid;
|
$this->user_valid = $obj->fk_user_valid;
|
||||||
$this->modelpdf = $obj->model_pdf;
|
$this->modelpdf = $obj->model_pdf;
|
||||||
|
$this->situation_cycle_ref = $obj->situation_cycle_ref;
|
||||||
|
$this->situation_counter = $obj->situation_counter;
|
||||||
|
$this->situation_final = $obj->situation_final;
|
||||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||||
|
|
||||||
if ($this->statut == 0) $this->brouillon = 1;
|
if ($this->statut == 0) $this->brouillon = 1;
|
||||||
@ -974,6 +1013,7 @@ class Facture extends CommonInvoice
|
|||||||
$this->lines=array();
|
$this->lines=array();
|
||||||
|
|
||||||
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
|
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
|
||||||
|
$sql .= ' l.situation_percent, l.fk_prev_id,';
|
||||||
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
|
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
|
||||||
$sql.= ' l.rang, l.special_code,';
|
$sql.= ' l.rang, l.special_code,';
|
||||||
$sql.= ' l.date_start as date_start, l.date_end as date_end,';
|
$sql.= ' l.date_start as date_start, l.date_end as date_end,';
|
||||||
@ -1033,6 +1073,8 @@ class Facture extends CommonInvoice
|
|||||||
$line->rang = $objp->rang;
|
$line->rang = $objp->rang;
|
||||||
$line->special_code = $objp->special_code;
|
$line->special_code = $objp->special_code;
|
||||||
$line->fk_parent_line = $objp->fk_parent_line;
|
$line->fk_parent_line = $objp->fk_parent_line;
|
||||||
|
$line->situation_percent= $objp->situation_percent;
|
||||||
|
$line->fk_prev_id = $objp->fk_prev_id;
|
||||||
|
|
||||||
$this->lines[$i] = $line;
|
$this->lines[$i] = $line;
|
||||||
|
|
||||||
@ -1073,6 +1115,17 @@ class Facture extends CommonInvoice
|
|||||||
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
|
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
|
||||||
if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf);
|
if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf);
|
||||||
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
|
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
|
||||||
|
if (empty($this->situation_cycle_ref)) {
|
||||||
|
$this->situation_cycle_ref = 'null';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->situation_counter)) {
|
||||||
|
$this->situation_counter = 'null';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->situation_final)) {
|
||||||
|
$this->situation_final = '0';
|
||||||
|
}
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -1110,7 +1163,10 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
||||||
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
|
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
|
||||||
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";
|
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";
|
||||||
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null")."";
|
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
|
||||||
|
$sql.= ", situation_cycle_ref=".$this->situation_cycle_ref;
|
||||||
|
$sql.= ", situation_counter=".$this->situation_counter;
|
||||||
|
$sql.= ", situation_final=".$this->situation_final;
|
||||||
|
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
@ -1808,6 +1864,15 @@ class Facture extends CommonInvoice
|
|||||||
$this->statut=1;
|
$this->statut=1;
|
||||||
$this->brouillon=0;
|
$this->brouillon=0;
|
||||||
$this->date_validation=$now;
|
$this->date_validation=$now;
|
||||||
|
$i = 0;
|
||||||
|
$final = True;
|
||||||
|
while ($i < count($this->lines) && $final == True) {
|
||||||
|
$final = ($this->lines[$i]->situation_percent == 100);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if ($final) {
|
||||||
|
$this->setFinal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1947,9 +2012,11 @@ class Facture extends CommonInvoice
|
|||||||
* @param int $pa_ht Buying price of line (to calculate margin) or ''
|
* @param int $pa_ht Buying price of line (to calculate margin) or ''
|
||||||
* @param string $label Label of the line (deprecated, do not use)
|
* @param string $label Label of the line (deprecated, do not use)
|
||||||
* @param array $array_option extrafields array
|
* @param array $array_option extrafields array
|
||||||
|
* @param int $situation_percent Situation advance percentage
|
||||||
|
* @param int $fk_prev_id Previous situation line id reference
|
||||||
* @return int <0 if KO, Id of line if OK
|
* @return int <0 if KO, Id of line if OK
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_option=0)
|
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_option=0, $situation_percent=100, $fk_prev_id='')
|
||||||
{
|
{
|
||||||
global $mysoc, $conf, $langs;
|
global $mysoc, $conf, $langs;
|
||||||
|
|
||||||
@ -1966,6 +2033,8 @@ class Facture extends CommonInvoice
|
|||||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||||
|
if (empty($fk_prev_id)) $fk_prev_id = 'null';
|
||||||
|
if (is_null($situation_percent) || $situation_percent > 100) $situation_percent = 100;
|
||||||
|
|
||||||
$remise_percent=price2num($remise_percent);
|
$remise_percent=price2num($remise_percent);
|
||||||
$qty=price2num($qty);
|
$qty=price2num($qty);
|
||||||
@ -1999,7 +2068,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $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);
|
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent);
|
||||||
|
|
||||||
$total_ht = $tabprice[0];
|
$total_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
@ -2060,6 +2129,8 @@ class Facture extends CommonInvoice
|
|||||||
$this->line->fk_parent_line=$fk_parent_line;
|
$this->line->fk_parent_line=$fk_parent_line;
|
||||||
$this->line->origin=$origin;
|
$this->line->origin=$origin;
|
||||||
$this->line->origin_id=$origin_id;
|
$this->line->origin_id=$origin_id;
|
||||||
|
$this->line->situation_percent = $situation_percent;
|
||||||
|
$this->line->fk_prev_id = $fk_prev_id;
|
||||||
|
|
||||||
// infos marge
|
// infos marge
|
||||||
$this->line->fk_fournprice = $fk_fournprice;
|
$this->line->fk_fournprice = $fk_fournprice;
|
||||||
@ -2121,9 +2192,10 @@ class Facture extends CommonInvoice
|
|||||||
* @param string $label Label of the line (deprecated, do not use)
|
* @param string $label Label of the line (deprecated, do not use)
|
||||||
* @param int $special_code Special code (also used by externals modules!)
|
* @param int $special_code Special code (also used by externals modules!)
|
||||||
* @param array $array_option extrafields array
|
* @param array $array_option extrafields array
|
||||||
|
* @param int $situation_percent Situation advance percentage
|
||||||
* @return int < 0 if KO, > 0 if OK
|
* @return int < 0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0, $situation_percent=0)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
@ -2139,6 +2211,8 @@ class Facture extends CommonInvoice
|
|||||||
if (empty($qty)) $qty=0;
|
if (empty($qty)) $qty=0;
|
||||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||||
if (empty($special_code) || $special_code == 3) $special_code=0;
|
if (empty($special_code) || $special_code == 3) $special_code=0;
|
||||||
|
if ($situation_percent > 100 || is_null($situation_percent) || $situation_percent == "") $situation_percent = 100;
|
||||||
|
|
||||||
|
|
||||||
$remise_percent = price2num($remise_percent);
|
$remise_percent = price2num($remise_percent);
|
||||||
$qty = price2num($qty);
|
$qty = price2num($qty);
|
||||||
@ -2157,7 +2231,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $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);
|
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'',$localtaxes_type, $situation_percent);
|
||||||
$total_ht = $tabprice[0];
|
$total_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
@ -2205,6 +2279,8 @@ class Facture extends CommonInvoice
|
|||||||
$this->line->product_type = $type;
|
$this->line->product_type = $type;
|
||||||
$this->line->fk_parent_line = $fk_parent_line;
|
$this->line->fk_parent_line = $fk_parent_line;
|
||||||
$this->line->skip_update_total = $skip_update_total;
|
$this->line->skip_update_total = $skip_update_total;
|
||||||
|
$this->line->situation_percent = $situation_percent;
|
||||||
|
|
||||||
|
|
||||||
// infos marge
|
// infos marge
|
||||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||||
@ -2247,6 +2323,31 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update invoice line with percentage
|
||||||
|
*
|
||||||
|
* @param FactureLigne $line Invoice line
|
||||||
|
* @param int $percent Percentage
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function update_percent($line, $percent)
|
||||||
|
{
|
||||||
|
include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php');
|
||||||
|
|
||||||
|
// Cap percentages to 100
|
||||||
|
if ($percent > 100) $percent = 100;
|
||||||
|
$line->situation_percent = $percent;
|
||||||
|
$tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->product_type, 'HT', 0, 0, '', '', $percent);
|
||||||
|
$line->total_ht = $tabprice[0];
|
||||||
|
$line->total_tva = $tabprice[1];
|
||||||
|
$line->total_ttc = $tabprice[2];
|
||||||
|
$line->total_localtax1 = $tabprice[9];
|
||||||
|
$line->total_localtax2 = $tabprice[10];
|
||||||
|
$line->update();
|
||||||
|
$this->update_price(1);
|
||||||
|
$this->db->commit();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete line in database
|
* Delete line in database
|
||||||
*
|
*
|
||||||
@ -2497,14 +2598,20 @@ class Facture extends CommonInvoice
|
|||||||
else if ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre';
|
else if ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre';
|
||||||
else if ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure';
|
else if ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure';
|
||||||
|
|
||||||
|
if (! empty($conf->global->FACTURE_ADDON))
|
||||||
|
{
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
|
|
||||||
$file = $conf->global->FACTURE_ADDON.".php";
|
$file = $conf->global->FACTURE_ADDON.".php";
|
||||||
$classname = $conf->global->FACTURE_ADDON;
|
$classname = $conf->global->FACTURE_ADDON;
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
{
|
|
||||||
$dir = $dirroot."/core/modules/facture/";
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/facture/");
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
@ -2523,7 +2630,6 @@ class Facture extends CommonInvoice
|
|||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//print "xx".$mybool.$dir.$file."-".$classname;
|
|
||||||
|
|
||||||
if (! $mybool)
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
@ -2533,7 +2639,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$obj = new $classname();
|
$obj = new $classname();
|
||||||
$numref = "";
|
$numref = "";
|
||||||
$numref = $obj->getNumRef($soc,$this,$mode);
|
$numref = $obj->getNextValue($soc,$this,$mode);
|
||||||
|
|
||||||
if ($numref != "")
|
if ($numref != "")
|
||||||
{
|
{
|
||||||
@ -2541,8 +2647,15 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
dol_print_error($db,"Facture::getNextNumRef ".$obj->error);
|
||||||
return false;
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2647,6 +2760,10 @@ class Facture extends CommonInvoice
|
|||||||
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
|
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
|
||||||
// If invoice to delete is last one and not already dispatched, we can delete
|
// If invoice to delete is last one and not already dispatched, we can delete
|
||||||
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1;
|
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1;
|
||||||
|
if ($this->situation_cycle_ref) {
|
||||||
|
$last = $this->is_last_in_cycle();
|
||||||
|
return $last;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($this->statut == 0 && $facref == 'PROV') // Si facture brouillon et provisoire
|
else if ($this->statut == 0 && $facref == 'PROV') // Si facture brouillon et provisoire
|
||||||
{
|
{
|
||||||
@ -3206,6 +3323,7 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT l.rowid, l.label as custom_label, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,';
|
$sql = 'SELECT l.rowid, l.label as custom_label, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,';
|
||||||
$sql.= ' l.fk_remise_except, l.localtax1_tx, l.localtax2_tx,';
|
$sql.= ' l.fk_remise_except, l.localtax1_tx, l.localtax2_tx,';
|
||||||
|
$sql .= ' l.situation_percent, l.fk_prev_id,';
|
||||||
$sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
|
$sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
|
||||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
|
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
|
||||||
$sql.= ' l.date_start, l.date_end,';
|
$sql.= ' l.date_start, l.date_end,';
|
||||||
@ -3247,6 +3365,8 @@ class Facture extends CommonInvoice
|
|||||||
$this->lines[$i]->total_tva = $obj->total_tva;
|
$this->lines[$i]->total_tva = $obj->total_tva;
|
||||||
$this->lines[$i]->total_ttc = $obj->total_ttc;
|
$this->lines[$i]->total_ttc = $obj->total_ttc;
|
||||||
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
|
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
|
||||||
|
$this->lines[$i]->situation_percent = $obj->situation_percent;
|
||||||
|
$this->lines[$i]->fk_prev_id = $obj->fk_prev_id;
|
||||||
$this->lines[$i]->special_code = $obj->special_code;
|
$this->lines[$i]->special_code = $obj->special_code;
|
||||||
$this->lines[$i]->rang = $obj->rang;
|
$this->lines[$i]->rang = $obj->rang;
|
||||||
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
|
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
|
||||||
@ -3304,11 +3424,119 @@ class Facture extends CommonInvoice
|
|||||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the smallest reference available for a new cycle
|
||||||
|
*
|
||||||
|
* @return int >= 1 if OK, -1 if error
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function newCycle()
|
||||||
|
{
|
||||||
|
$sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture';
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
if ($resql->num_rows > 0) {
|
||||||
|
$res = $this->db->fetch_array($resql);
|
||||||
|
$ref = $res['max(situation_cycle_ref)'];
|
||||||
|
$ref++;
|
||||||
|
} else {
|
||||||
|
$ref = 1;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return $ref;
|
||||||
|
} else {
|
||||||
|
$this->error = $this->db->error();
|
||||||
|
dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the invoice is the first of a cycle
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function is_first()
|
||||||
|
{
|
||||||
|
return ($this->situation_counter == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array containing the previous situations as Facture objects
|
||||||
|
*
|
||||||
|
* @return mixed -1 if error, array of previous situations
|
||||||
|
*/
|
||||||
|
function get_prev_sits()
|
||||||
|
{
|
||||||
|
|
||||||
|
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture';
|
||||||
|
$sql .= ' where situation_cycle_ref = ' . $this->situation_cycle_ref;
|
||||||
|
$sql .= ' and situation_counter < ' . $this->situation_counter;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
$res = array();
|
||||||
|
if ($resql && $resql->num_rows > 0) {
|
||||||
|
while ($row = $this->db->fetch_object($resql)) {
|
||||||
|
$id = $row->rowid;
|
||||||
|
$situation = new Facture($this->db);
|
||||||
|
$situation->fetch($id);
|
||||||
|
$res[] = $situation;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->error = $this->db->error();
|
||||||
|
dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the invoice as a final situation
|
||||||
|
*
|
||||||
|
* @return int 1 if ok, -1 if error
|
||||||
|
*/
|
||||||
|
function setFinal()
|
||||||
|
{
|
||||||
|
global $conf, $langs, $user;
|
||||||
|
$this->situation_final = 1;
|
||||||
|
$sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
// FIXME: call triggers?
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
$this->error = $this->db->error();
|
||||||
|
dol_syslog(get_class($this) . "::update Error setFinal " . $sql, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the invoice is the last in its cycle
|
||||||
|
*
|
||||||
|
* @return int 0 or 1 if OK, -1 if error
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function is_last_in_cycle()
|
||||||
|
{
|
||||||
|
$sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($resql && $resql->num_rows > 0) {
|
||||||
|
$res = $this->db->fetch_array($resql);
|
||||||
|
$last = $res['max(situation_counter)'];
|
||||||
|
return ($last == $this->situation_counter);
|
||||||
|
} else {
|
||||||
|
$this->error = $this->db->error();
|
||||||
|
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage invoice lines.
|
* Class to manage invoice lines.
|
||||||
@ -3391,6 +3619,16 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
|
|
||||||
var $skip_update_total; // Skip update price total for special lines
|
var $skip_update_total; // Skip update price total for special lines
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Situation advance percentage
|
||||||
|
*/
|
||||||
|
public $situation_percent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Previous situation line id reference
|
||||||
|
*/
|
||||||
|
public $fk_prev_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -3414,6 +3652,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
|
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
|
||||||
$sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
|
$sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
|
||||||
$sql.= ' fd.fk_code_ventilation,';
|
$sql.= ' fd.fk_code_ventilation,';
|
||||||
|
$sql.= ' fd.situation_percent, fd.fk_prev_id,';
|
||||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
|
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
||||||
@ -3461,6 +3700,9 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$this->product_label = $objp->product_libelle;
|
$this->product_label = $objp->product_libelle;
|
||||||
$this->product_desc = $objp->product_desc;
|
$this->product_desc = $objp->product_desc;
|
||||||
|
|
||||||
|
$this->situation_percent = $objp->situation_percent;
|
||||||
|
$this->fk_prev_id = $objp->fk_prev_id;
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3498,6 +3740,8 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
if (empty($this->subprice)) $this->subprice=0;
|
if (empty($this->subprice)) $this->subprice=0;
|
||||||
if (empty($this->special_code)) $this->special_code=0;
|
if (empty($this->special_code)) $this->special_code=0;
|
||||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||||
|
if (empty($this->fk_prev_id)) $this->fk_prev_id = 'null';
|
||||||
|
if (empty($this->situation_percent)) $this->situation_percent = 0;
|
||||||
|
|
||||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||||
|
|
||||||
@ -3541,7 +3785,8 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
|
$sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
|
||||||
$sql.= ' date_start, date_end, fk_code_ventilation, ';
|
$sql.= ' date_start, date_end, fk_code_ventilation, ';
|
||||||
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
|
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
|
||||||
$sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2)';
|
$sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2,';
|
||||||
|
$sql.= ' situation_percent, fk_prev_id)';
|
||||||
$sql.= " VALUES (".$this->fk_facture.",";
|
$sql.= " VALUES (".$this->fk_facture.",";
|
||||||
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
||||||
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||||
@ -3570,6 +3815,8 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$sql.= " ".price2num($this->total_ttc).",";
|
$sql.= " ".price2num($this->total_ttc).",";
|
||||||
$sql.= " ".price2num($this->total_localtax1).",";
|
$sql.= " ".price2num($this->total_localtax1).",";
|
||||||
$sql.= " ".price2num($this->total_localtax2);
|
$sql.= " ".price2num($this->total_localtax2);
|
||||||
|
$sql .= ", " . $this->situation_percent;
|
||||||
|
$sql .= ", " . $this->fk_prev_id;
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||||
@ -3687,6 +3934,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
if (empty($this->special_code)) $this->special_code=0;
|
if (empty($this->special_code)) $this->special_code=0;
|
||||||
if (empty($this->product_type)) $this->product_type=0;
|
if (empty($this->product_type)) $this->product_type=0;
|
||||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||||
|
if (is_null($this->situation_percent)) $this->situation_percent=100;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($this->product_type < 0) return -1;
|
if ($this->product_type < 0) return -1;
|
||||||
@ -3732,6 +3980,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$sql.= " , buy_price_ht='".price2num($this->pa_ht)."'";
|
$sql.= " , buy_price_ht='".price2num($this->pa_ht)."'";
|
||||||
$sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
|
$sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
|
||||||
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
|
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
|
||||||
|
$sql .= ", situation_percent=" . $this->situation_percent;
|
||||||
$sql.= " WHERE rowid = ".$this->rowid;
|
$sql.= " WHERE rowid = ".$this->rowid;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
@ -3846,5 +4095,28 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns situation_percent of the previous line
|
||||||
|
*
|
||||||
|
* @return int >= 0
|
||||||
|
*/
|
||||||
|
function get_prev_progress()
|
||||||
|
{
|
||||||
|
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
$sql = 'SELECT situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet WHERE rowid=' . $this->fk_prev_id;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql && $resql->num_rows > 0) {
|
||||||
|
$res = $this->db->fetch_array($resql);
|
||||||
|
return $res['situation_percent'];
|
||||||
|
} else {
|
||||||
|
$this->error = $this->db->error();
|
||||||
|
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -408,7 +410,7 @@ $sql.= ",".MAIN_DB_PREFIX."facture as f";
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
$sql.= " AND f.type IN (0,1,3) AND f.fk_statut = 1";
|
$sql.= " AND f.type IN (0,1,3,5) AND f.fk_statut = 1";
|
||||||
$sql.= " AND f.paye = 0";
|
$sql.= " AND f.paye = 0";
|
||||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
@ -551,7 +553,7 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (empty($mode))
|
if (empty($mode))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,9 @@
|
|||||||
* Copyright (C) 2011-2014 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) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||||
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -101,7 +103,7 @@ $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
|||||||
$idpays = $p[0];
|
$idpays = $p[0];
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||||
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2,";
|
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2, fd.rowid as id, fd.situation_percent,";
|
||||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
||||||
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
||||||
$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
|
$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
|
||||||
@ -112,8 +114,8 @@ $sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
$sql.= " AND f.fk_statut > 0";
|
$sql.= " AND f.fk_statut > 0";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
$sql.= " AND fd.product_type IN (0,1)";
|
$sql.= " AND fd.product_type IN (0,1)";
|
||||||
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " ORDER BY f.rowid";
|
$sql.= " ORDER BY f.rowid";
|
||||||
@ -157,6 +159,16 @@ if ($result)
|
|||||||
$account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $obj->thirdparty, $mysoc);
|
$account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $obj->thirdparty, $mysoc);
|
||||||
$compta_localtax2= (! empty($account_localtax2[3])?$account_localtax2[3]:$langs->trans("CodeNotDef"));
|
$compta_localtax2= (! empty($account_localtax2[3])?$account_localtax2[3]:$langs->trans("CodeNotDef"));
|
||||||
|
|
||||||
|
// Situation invoices handling
|
||||||
|
$line = new FactureLigne($db);
|
||||||
|
$line->fetch($obj->id);
|
||||||
|
$prev_progress = $line->get_prev_progress();
|
||||||
|
if ($obj->situation_percent == 0) { // Avoid divide by 0
|
||||||
|
$situation_ratio = 0;
|
||||||
|
} else {
|
||||||
|
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||||
|
}
|
||||||
|
|
||||||
//la ligne facture
|
//la ligne facture
|
||||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||||
@ -166,9 +178,9 @@ if ($result)
|
|||||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0;
|
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0;
|
||||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1]=0;
|
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1]=0;
|
||||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2]=0;
|
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2]=0;
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||||
if($obj->recuperableonly != 1) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
if($obj->recuperableonly != 1) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||||
$tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client);
|
$tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client);
|
||||||
|
|||||||
@ -585,12 +585,12 @@ class Localtax extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$picto='payment';
|
||||||
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -69,15 +71,17 @@ if ($facid > 0)
|
|||||||
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('paiementcard','globalcard'));
|
$hookmanager->initHooks(array('paiementcard','globalcard'));
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$parameters=array('socid'=>$socid);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -249,6 +253,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -469,7 +474,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
||||||
if ($facture->type != 2)
|
if ($facture->type != 2)
|
||||||
{
|
{
|
||||||
$sql .= ' AND type IN (0,1,3)'; // Standard invoice, replacement, deposit
|
$sql .= ' AND type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -769,11 +769,12 @@ class RemiseCheque extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label = $langs->trans("ShowCheckReceipt").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCheckReceipt"), 'payment', 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -212,13 +214,14 @@ class Paiement extends CommonObject
|
|||||||
|
|
||||||
//Invoice types that are eligible for changing status to paid
|
//Invoice types that are eligible for changing status to paid
|
||||||
$affected_types = array(
|
$affected_types = array(
|
||||||
0,
|
Facture::TYPE_STANDARD,
|
||||||
1,
|
Facture::TYPE_REPLACEMENT,
|
||||||
2,
|
Facture::TYPE_CREDIT_NOTE,
|
||||||
3
|
Facture::TYPE_DEPOSIT,
|
||||||
|
Facture::TYPE_SITUATION
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice. We do nothing more.");
|
if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice, nor situation invoice. We do nothing more.");
|
||||||
else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
|
else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
|
||||||
else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
|
else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
|
||||||
else
|
else
|
||||||
@ -745,8 +748,9 @@ class Paiement extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label = $langs->trans("ShowPayment").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$lienfin);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
@ -737,7 +737,7 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Create banque=$banque agence=$agence");
|
dol_syslog(__METHOD__."::Bank=".$banque." Office=".$agence, LOG_DEBUG);
|
||||||
|
|
||||||
require_once (DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
require_once (DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||||
require_once (DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
require_once (DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||||
@ -781,7 +781,8 @@ class BonPrelevement extends CommonObject
|
|||||||
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
|
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
|
||||||
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
|
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
dol_syslog(__METHOD__."::Read invoices, sql=".$sql, LOG_DEBUG);
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -795,13 +796,12 @@ class BonPrelevement extends CommonObject
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
dol_syslog($i." invoices to withdraw");
|
dol_syslog(__METHOD__."::Read invoices, ".$i." invoices to withdraw", LOG_DEBUG);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error = 1;
|
$error++;
|
||||||
dol_syslog("Erreur -1");
|
dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR);
|
||||||
dol_syslog($this->db->error());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -812,7 +812,7 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
// Check RIB
|
// Check RIB
|
||||||
$i = 0;
|
$i = 0;
|
||||||
dol_syslog("Start RIB check");
|
dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG);
|
||||||
|
|
||||||
if (count($factures) > 0)
|
if (count($factures) > 0)
|
||||||
{
|
{
|
||||||
@ -836,24 +836,24 @@ class BonPrelevement extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
|
dol_syslog(__METHOD__."::Check RIB Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
|
||||||
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->name;
|
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Failed to read company", LOG_ERR);
|
dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Failed to read invoice", LOG_ERR);
|
dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("No invoice to process");
|
dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,27 +893,21 @@ class BonPrelevement extends CommonObject
|
|||||||
*/
|
*/
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$ref = "T".substr($year,-2).$month;
|
$ref = substr($year,-2).$month;
|
||||||
|
|
||||||
$sql = "SELECT count(*)";
|
$sql = "SELECT substring(ref from char_length(ref) - 1)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
|
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
|
||||||
$sql.= " WHERE ref LIKE '".$ref."%'";
|
$sql.= " WHERE ref LIKE '%".$ref."%'";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
$sql.= " ORDER BY ref DESC LIMIT 1";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$row = $this->db->fetch_row($resql);
|
$row = $this->db->fetch_row($resql);
|
||||||
}
|
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1),2,"0",STR_PAD_LEFT);
|
||||||
else
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
dol_syslog("Erreur recherche reference");
|
|
||||||
}
|
|
||||||
|
|
||||||
$ref = $ref . substr("00".($row[0]+1), -2);
|
|
||||||
|
|
||||||
$filebonprev = $ref;
|
$filebonprev = $ref;
|
||||||
|
|
||||||
@ -926,9 +920,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql.= ", '".$this->db->idate($now)."'";
|
$sql.= ", '".$this->db->idate($now)."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
||||||
@ -943,7 +935,13 @@ class BonPrelevement extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
dol_syslog("Erreur creation du bon de prelevement");
|
dol_syslog(__METHOD__."::Create withdraw receipt ".$this->db->error(), LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
dol_syslog(__METHOD__."::Get last withdraw receipt ".$this->db->error(), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,13 +985,12 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql.= ", fk_prelevement_bons = ".$prev_id;
|
$sql.= ", fk_prelevement_bons = ".$prev_id;
|
||||||
$sql.= " WHERE rowid = ".$fac[1];
|
$sql.= " WHERE rowid = ".$fac[1];
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
dol_syslog("Erreur mise a jour des demandes");
|
dol_syslog(__METHOD__."::Update Orders::Error=".$this->db->error(), LOG_ERR);
|
||||||
dol_syslog($this->db->error());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1008,7 +1005,7 @@ class BonPrelevement extends CommonObject
|
|||||||
* Withdraw receipt
|
* Withdraw receipt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dol_syslog("Debut prelevement - Nombre de factures ".count($factures_prev));
|
dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG);
|
||||||
|
|
||||||
if (count($factures_prev) > 0)
|
if (count($factures_prev) > 0)
|
||||||
{
|
{
|
||||||
@ -1031,8 +1028,7 @@ class BonPrelevement extends CommonObject
|
|||||||
//Build file
|
//Build file
|
||||||
$bonprev->generate();
|
$bonprev->generate();
|
||||||
}
|
}
|
||||||
dol_syslog($filebonprev);
|
dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG);
|
||||||
dol_syslog("Fin prelevement");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1044,12 +1040,11 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql.= " WHERE rowid = ".$prev_id;
|
$sql.= " WHERE rowid = ".$prev_id;
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
dol_syslog("Erreur mise a jour du total - $sql");
|
dol_syslog(__METHOD__."::Error update total: ".$this->db->error(), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1062,7 +1057,6 @@ class BonPrelevement extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
dol_syslog("Error",LOG_ERR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return count($factures_prev);
|
return count($factures_prev);
|
||||||
@ -1124,17 +1118,18 @@ class BonPrelevement extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label = $langs->trans("ShowWithdraw").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
if ($option == 'xxx')
|
if ($option == 'xxx')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowWithdraw"), 'payment', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin.' ');
|
||||||
$result.=$lien.$this->ref.$lienfin;
|
$result.=$lien.$this->ref.$lienfin;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2012-2014 Raphaël Dourseanud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
@ -166,9 +168,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||||
$sql.= " AND f.fk_statut IN (1,2)";
|
$sql.= " AND f.fk_statut IN (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||||
$sql.= " AND f.type IN (0,1,2)";
|
$sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else
|
else
|
||||||
$sql.= " AND f.type IN (0,1,2,3)";
|
$sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
@ -693,9 +695,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||||
$sql.= " AND f.type IN (0,1,2)";
|
$sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else
|
else
|
||||||
$sql.= " AND f.type IN (0,1,2,3)";
|
$sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
|
|||||||
@ -103,8 +103,8 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||||
$sql.= " AND f.fk_statut IN (1,2)";
|
$sql.= " AND f.fk_statut IN (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -246,8 +246,8 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
|
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
|
|
||||||
|
|||||||
@ -486,12 +486,12 @@ class PaymentSalary extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowSalaryPayment").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$picto='payment';
|
||||||
$label=$langs->trans("ShowSalaryPayment").': '.$this->ref;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
|
|||||||
@ -420,11 +420,12 @@ class ChargeSociales extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
if (empty($this->ref)) $this->ref=$this->lib;
|
if (empty($this->ref)) $this->ref=$this->lib;
|
||||||
|
$label = $langs->trans("ShowSocialContribution").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowSocialContribution").': '.$this->lib, 'bill', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($lien.img_object($label, 'bill', 'class="classfortooltip"').$lienfin.' ');
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin;
|
if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin;
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -585,13 +585,14 @@ class PaymentSocialContribution extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
if (empty($this->ref)) $this->ref=$this->lib;
|
if (empty($this->ref)) $this->ref=$this->lib;
|
||||||
|
$label = $langs->trans("ShowPayment").': '.$this->ref;
|
||||||
|
|
||||||
if (!empty($this->id))
|
if (!empty($this->id))
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment").': '.$this->ref, 'payment', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin.' ');
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin;
|
if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -193,9 +193,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= " AND l.fk_facture = f.rowid";
|
$sql.= " AND l.fk_facture = f.rowid";
|
||||||
$sql.= " AND f.fk_statut in (1,2)";
|
$sql.= " AND f.fk_statut in (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql.= " AND f.type IN (0,1,2)";
|
$sql.= " AND f.type IN (0,1,2,5)";
|
||||||
} else {
|
} else {
|
||||||
$sql.= " AND f.type IN (0,1,2,3)";
|
$sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
}
|
}
|
||||||
if ($date_start && $date_end) {
|
if ($date_start && $date_end) {
|
||||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
|
|||||||
@ -178,9 +178,9 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.fk_user_author = u.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.fk_user_author = u.rowid";
|
||||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql.= " AND f.type IN (0,1,2)";
|
$sql.= " AND f.type IN (0,1,2,5)";
|
||||||
} else {
|
} else {
|
||||||
$sql.= " AND f.type IN (0,1,2,3)";
|
$sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
}
|
}
|
||||||
if ($date_start && $date_end) {
|
if ($date_start && $date_end) {
|
||||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
|
|||||||
@ -191,9 +191,9 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||||||
}
|
}
|
||||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql.= " AND f.type IN (0,1,2)";
|
$sql.= " AND f.type IN (0,1,2,5)";
|
||||||
} else {
|
} else {
|
||||||
$sql.= " AND f.type IN (0,1,2,3)";
|
$sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
}
|
}
|
||||||
$sql.= " AND f.fk_soc = s.rowid";
|
$sql.= " AND f.fk_soc = s.rowid";
|
||||||
if ($date_start && $date_end) {
|
if ($date_start && $date_end) {
|
||||||
|
|||||||
@ -91,8 +91,8 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -638,12 +638,12 @@ class Tva extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$picto='payment';
|
||||||
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
|
|||||||
@ -887,17 +887,18 @@ class Contact extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label = $langs->trans("ShowContact").': '.$this->getFullName($langs);
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
if ($option == 'xxx')
|
if ($option == 'xxx')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowContact").': '.$this->getFullName($langs), 'contact', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($lien.img_object($label, 'contact', 'class="classfortooltip"').$lienfin.' ');
|
||||||
$result.=$lien.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$lienfin;
|
$result.=$lien.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$lienfin;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -211,23 +211,31 @@ class Contrat extends CommonObject
|
|||||||
global $db, $langs, $conf;
|
global $db, $langs, $conf;
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
|
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/contract";
|
if (!empty($conf->global->CONTRACT_ADDON))
|
||||||
|
|
||||||
if (empty($conf->global->CONTRACT_ADDON))
|
|
||||||
{
|
{
|
||||||
$conf->global->CONTRACT_ADDON='mod_contract_serpis';
|
$mybool = false;
|
||||||
}
|
|
||||||
|
|
||||||
$file = $conf->global->CONTRACT_ADDON.".php";
|
$file = $conf->global->CONTRACT_ADDON.".php";
|
||||||
|
|
||||||
// Chargement de la classe de numerotation
|
|
||||||
$classname = $conf->global->CONTRACT_ADDON;
|
$classname = $conf->global->CONTRACT_ADDON;
|
||||||
|
|
||||||
$result=include_once $dir.'/'.$file;
|
// Include file with class
|
||||||
if ($result)
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
{
|
|
||||||
$obj = new $classname();
|
|
||||||
|
|
||||||
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/contract/");
|
||||||
|
|
||||||
|
// Load file with numbering class (if found)
|
||||||
|
$mybool|=@include_once $dir.$file;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $mybool)
|
||||||
|
{
|
||||||
|
dol_print_error('',"Failed to include file ".$file);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$obj = new $classname();
|
||||||
$numref = "";
|
$numref = "";
|
||||||
$numref = $obj->getNextValue($soc,$this);
|
$numref = $obj->getNextValue($soc,$this);
|
||||||
|
|
||||||
@ -237,13 +245,15 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error = $obj->error;
|
||||||
dol_print_error($db,get_class($this)."::getNextValue ".$obj->error);
|
dol_print_error($db,get_class($this)."::getNextValue ".$obj->error);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined");
|
$langs->load("errors");
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1672,13 +1682,13 @@ class Contrat extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowContract").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='contract';
|
$picto='contract';
|
||||||
|
|
||||||
$label=$langs->trans("ShowContract").': '.$this->ref;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
@ -2201,13 +2211,13 @@ class ContratLigne extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
$label=$langs->trans("ShowContractOfService").': '.$this->label;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='contract';
|
$picto='contract';
|
||||||
|
|
||||||
$label=$langs->trans("ShowContractOfService").': '.$this->label;
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
@ -2487,45 +2497,4 @@ class ContratLigne extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load elements linked to contract (only intervention for the moment)
|
|
||||||
*
|
|
||||||
* @param string $type Object type
|
|
||||||
* @return array $elements array of linked elements
|
|
||||||
*/
|
|
||||||
function get_element_list($type)
|
|
||||||
{
|
|
||||||
$elements = array();
|
|
||||||
|
|
||||||
$sql = '';
|
|
||||||
if ($type == 'intervention')
|
|
||||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "fichinter WHERE fk_contrat=" . $this->id;
|
|
||||||
if (! $sql) return -1;
|
|
||||||
|
|
||||||
//print $sql;
|
|
||||||
dol_syslog(get_class($this)."::get_element_list", LOG_DEBUG);
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$nump = $this->db->num_rows($result);
|
|
||||||
if ($nump)
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $nump)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($result);
|
|
||||||
$elements[$i] = $obj->rowid;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$this->db->free($result);
|
|
||||||
/* Return array */
|
|
||||||
return $elements;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($this->db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
64
htdocs/core/actions_printing.inc.php
Normal file
64
htdocs/core/actions_printing.inc.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/actions_printing.inc.php
|
||||||
|
* \brief Code for actions print_file to print file with calling trigger
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// $action must be defined
|
||||||
|
// $db, $user, $conf, $langs must be defined
|
||||||
|
// Filename to print must be provided into 'file' parameter
|
||||||
|
|
||||||
|
// Print file
|
||||||
|
if ($action == 'print_file' and $user->rights->printing->read)
|
||||||
|
{
|
||||||
|
$langs->load("printing");
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php';
|
||||||
|
$objectprint = new PrintingDriver($db);
|
||||||
|
$list = $objectprint->listDrivers($db, 10);
|
||||||
|
if (! empty($list)) {
|
||||||
|
$errorprint=0;
|
||||||
|
$printed=0;
|
||||||
|
foreach ($list as $driver) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||||
|
$langs->load($driver);
|
||||||
|
$classname = 'printing_'.$driver;
|
||||||
|
$printer = new $classname($db);
|
||||||
|
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->{$printer->active})) {
|
||||||
|
$subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':'');
|
||||||
|
$errorprint = $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'), $subdir);
|
||||||
|
//if ($errorprint < 0) {
|
||||||
|
// setEventMessage($interface->errors, 'errors');
|
||||||
|
//}
|
||||||
|
if ($errorprint=='') {
|
||||||
|
setEventMessage($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->trans("ViaModule").' '.$printer->name);
|
||||||
|
$printed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($printed==0) setEventMessage($langs->trans("NoActivePrintingModuleFound"));
|
||||||
|
} else {
|
||||||
|
setEventMessage($langs->trans("NoModuleFound"), 'warning');
|
||||||
|
}
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
* or see http://www.gnu.org/
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/core/actions_printipp.inc.php
|
|
||||||
* \brief Code for actions print_file to print file using ipp
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// $action must be defined
|
|
||||||
// $db, $user, $conf, $langs must be defined
|
|
||||||
// Filename to print must be provided into 'file' parameter
|
|
||||||
|
|
||||||
// Print file
|
|
||||||
if ($action == 'print_file' and $user->rights->printipp->read)
|
|
||||||
{
|
|
||||||
$langs->load("printipp");
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php';
|
|
||||||
$printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD);
|
|
||||||
$result = $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'));
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
setEventMessage($result,'warnings');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setEventMessage($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))));
|
|
||||||
}
|
|
||||||
$action = '';
|
|
||||||
}
|
|
||||||
@ -103,7 +103,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendto = $thirdparty->contact_get_property($_POST['receiver'],'email');
|
$sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email');
|
||||||
$sendtoid = $_POST['receiver'];
|
$sendtoid = $_POST['receiver'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendtocc = $thirdparty->contact_get_property($_POST['receivercc'],'email');
|
$sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,8 +60,7 @@ class box_actions extends ModeleBoxes
|
|||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max));
|
||||||
|
|
||||||
if ($user->rights->agenda->myactions->read)
|
if ($user->rights->agenda->myactions->read) {
|
||||||
{
|
|
||||||
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,";
|
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,";
|
||||||
$sql.= " ta.code, ta.libelle as type_label,";
|
$sql.= " ta.code, ta.libelle as type_label,";
|
||||||
$sql.= " s.nom as name, s.rowid as socid";
|
$sql.= " s.nom as name, s.rowid as socid";
|
||||||
@ -80,15 +79,13 @@ class box_actions extends ModeleBoxes
|
|||||||
|
|
||||||
dol_syslog("Box_actions::loadBox", LOG_DEBUG);
|
dol_syslog("Box_actions::loadBox", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$late = '';
|
$late = '';
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$datelimite=$db->jdate($objp->dp);
|
$datelimite=$db->jdate($objp->dp);
|
||||||
@ -98,31 +95,49 @@ class box_actions extends ModeleBoxes
|
|||||||
//($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label)
|
//($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label)
|
||||||
$label=empty($objp->label)?$objp->type_label:$objp->label;
|
$label=empty($objp->label)?$objp->type_label:$objp->label;
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => ("action"),
|
'logo' => ("action"),
|
||||||
'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id);
|
'tooltip' => $langs->trans('Action'.$objp->code).': '.$label,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => dol_trunc($label,32),
|
'text' => dol_trunc($label,32),
|
||||||
'text2'=> $late,
|
'text2'=> $late,
|
||||||
'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id);
|
'tooltip' => $langs->trans('Action'.$objp->code).': '.$label,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => ($objp->socid?'company':''),
|
'logo' => ($objp->socid?'company':''),
|
||||||
'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''));
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''),
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => dol_trunc($objp->name,24),
|
'text' => dol_trunc($objp->name,24),
|
||||||
'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="left" class="nowrap"',
|
$this->info_box_contents[$i][4] = array(
|
||||||
'text' => dol_print_date($datelimite, "dayhour"));
|
'td' => 'align="left" class="nowrap"',
|
||||||
|
'text' => dol_print_date($datelimite, "dayhour"),
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][5] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][5] = array(
|
||||||
'text' => ($objp->percentage>= 0?$objp->percentage.'%':''));
|
'td' => 'align="right"',
|
||||||
|
'text' => ($objp->percentage>= 0?$objp->percentage.'%':''),
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
|
$this->info_box_contents[$i][6] = array(
|
||||||
'text' => $actionstatic->LibStatut($objp->percentage,3));
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $actionstatic->LibStatut($objp->percentage,3),
|
||||||
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -130,16 +145,18 @@ class box_actions extends ModeleBoxes
|
|||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo"));
|
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo"));
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array('align' => 'left',
|
'align' => 'left',
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
|
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
|
||||||
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -53,8 +54,6 @@ class box_activity extends ModeleBoxes
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
// FIXME: Use a cache to save data because this slow down too much main home page. This box slow down too seriously software.
|
|
||||||
// FIXME: Removed number_format (not compatible with all languages)
|
|
||||||
// FIXME: Pb into some status
|
// FIXME: Pb into some status
|
||||||
$this->enabled=$conf->global->MAIN_FEATURES_LEVEL; // Not enabled by default due to bugs (see previous comments)
|
$this->enabled=$conf->global->MAIN_FEATURES_LEVEL; // Not enabled by default due to bugs (see previous comments)
|
||||||
}
|
}
|
||||||
@ -69,26 +68,36 @@ class box_activity extends ModeleBoxes
|
|||||||
{
|
{
|
||||||
global $conf, $user, $langs, $db;
|
global $conf, $user, $langs, $db;
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$totalMnt = 0;
|
$totalMnt = 0;
|
||||||
$totalnb = 0;
|
$totalnb = 0;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
$cachetime = 3600;
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
|
||||||
|
$now = dol_now();
|
||||||
$nbofyears=2;
|
$nbofyears=2;
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION;
|
if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION;
|
||||||
$textHead = $langs->trans("Activity").' ('.$nbofyears.' '.$langs->trans("DurationYears").')';
|
$textHead = $langs->trans("Activity").' <span class="badge">'.$nbofyears.' '.$langs->trans("DurationYears").'</span>';
|
||||||
$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
|
$this->info_box_head = array(
|
||||||
|
'text' => $textHead,
|
||||||
|
'limit'=> dol_strlen($textHead),
|
||||||
|
);
|
||||||
|
|
||||||
// compute the year limit to show
|
// compute the year limit to show
|
||||||
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y");
|
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y");
|
||||||
|
|
||||||
// list the summary of the bills
|
// list the summary of the bills
|
||||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
if (! empty($conf->facture->enabled) && $user->rights->facture->lire) {
|
||||||
{
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
$facturestatic=new Facture($db);
|
$facturestatic=new Facture($db);
|
||||||
|
|
||||||
|
$cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice'.$fileid;
|
||||||
|
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||||
|
$data = array();
|
||||||
|
if ($refresh) {
|
||||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -102,40 +111,72 @@ class box_activity extends ModeleBoxes
|
|||||||
$sql.= " ORDER BY f.fk_statut DESC";
|
$sql.= " ORDER BY f.fk_statut DESC";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
while ($i < $num)
|
$j=0;
|
||||||
{
|
while ($j < $num) {
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill');
|
$data[$j]=$db->fetch_object($result);
|
||||||
$objp = $db->fetch_object($result);
|
$j++;
|
||||||
|
}
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$objp->fk_statut,0)." ".$objp->annee);
|
file_put_contents($cachefile,serialize($data),LOCK_EX);
|
||||||
$billurl="viewstatut=2&paye=1&year=".$objp->annee;
|
$db->free($result);
|
||||||
|
} else {
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
dol_print_error($db);
|
||||||
'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills"
|
}
|
||||||
|
} else {
|
||||||
|
$data = unserialize(file_get_contents($cachefile));
|
||||||
|
}
|
||||||
|
if (! empty($data)) {
|
||||||
|
$j=0;
|
||||||
|
while ($i < count($data)) {
|
||||||
|
$billurl="viewstatut=2&paye=1&year=".$data[$j]->annee;
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
|
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||||
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
|
'logo' => 'bill',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
'text' => price($objp->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
'td' => 'align="left"',
|
||||||
|
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
|
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||||
|
'text' => $data[$j]->nb,
|
||||||
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
||||||
);
|
);
|
||||||
|
|
||||||
// We add only for the current year
|
// We add only for the current year
|
||||||
if ($objp->annee == date("Y"))
|
if ($data[$j]->annee == date("Y")) {
|
||||||
{
|
$totalnb += $data[$j]->nb;
|
||||||
$totalnb += $objp->nb;
|
$totalMnt += $data[$j]->Mnttot;
|
||||||
$totalMnt += $objp->Mnttot;
|
|
||||||
}
|
}
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut(1,$objp->fk_statut,3) );
|
$this->info_box_contents[$i][4] = array(
|
||||||
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
|
||||||
|
);
|
||||||
$i++;
|
$i++;
|
||||||
|
$j++;
|
||||||
}
|
}
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
|
if (count($data)==0)
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
$db->free($result);
|
'td' => 'align="center"',
|
||||||
|
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
|
||||||
|
|
||||||
|
$cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice2'.$fileid;
|
||||||
|
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||||
|
|
||||||
|
if ($refresh) {
|
||||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
@ -145,46 +186,80 @@ class box_activity extends ModeleBoxes
|
|||||||
$sql.= " ORDER BY f.fk_statut DESC";
|
$sql.= " ORDER BY f.fk_statut DESC";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result) + $i;
|
$num = $db->num_rows($result) + $i;
|
||||||
$now=dol_now();
|
$j=0;
|
||||||
|
while ($j < $num) {
|
||||||
|
$data[$j]=$db->fetch_object($result);
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
file_put_contents($cachefile,serialize($data),LOCK_EX);
|
||||||
|
$db->free($result);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data = unserialize(file_get_contents($cachefile));
|
||||||
|
}
|
||||||
|
if (! empty($data)) {
|
||||||
|
$j=0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < count($data)) {
|
||||||
{
|
$billurl="viewstatut=".$data[$j]->fk_statut."&paye=0";
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
'logo' => 'bill');
|
'td' => 'align="left" width="16"',
|
||||||
$objp = $db->fetch_object($result);
|
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||||
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
'logo' => 'bill',
|
||||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$objp->fk_statut,0));
|
|
||||||
|
|
||||||
$billurl="viewstatut=".$objp->fk_statut."&paye=0";
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
|
||||||
'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills"
|
|
||||||
);
|
);
|
||||||
$totalnb += $objp->nb;
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
'text' => price($objp->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
'td' => 'align="left"',
|
||||||
|
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
|
'text' => $data[$j]->nb,
|
||||||
|
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||||
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
|
);
|
||||||
|
$totalnb += $data[$j]->nb;
|
||||||
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||||
);
|
);
|
||||||
$totalMnt += $objp->Mnttot;
|
$totalMnt += $objp->Mnttot;
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
|
$this->info_box_contents[$i][4] = array(
|
||||||
'text' => $facturestatic->LibStatut(0,$objp->fk_statut,3)
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
|
||||||
);
|
);
|
||||||
$i++;
|
$i++;
|
||||||
|
$j++;
|
||||||
}
|
}
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
|
if ($num==0)
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="center"',
|
||||||
|
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql));
|
$this->info_box_contents[0][0] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
|
'maxlength'=>500, 'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// list the summary of the orders
|
// list the summary of the orders
|
||||||
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
if (! empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||||
{
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
$commandestatic=new Commande($db);
|
$commandestatic=new Commande($db);
|
||||||
|
|
||||||
|
$cachefile = DOL_DATA_ROOT.'/commande/temp/boxactivity-order'.$fileid;
|
||||||
|
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||||
|
$data = array();
|
||||||
|
if ($refresh) {
|
||||||
|
|
||||||
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
|
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -200,42 +275,69 @@ class box_activity extends ModeleBoxes
|
|||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result) + $i;
|
$num = $db->num_rows($result) + $i;
|
||||||
while ($i < $num)
|
$j=0;
|
||||||
{
|
while ($j < $num) {
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_order');
|
$data[$j]=$db->fetch_object($result);
|
||||||
|
$j++;
|
||||||
$objp = $db->fetch_object($result);
|
}
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
file_put_contents($cachefile,serialize($data),LOCK_EX);
|
||||||
'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($objp->fk_statut,0,0)
|
$db->free($result);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data = unserialize(file_get_contents($cachefile));
|
||||||
|
}
|
||||||
|
if (! empty($data)) {
|
||||||
|
$j=0;
|
||||||
|
while ($i < count($data)) {
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
|
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
|
||||||
|
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
|
||||||
|
'logo' => 'object_order',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
'text' => $objp->nb,
|
'td' => 'align="left"',
|
||||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$objp->fk_statut
|
'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
|
||||||
);
|
);
|
||||||
$totalnb += $objp->nb;
|
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
'text' => price($objp->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
'td' => 'align="right"',
|
||||||
|
'text' => $data[$j]->nb,
|
||||||
|
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
|
||||||
|
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
|
||||||
|
);
|
||||||
|
$totalnb += $data[$j]->nb;
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||||
|
);
|
||||||
|
$totalMnt += $data[$j]->Mnttot;
|
||||||
|
$this->info_box_contents[$i][4] = array(
|
||||||
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
|
||||||
);
|
);
|
||||||
$totalMnt += $objp->Mnttot;
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $commandestatic->LibStatut($objp->fk_statut,0,3));
|
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
$j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// list the summary of the propals
|
// list the summary of the propals
|
||||||
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
if (! empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||||
{
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
$propalstatic=new Propal($db);
|
$propalstatic=new Propal($db);
|
||||||
|
|
||||||
|
$cachefile = DOL_DATA_ROOT.'/propale/temp/boxactivity-propal'.$fileid;
|
||||||
|
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||||
|
$data = array();
|
||||||
|
if ($refresh) {
|
||||||
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -251,42 +353,82 @@ class box_activity extends ModeleBoxes
|
|||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result) + $i;
|
$num = $db->num_rows($result) + $i;
|
||||||
while ($i < $num)
|
$j=0;
|
||||||
{
|
while ($j < $num) {
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_propal');
|
$data[$j]=$db->fetch_object($result);
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
file_put_contents($cachefile,serialize($data),LOCK_EX);
|
||||||
|
$db->free($result);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data = unserialize(file_get_contents($cachefile));
|
||||||
|
}
|
||||||
|
if (! empty($data)) {
|
||||||
|
$j=0;
|
||||||
|
while ($i < count($data)) {
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
|
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
||||||
|
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
|
'logo' => 'object_propal'
|
||||||
|
);
|
||||||
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
'text' =>$langs->trans("Proposals")." ".$propalstatic->LibStatut($objp->fk_statut,0)
|
'td' => 'align="left"',
|
||||||
|
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
'text' => $objp->nb,
|
'td' => 'align="right"',
|
||||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$objp->fk_statut
|
'text' => $data[$j]->nb,
|
||||||
|
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
|
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
||||||
);
|
);
|
||||||
$totalnb += $objp->nb;
|
$totalnb += $data[$j]->nb;
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][3] = array(
|
||||||
'text' => price($objp->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
'td' => 'align="right"',
|
||||||
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||||
|
);
|
||||||
|
$totalMnt += $data[$j]->Mnttot;
|
||||||
|
$this->info_box_contents[$i][4] = array(
|
||||||
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
|
||||||
);
|
);
|
||||||
$totalMnt += $objp->Mnttot;
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($objp->fk_statut,3));
|
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
$j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the sum in the bottom of the boxes
|
// Add the sum in the bottom of the boxes
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead);
|
$this->info_box_contents[$i][1] = array(
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => $totalnb);
|
'td' => 'align="left" ',
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency));
|
'text' => $langs->trans("Total")." ".$textHead,
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => "");
|
);
|
||||||
$this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => "");
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="right" ',
|
||||||
|
'text' => $totalnb,
|
||||||
|
);
|
||||||
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="right" ',
|
||||||
|
'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)
|
||||||
|
);
|
||||||
|
$this->info_box_contents[$i][4] = array(
|
||||||
|
'td' => 'align="right" ',
|
||||||
|
'text' => "",
|
||||||
|
);
|
||||||
|
$this->info_box_contents[$i][5] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
|
'text' => "",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -52,10 +52,11 @@ class box_bookmarks extends ModeleBoxes
|
|||||||
|
|
||||||
$this->max=$max;
|
$this->max=$max;
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxMyLastBookmarks",$max),
|
$this->info_box_head = array(
|
||||||
'sublink' => DOL_URL_ROOT.'/bookmarks/list.php');
|
'text' => $langs->trans("BoxMyLastBookmarks",$max),
|
||||||
if ($user->rights->bookmark->creer)
|
'sublink' => DOL_URL_ROOT.'/bookmarks/list.php',
|
||||||
{
|
);
|
||||||
|
if ($user->rights->bookmark->creer) {
|
||||||
$this->info_box_head['subpicto']='object_bookmark';
|
$this->info_box_head['subpicto']='object_bookmark';
|
||||||
$this->info_box_head['subtext']=$langs->trans("BookmarksManagement");
|
$this->info_box_head['subtext']=$langs->trans("BookmarksManagement");
|
||||||
}
|
}
|
||||||
@ -81,41 +82,50 @@ class box_bookmarks extends ModeleBoxes
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => $objp->url,
|
'url' => $objp->url,
|
||||||
'target' => $objp->target?'newtab':'');
|
'tooltip' => $objp->title,
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
'target' => $objp->target?'newtab':'',
|
||||||
|
);
|
||||||
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $objp->title,
|
'text' => $objp->title,
|
||||||
'url' => $objp->url,
|
'url' => $objp->url,
|
||||||
'target' => $objp->target?'newtab':'');
|
'tooltip' => $objp->title,
|
||||||
|
'target' => $objp->target?'newtab':'',
|
||||||
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0)
|
if ($num==0) {
|
||||||
{
|
|
||||||
$mytxt=$langs->trans("NoRecordedBookmarks");
|
$mytxt=$langs->trans("NoRecordedBookmarks");
|
||||||
if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd");
|
if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd");
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="center" colspan="2"', 'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt);
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="center" colspan="2"',
|
||||||
|
'tooltip' => $mytxt,
|
||||||
|
'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
} else {
|
||||||
else
|
$this->info_box_contents[0][0] = array(
|
||||||
{
|
'td' => 'align="left"',
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array('align' => 'left',
|
'align' => 'left',
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -104,19 +104,28 @@ class box_clients extends ModeleBoxes
|
|||||||
$datec=$db->jdate($objp->datec);
|
$datec=$db->jdate($objp->datec);
|
||||||
$datem=$db->jdate($objp->tms);
|
$datem=$db->jdate($objp->tms);
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => $url.$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => $url.$objp->socid
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
);
|
||||||
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $objp->name,
|
'text' => $objp->name,
|
||||||
'url' => $url.$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => $url.$objp->socid
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
'text' => dol_print_date($datem, "day"));
|
'td' => 'align="right"',
|
||||||
|
'text' => dol_print_date($datem, "day")
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
|
$this->info_box_contents[$i][3] = array(
|
||||||
'text' => $thirdpartystatic->LibStatut($objp->status,3));
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $thirdpartystatic->LibStatut($objp->status,3)
|
||||||
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,53 +80,66 @@ class box_commandes extends ModeleBoxes
|
|||||||
$sql.= $db->plimit($max, 0);
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$date=$db->jdate($objp->date_commande);
|
$date=$db->jdate($objp->date_commande);
|
||||||
$datem=$db->jdate($objp->tms);
|
$datem=$db->jdate($objp->tms);
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid);
|
'tooltip' => $langs->trans('Order').': '.$objp->ref,
|
||||||
|
'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $objp->ref,
|
'text' => $objp->ref,
|
||||||
'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid);
|
'tooltip' => $langs->trans('Order').': '.$objp->ref,
|
||||||
|
'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid,
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="left" width="16"',
|
);
|
||||||
|
$this->info_box_contents[$i][] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => 'company',
|
'logo' => 'company',
|
||||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $objp->name,
|
'text' => $objp->name,
|
||||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
'text' => price($objp->total_ht),
|
'text' => price($objp->total_ht),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER))
|
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) {
|
||||||
{
|
|
||||||
if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid);
|
if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid);
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''),
|
'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''),
|
||||||
'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:'')
|
'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:''),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
'text' => dol_print_date($date,'day'),
|
'text' => dol_print_date($date,'day'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"',
|
$this->info_box_contents[$i][] = array(
|
||||||
'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3));
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3),
|
||||||
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -134,16 +147,18 @@ class box_commandes extends ModeleBoxes
|
|||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
|
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array('align' => 'left',
|
'align' => 'left',
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,8 +76,7 @@ class box_comptes extends ModeleBoxes
|
|||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
|
||||||
|
|
||||||
if ($user->rights->banque->lire)
|
if ($user->rights->banque->lire) {
|
||||||
{
|
|
||||||
$sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,";
|
$sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,";
|
||||||
$sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,";
|
$sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,";
|
||||||
$sql.= " domiciliation, proprio, owner_address,";
|
$sql.= " domiciliation, proprio, owner_address,";
|
||||||
@ -92,73 +91,84 @@ class box_comptes extends ModeleBoxes
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$solde_total = 0;
|
$solde_total = array();
|
||||||
|
|
||||||
$listofcurrencies=array();
|
|
||||||
$account_static = new Account($db);
|
$account_static = new Account($db);
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$account_static->id = $objp->rowid;
|
$account_static->id = $objp->rowid;
|
||||||
$solde=$account_static->solde(0);
|
$solde=$account_static->solde(0);
|
||||||
|
|
||||||
$solde_total += $solde;
|
$solde_total[$objp->currency_code] += $solde;
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid);
|
'tooltip' => $langs->trans('Account').': '.$objp->label,
|
||||||
|
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid,
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
|
||||||
'text' => $objp->label,
|
|
||||||
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid);
|
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
|
|
||||||
'text' => $objp->number
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
|
'text' => $objp->label,
|
||||||
|
'tooltip' => $langs->trans('Account').': '.$objp->label,
|
||||||
|
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
|
'text' => $objp->number,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code)
|
'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code)
|
||||||
);
|
);
|
||||||
|
|
||||||
$listofcurrencies[$objp->currency_code]=1;
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total
|
// Total
|
||||||
if (count($listofcurrencies) <= 1)
|
foreach ($solde_total as $key=>$solde) {
|
||||||
{
|
$this->info_box_contents[$i][0] = array(
|
||||||
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" class="liste_total"',
|
'tr' => 'class="liste_total"',
|
||||||
'text' => $langs->trans('Total')
|
'td' => 'align="right" class="liste_total"',
|
||||||
|
'text' => ' ',
|
||||||
);
|
);
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="right" class="liste_total"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left" class="liste_total"',
|
||||||
|
'text' => $langs->trans('Total').' '.$key,
|
||||||
|
);
|
||||||
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="right" class="liste_total"',
|
||||||
'text' => ' '
|
'text' => ' '
|
||||||
);
|
);
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="right" class="liste_total"',
|
$totalamount=price($solde,0,$langs,0,0,-1,$key);
|
||||||
'text' => ' '
|
$this->info_box_contents[$i][3] = array(
|
||||||
);
|
'td' => 'align="right" class="liste_total"',
|
||||||
$totalamount=price($solde_total,0,$langs,0,0,-1,$conf->currency);
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" class="liste_total"',
|
|
||||||
'text' => $totalamount
|
'text' => $totalamount
|
||||||
);
|
);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,16 +73,14 @@ class box_contacts extends ModeleBoxes
|
|||||||
$sql.= $db->plimit($max, 0);
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
$societestatic=new Societe($db);
|
$societestatic=new Societe($db);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$datec=$db->jdate($objp->datec);
|
$datec=$db->jdate($objp->datec);
|
||||||
$datem=$db->jdate($objp->tms);
|
$datem=$db->jdate($objp->tms);
|
||||||
@ -94,41 +92,61 @@ class box_contacts extends ModeleBoxes
|
|||||||
$societestatic->id=$objp->fk_soc;
|
$societestatic->id=$objp->fk_soc;
|
||||||
$societestatic->name=$objp->socname;
|
$societestatic->name=$objp->socname;
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid);
|
'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0),
|
||||||
|
'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $contactstatic->getFullName($langs,0),
|
'text' => $contactstatic->getFullName($langs,0),
|
||||||
'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid);
|
'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0),
|
||||||
|
'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => ($objp->fk_soc > 0?'company':''),
|
'logo' => ($objp->fk_soc > 0?'company':''),
|
||||||
'url' => ($objp->fk_soc > 0?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc:''));
|
'tooltip' => $societestatic->name,
|
||||||
|
'url' => ($objp->fk_soc > 0?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc:''),
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $societestatic->name,
|
'text' => $societestatic->name,
|
||||||
'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc);
|
'tooltip' => $societestatic->name,
|
||||||
|
'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][4] = array(
|
||||||
'text' => dol_print_date($datem, "day"));
|
'td' => 'align="right"',
|
||||||
|
'text' => dol_print_date($datem, "day"),
|
||||||
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedContacts"));
|
if ($num==0)
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="center"',
|
||||||
|
'text'=>$langs->trans("NoRecordedContacts"),
|
||||||
|
);
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array('align' => 'left',
|
'align' => 'left',
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,8 +79,7 @@ class box_contracts extends ModeleBoxes
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$datec=$db->jdate($objp->datec);
|
$datec=$db->jdate($objp->datec);
|
||||||
$dateterm=$db->jdate($objp->fin_validite);
|
$dateterm=$db->jdate($objp->fin_validite);
|
||||||
@ -94,49 +93,68 @@ class box_contracts extends ModeleBoxes
|
|||||||
// fin_validite is no more on contract but on services
|
// fin_validite is no more on contract but on services
|
||||||
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
|
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
|
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
|
||||||
|
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
|
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
|
||||||
|
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
|
||||||
'text2'=> $late,
|
'text2'=> $late,
|
||||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
|
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => 'company',
|
'logo' => 'company',
|
||||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => dol_trunc($objp->name,40),
|
'text' => dol_trunc($objp->name,40),
|
||||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][4] = array(
|
||||||
'text' => dol_print_date($datec,'day'));
|
'td' => 'align="right"',
|
||||||
|
'text' => dol_print_date($datec,'day'),
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"',
|
$this->info_box_contents[$i][5] = array(
|
||||||
|
'td' => 'align="right" class="nowrap"',
|
||||||
'text' => $contractstatic->getLibStatut(6),
|
'text' => $contractstatic->getLibStatut(6),
|
||||||
'asis'=>1
|
'asis'=>1,
|
||||||
);
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedContracts"));
|
if ($num==0)
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="center"',
|
||||||
|
'text'=>$langs->trans("NoRecordedContracts"),
|
||||||
|
);
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
} else {
|
||||||
else
|
$this->info_box_contents[0][0] = array(
|
||||||
{
|
'td' => 'align="left"',
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
$this->info_box_contents[0][0] = array(
|
||||||
{
|
'td' => 'align="left"',
|
||||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -98,8 +98,12 @@ class box_external_rss extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->info_box_head = array('text' => $title,
|
$this->info_box_head = array(
|
||||||
'sublink' => $link, 'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate()?dol_print_date($rssparser->getLastFetchDate(),"dayhourtext"):$langs->trans("Unknown")), 'subpicto'=>'object_bookmark');
|
'text' => $title,
|
||||||
|
'sublink' => $link,
|
||||||
|
'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate()?dol_print_date($rssparser->getLastFetchDate(),"dayhourtext"):$langs->trans("Unknown")),
|
||||||
|
'subpicto'=>'object_bookmark',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// INFO on items
|
// INFO on items
|
||||||
@ -138,19 +142,27 @@ class box_external_rss extends ModeleBoxes
|
|||||||
$title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut
|
$title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut
|
||||||
$this->info_box_contents["$href"]="$title";
|
$this->info_box_contents["$href"]="$title";
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => $href,
|
'url' => $href,
|
||||||
'target' => 'newrss');
|
'tooltip' => $title,
|
||||||
|
'target' => 'newrss',
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $title,
|
'text' => $title,
|
||||||
'url' => $href,
|
'url' => $href,
|
||||||
|
'tooltip' => $title,
|
||||||
'maxlength' => 64,
|
'maxlength' => 64,
|
||||||
'target' => 'newrss');
|
'target' => 'newrss',
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="right" nowrap="1"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
'text' => $date);
|
'td' => 'align="right" nowrap="1"',
|
||||||
|
'text' => $date,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -101,53 +101,74 @@ class box_factures extends ModeleBoxes
|
|||||||
$late = '';
|
$late = '';
|
||||||
if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));}
|
if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));}
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $picto,
|
'logo' => $picto,
|
||||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
|
'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber,
|
||||||
|
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $objp->facnumber,
|
'text' => $objp->facnumber,
|
||||||
'text2'=> $late,
|
'text2'=> $late,
|
||||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
|
'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber,
|
||||||
|
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => 'company',
|
'logo' => 'company',
|
||||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $objp->name,
|
'text' => $objp->name,
|
||||||
'maxlength'=>40,
|
'maxlength'=>40,
|
||||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][4] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
'text' => price($objp->total_ht),
|
'text' => price($objp->total_ht),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][5] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][5] = array(
|
||||||
|
'td' => 'align="right"',
|
||||||
'text' => dol_print_date($date,'day'),
|
'text' => dol_print_date($date,'day'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
|
$this->info_box_contents[$i][6] = array(
|
||||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3),
|
||||||
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
|
if ($num==0)
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="center"',
|
||||||
|
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||||
|
);
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
} else {
|
||||||
else
|
$this->info_box_contents[0][0] = array(
|
||||||
{
|
'td' => 'align="left"',
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -89,8 +89,7 @@ class box_factures_fourn extends ModeleBoxes
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
|
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$datelimite=$db->jdate($objp->datelimite);
|
$datelimite=$db->jdate($objp->datelimite);
|
||||||
$date=$db->jdate($objp->df);
|
$date=$db->jdate($objp->df);
|
||||||
@ -99,52 +98,77 @@ class box_factures_fourn extends ModeleBoxes
|
|||||||
$late = '';
|
$late = '';
|
||||||
if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
|
if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid);
|
'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'<br>'.$langs->trans('RefSupplier').': '.$objp->ref_supplier,
|
||||||
|
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => ($objp->ref?$objp->ref:$objp->facid),
|
'text' => ($objp->ref?$objp->ref:$objp->facid),
|
||||||
'text2'=> $late,
|
'text2'=> $late,
|
||||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid);
|
'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'<br>'.$langs->trans('RefSupplier').': '.$objp->ref_supplier,
|
||||||
|
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][2] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $objp->ref_supplier,
|
'text' => $objp->ref_supplier,
|
||||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid);
|
'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'<br>'.$langs->trans('RefSupplier').': '.$objp->ref_supplier,
|
||||||
|
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][3] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
'logo' => 'company',
|
'logo' => 'company',
|
||||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Supplier').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][4] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][4] = array(
|
||||||
|
'td' => 'align="left"',
|
||||||
'text' => $objp->name,
|
'text' => $objp->name,
|
||||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
|
'tooltip' => $langs->trans('Supplier').': '.$objp->name,
|
||||||
|
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][5] = array('td' => 'align="right"',
|
$this->info_box_contents[$i][5] = array(
|
||||||
'text' => dol_print_date($date,'day'));
|
'td' => 'align="right"',
|
||||||
|
'text' => dol_print_date($date,'day'),
|
||||||
|
);
|
||||||
|
|
||||||
$fac = new FactureFournisseur($db);
|
$fac = new FactureFournisseur($db);
|
||||||
$fac->fetch($objp->facid);
|
$fac->fetch($objp->facid);
|
||||||
$alreadypaid=$fac->getSommePaiement();
|
$alreadypaid=$fac->getSommePaiement();
|
||||||
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
|
$this->info_box_contents[$i][6] = array(
|
||||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type));
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type),
|
||||||
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoModifiedSupplierBills"));
|
if ($num==0)
|
||||||
|
$this->info_box_contents[$i][0] = array(
|
||||||
|
'td' => 'align="center"',
|
||||||
|
'text'=>$langs->trans("NoModifiedSupplierBills"),
|
||||||
|
);
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($db->error().' sql='.$sql));
|
'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
$this->info_box_contents[0][0] = array(
|
||||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'text' => $langs->transnoentities("ReadPermissionNotAllowed"));
|
'text' => $langs->transnoentities("ReadPermissionNotAllowed"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -257,8 +257,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
|||||||
|
|
||||||
// Loop on each TD
|
// Loop on each TD
|
||||||
$nbcolthisline=count($contents[$i]);
|
$nbcolthisline=count($contents[$i]);
|
||||||
for ($j=0; $j < $nbcolthisline; $j++)
|
for ($j=0; $j < $nbcolthisline; $j++) {
|
||||||
{
|
|
||||||
// Define tdparam
|
// Define tdparam
|
||||||
$tdparam='';
|
$tdparam='';
|
||||||
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
|
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
|
||||||
@ -270,13 +269,15 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
|||||||
$text2withnotags=preg_replace('/<([^>]+)>/i','',$text2);
|
$text2withnotags=preg_replace('/<([^>]+)>/i','',$text2);
|
||||||
$textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:'';
|
$textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:'';
|
||||||
//print "xxx $textwithnotags y";
|
//print "xxx $textwithnotags y";
|
||||||
|
if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']="";
|
||||||
|
$tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:'';
|
||||||
|
|
||||||
print '<td'.$tdparam.'>';
|
print '<td'.$tdparam.'>'."\n";
|
||||||
|
|
||||||
// Url
|
// Url
|
||||||
if (! empty($contents[$i][$j]['url']))
|
if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo']))
|
||||||
{
|
{
|
||||||
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textwithnotags.'"';
|
print '<a href="'.$contents[$i][$j]['url'].'" title="'.dol_escape_htmltag($langs->trans("Show").' '.$tooltip, 1).'" class="classfortooltip"';
|
||||||
//print ' alt="'.$textwithnotags.'"'; // Pas de alt sur un "<a href>"
|
//print ' alt="'.$textwithnotags.'"'; // Pas de alt sur un "<a href>"
|
||||||
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
|
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
|
||||||
print '>';
|
print '>';
|
||||||
@ -286,7 +287,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
|||||||
if (! empty($contents[$i][$j]['logo']))
|
if (! empty($contents[$i][$j]['logo']))
|
||||||
{
|
{
|
||||||
$logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']);
|
$logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']);
|
||||||
print img_object($langs->trans("Show"),$logo);
|
print '<a href="'.$contents[$i][$j]['url'].'">';
|
||||||
|
print img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"');
|
||||||
}
|
}
|
||||||
|
|
||||||
$maxlength=$MAXLENGTHBOX;
|
$maxlength=$MAXLENGTHBOX;
|
||||||
@ -304,7 +306,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
|||||||
|
|
||||||
if (! empty($textnoformat)) print "\n".$textnoformat."\n";
|
if (! empty($textnoformat)) print "\n".$textnoformat."\n";
|
||||||
|
|
||||||
print "</td>";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -404,7 +404,7 @@ abstract class CommonDocGenerator
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
return array(
|
$resarray= array(
|
||||||
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
|
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
|
||||||
'line_product_ref'=>$line->product_ref,
|
'line_product_ref'=>$line->product_ref,
|
||||||
'line_product_label'=>$line->product_label,
|
'line_product_label'=>$line->product_label,
|
||||||
@ -425,6 +425,18 @@ abstract class CommonDocGenerator
|
|||||||
'line_date_end'=>$line->date_end,
|
'line_date_end'=>$line->date_end,
|
||||||
'line_date_end_rfc'=>dol_print_date($line->date_end,'rfc')
|
'line_date_end_rfc'=>dol_print_date($line->date_end,'rfc')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Retrieve extrafields
|
||||||
|
$extrafieldkey=$line->element;
|
||||||
|
$array_key="line";
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
$extrafields = new ExtraFields($this->db);
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true);
|
||||||
|
$line->fetch_optionals($line->rowid,$extralabels);
|
||||||
|
|
||||||
|
$resarray = $this->fill_substitutionarray_with_extrafields($line,$resarray,$extrafields,$array_key=$array_key,$outputlangs);
|
||||||
|
|
||||||
|
return $resarray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -28,6 +30,36 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
|||||||
*/
|
*/
|
||||||
abstract class CommonInvoice extends CommonObject
|
abstract class CommonInvoice extends CommonObject
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Standard invoice
|
||||||
|
*/
|
||||||
|
const TYPE_STANDARD = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replacement invoice
|
||||||
|
*/
|
||||||
|
const TYPE_REPLACEMENT = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Credit note invoice
|
||||||
|
*/
|
||||||
|
const TYPE_CREDIT_NOTE = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deposit invoice
|
||||||
|
*/
|
||||||
|
const TYPE_DEPOSIT = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proforma invoice
|
||||||
|
*/
|
||||||
|
const TYPE_PROFORMA = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Situation invoice
|
||||||
|
*/
|
||||||
|
const TYPE_SITUATION = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return amount of payments already done
|
* Return amount of payments already done
|
||||||
*
|
*
|
||||||
@ -143,11 +175,12 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
function getLibType()
|
function getLibType()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
if ($this->type == 0) return $langs->trans("InvoiceStandard");
|
if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard");
|
||||||
if ($this->type == 1) return $langs->trans("InvoiceReplacement");
|
if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
|
||||||
if ($this->type == 2) return $langs->trans("InvoiceAvoir");
|
if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
|
||||||
if ($this->type == 3) return $langs->trans("InvoiceDeposit");
|
if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
|
||||||
if ($this->type == 4) return $langs->trans("InvoiceProForma");
|
if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma");
|
||||||
|
if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
|
||||||
return $langs->trans("Unknown");
|
return $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
||||||
|
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1743,6 +1744,19 @@ abstract class CommonObject
|
|||||||
// Add revenue stamp to total
|
// Add revenue stamp to total
|
||||||
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
|
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
|
||||||
|
|
||||||
|
// Situations totals
|
||||||
|
if ($this->situation_cycle_ref && $this->situation_counter > 1) {
|
||||||
|
$prev_sits = $this->get_prev_sits();
|
||||||
|
|
||||||
|
foreach ($prev_sits as $sit) {
|
||||||
|
$this->total_ht -= $sit->total_ht;
|
||||||
|
$this->total_tva -= $sit->total_tva;
|
||||||
|
$this->total_localtax1 -= $sit->total_localtax1;
|
||||||
|
$this->total_localtax2 -= $sit->total_localtax2;
|
||||||
|
$this->total_ttc -= $sit->total_ttc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
// Now update global field total_ht, total_ttc and tva
|
// Now update global field total_ht, total_ttc and tva
|
||||||
@ -2191,7 +2205,6 @@ abstract class CommonObject
|
|||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($obj)
|
if ($obj)
|
||||||
{
|
{
|
||||||
$this->id = $obj->rowid;
|
|
||||||
$this->canvas = $obj->canvas;
|
$this->canvas = $obj->canvas;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2547,7 +2560,7 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
|
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user,$object,$hookmanager;
|
global $conf, $hookmanager, $inputalsopricewithtax, $langs, $user;
|
||||||
|
|
||||||
print '<tr class="liste_titre nodrag nodrop">';
|
print '<tr class="liste_titre nodrag nodrop">';
|
||||||
|
|
||||||
@ -2570,6 +2583,10 @@ abstract class CommonObject
|
|||||||
// Reduction short
|
// Reduction short
|
||||||
print '<td align="right" width="50"><label for="remise_percent">'.$langs->trans('ReductionShort').'</label></td>';
|
print '<td align="right" width="50"><label for="remise_percent">'.$langs->trans('ReductionShort').'</label></td>';
|
||||||
|
|
||||||
|
if ($this->situation_cycle_ref) {
|
||||||
|
print '<td align="right" width="50"><label for="progress">' . $langs->trans('Progress') . '</label></td>';
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->margin->enabled) && empty($user->societe_id))
|
if (! empty($conf->margin->enabled) && empty($user->societe_id))
|
||||||
{
|
{
|
||||||
if ($conf->global->MARGIN_TYPE == "1")
|
if ($conf->global->MARGIN_TYPE == "1")
|
||||||
|
|||||||
@ -433,19 +433,17 @@ class DiscountAbsolute
|
|||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
if ($option == 'invoice')
|
if ($option == 'invoice') {
|
||||||
{
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->fk_facture_source.'">';
|
|
||||||
$lienfin='</a>';
|
|
||||||
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source;
|
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source;
|
||||||
|
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->fk_facture_source.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
$lienfin='</a>';
|
||||||
$ref=$this->ref_facture_source;
|
$ref=$this->ref_facture_source;
|
||||||
$picto='bill';
|
$picto='bill';
|
||||||
}
|
}
|
||||||
if ($option == 'discount')
|
if ($option == 'discount') {
|
||||||
{
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->fk_soc.'">';
|
|
||||||
$lienfin='</a>';
|
|
||||||
$label=$langs->trans("Discount");
|
$label=$langs->trans("Discount");
|
||||||
|
$lien = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->fk_soc.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
$lienfin='</a>';
|
||||||
$ref=$langs->trans("Discount");
|
$ref=$langs->trans("Discount");
|
||||||
$picto='generic';
|
$picto='generic';
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user