Merge remote-tracking branch 'dolibarr/develop' into NEW_filter_on_event_tab

This commit is contained in:
quentin 2020-07-01 14:00:49 +02:00
commit 267aa7605b
1930 changed files with 25227 additions and 17659 deletions

View File

@ -1,10 +0,0 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

View File

@ -2,8 +2,19 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users:
***** ChangeLog for 12.0 compared to 11.0 *****
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Properties ->contactid has been renamed into ->contact_id
***** ChangeLog for 12.0.0 compared to 11.0.0 *****
For users:
NEW: Module MO (Manufacturing Order) is available as stable module.
@ -230,7 +241,63 @@ Following changes may create regressions for some external modules, but were nec
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
- add parameter $pagenavastextinput to value 1 when calling print_barre_liste()
WARNING FOR DOLIWAMP USERS ONLY:
Only people that installed Dolibarr using the all-in-one autoinstaller for Windows called "DoliWAMP" are concerned by the following warnings:
* DoliWAMP autoinstaller for Windows is not more available on 32bits systems. Use standard package if you need to use such architecture.
* It is not possible to migrate from an installation done with the old DoliWAMP autoinstaller for Windows by using this new one. You must make a backup
of your database, make a fresh installation using the new installer and reload.
* Don't forget that DoliWAMP is a good solution to make a quick test of Dolibarr on your local computer but was never recommanded as a production
solution on a local desktop since a desktop computer has not a backup and security policy as good as on a server (when there is one).
DoliWAMP remains a solution for fast test or demo purposes.
***** ChangeLog for 11.0.5 compared to 11.0.4 *****
FIX: $arraydefaultmessage is an object, as well as in /htdocs/core/class/html.formmail.class.php
FIX: 10.0 - pagination in prelevement/bons.php
FIX: 10.0 - undefined $langs if template file copy fails during activation of modContrat
FIX: 11.0 - fatal with postgres on contact/agenda.php
FIX: 11.0 - multicurrency amount not fetched when fetching payments from llx_paiement or llx_paiementfourn
FIX: 11.0 - when using pdftk as per hidden conf USE_PDFTK_FOR_PDF_CONCAT, check that the file exists before displaying a success message
FIX: #13841
FIX: #13877 - Can validate invoice if there is a credit note with VAT 0% on an invoice with other lines with a VAT non 0%
FIX: #13968
FIX: #14001
FIX: #14002
FIX: 9.0 - delete unused mandatory argument from migrate_clean_association: argument count mismatch causes a fatal error since php7
FIX: 9.0 - fatal during migration from 3.1 using PHP 7
FIX: Accountancy - Binding index - Add a filter on sql request for module Subtotal & Jalon
FIX: avoid error "Call to undefined function measuringUnitString()"
FIX: BlindBoolean SQL injection reported by Christian Weiler
FIX: Can create a credit note on situation invoice if previous is also
FIX: can install module even if (x) was appended during download.
FIX: copy value date of VariousPayment onto the new AccountLine
FIX: count of open day when date and start are not open should be 0
FIX: Default bank account was not loaded for document generation.
FIX: Do not show stats panel if the user does not have permissions
FIX: Fix link of the button to create a credit note and fix the awareness of a error that happen when wo create a credit note
FIX: force rounding 2 on export ld compta
FIX: free text on cash desk
FIX: links into emails of notifications
FIX: missing file manifest.json.php
FIX: missing GetNomURL Hook in warehouse class
FIX: missing hook init + table class + $page not set
FIX: missing rollbacks on trigger bad return
FIX: missing translation value for key "NoMorePredefinedProductToDispatch"
FIX: percent must be displayed on one line
FIX: php error if multicompany disabled
FIX: Privilege escalation reported by wizlynx WLX-2020-011
FIX: replace filter parameter "none" by "restricthtml"
FIX: Rounding Total TVA in "crabe" model pdf
FIX: Show ref_customer, amount on contract link object
FIX: Site ec.europa.eu has moved to https://
FIX: Tickets mail models doesn't work
FIX: vulnerability reported by wizlynx WLX-2020-012
FIX: We must only rename current bank receipt
FIX: when creating a VariousPayment, the value date is not copied onto the AccountLine that gets created at the same time, so the bank transaction's value date will be the payment date instead of the payment's value date
FIX: wrong url param
FIX: XSS using the renaming of .noexe files - reported by Nolan.
***** ChangeLog for 11.0.4 compared to 11.0.3 *****
FIX: #13749

View File

@ -91,14 +91,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Products and/or Services catalog
- Commercial proposals management
- Customer & Supplier Orders management
- Invoices and payment management
- Shipping management
- Warehouse/Stock management
- Invoices and payment management
- Standing orders management (European SEPA)
- Manufacturing Orders
- Bank accounts management
- Direct debit orders management (European SEPA)
- Accounting management
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Opportunities and/or project management
- Opportunities or Leads management
- Projects & Tasks management
- Contracts management
- Interventions management

View File

@ -5,7 +5,7 @@ File added into doxygen generated documentation
<hr class="footer" />
<address class="footer"><small>Generated on $datetime for <a href="https://www.dolibarr.org">$projectname</a> by Doxygen $doxygenversion </small></address>
<address class="footer"><small>Generated on $datetime for <a href="https://www.dolibarr.org" title="ERP and CRM open source software">$projectname</a> by Doxygen $doxygenversion </small></address>
<br>
@ -22,31 +22,5 @@ File added into doxygen generated documentation
gtag('config', 'UA-9049390-16');
</script>
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '1998533953704960');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
<!-- Twitter ad collector -->
<script src="//static.ads-twitter.com/oct.js" type="text/javascript"></script>
<script type="text/javascript">twttr.conversion.trackPid('ntm4n', { tw_sale_amount: 0, tw_order_quantity: 0 });</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://analytics.twitter.com/i/adsct?txn_id=ntm4n&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
<img height="1" width="1" style="display:none;" alt="" src="//t.co/i/adsct?txn_id=ntm4n&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
</noscript>
</body>
</html>

View File

@ -12,21 +12,6 @@
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<!-- End from dolibarr.org -->
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '1998533953704960');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
</head>
<body>
@ -48,15 +33,6 @@ src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1"
<div class="bannergroupmybanner">
<div class="banneritemmybanner">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- BAN_728x90_DOXYGEN -->
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1465985984238664"
data-ad-slot="4297390217"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<div class="clr"></div>
</div>

View File

@ -32,6 +32,7 @@ PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go bac
FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open :
LaunchNow=Launch Dolibarr now

View File

@ -41,7 +41,7 @@ Compression=lzma
SolidCompression=yes
WizardImageFile=build\exe\doliwamp\doliwamp.bmp
WizardSmallImageFile=build\exe\doliwamp\doliwampsmall.bmp
SetupIconFile=doc\images\dolibarr.ico
SetupIconFile=doc\images\dolibarr_favicon.ico
;To say the installer must be ran as admin
PrivilegesRequired=admin
DisableProgramGroupPage=yes
@ -104,7 +104,7 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45
; Value OK: apache 2.4.9, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
; Value To test: apache 2.4.41, php 7.3.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
; Value To test: apache 2.4.41, php 7.3.12, mariadb10.4.10 (wampserver3.2.0_x64.exe)
Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
;Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
Source: "C:\wamp64\bin\apache\apache2.4.41\*.*"; DestDir: "{app}\bin\apache\apache2.4.41"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
@ -519,7 +519,7 @@ begin
// check that we don't try an upgrade (mysql upgrade no supported)
//----------------------------------------------
if FileExists (pathWithSlashes+'/bin/mysql/mysql5.0.45'+phpVersion+'/bin/mysqld-nt.exe') then
if FileExists (pathWithSlashes+'/bin/mysql/mysql5.0.45/bin/mysqld-nt.exe') then
begin
MsgBox('An existing installation using an old version of Mysql exists. Sorry, upgrade with this installer is not possible.', mbInformation, MB_OK);
Abort();
@ -588,15 +588,26 @@ begin
end;
end;
if browser = 'iexplore.exe' then
begin
if FileExists (winPath+'/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe') then
begin
if MsgBox(CustomMessage('MicrosoftEdgeDetected'),mbConfirmation,MB_YESNO) = IDYES then
begin
browser := winPath+'/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe';
end;
end;
end;
if browser = 'iexplore.exe' then
begin
if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then
begin
GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, pfPath+'/Internet Explorer','exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, pfPath+'/Internet Explorer', 'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
end
else
begin
GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, winPath,'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, winPath, 'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
end;
end;

View File

@ -304,7 +304,7 @@ expose_php = On
max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 64M ; Maximum amount of memory a script may consume (128MB)
memory_limit = 256M ; Maximum amount of memory a script may consume (128MB)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -90,7 +90,7 @@ cui hai bisogno ed essere facile da usare.
%{__install} -m 644 build/rpm/install.forced.php.fedora $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/install.forced.php
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
%{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%{__install} -m 644 doc/images/appicon_64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications
#desktop-file-install --delete-original --dir=$RPM_BUILD_ROOT%{_datadir}/applications build/rpm/%{name}.desktop
%{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

View File

@ -150,7 +150,7 @@ cui hai bisogno ed essere facile da usare.
%endif
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
%{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%{__install} -m 644 doc/images/appicon_64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications
%{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} || 0%{?suse_version}

View File

@ -89,7 +89,7 @@ cui hai bisogno ed essere facile da usare.
%{__install} -m 644 build/rpm/install.forced.php.mandriva $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/install.forced.php
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
%{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%{__install} -m 644 doc/images/appicon_64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications
#desktop-file-install --delete-original --dir=$RPM_BUILD_ROOT%{_datadir}/applications build/rpm/%{name}.desktop
%{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

View File

@ -90,7 +90,7 @@ cui hai bisogno ed essere facile da usare.
%{__install} -m 644 build/rpm/install.forced.php.opensuse $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/install.forced.php
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
%{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%{__install} -m 644 doc/images/appicon_64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications
#desktop-file-install --delete-original --dir=$RPM_BUILD_ROOT%{_datadir}/applications build/rpm/%{name}.desktop
%{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

View File

@ -172,6 +172,11 @@ echo "mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile"
mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
export res=$?
if [ $res -ne 0 ]; then
echo "Error to load database dump with mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile"
exit
fi
$mydir/updatedemo.php confirm
export res=$?

File diff suppressed because one or more lines are too long

View File

@ -72,8 +72,8 @@ $tables=array(
'bank'=>array(0=>'datev', 1=>'dateo'),
'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'),
'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'),
'expense_report'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'),
'leave'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel')
'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'),
'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel')
);
$year=2010;

21
dev/tools/test/testperf.php Executable file
View File

@ -0,0 +1,21 @@
<?php
$a = microtime(true);
$i = 0;
while ($i < 1000000)
{
$key = '1234567890111213141516171819'.$i;
if ($i == 1000) $key = 'MAIN_MODULE_AAAAAiiiiiiiiiiiiiiiiiiiiiiiiiiiii';
//if (preg_match('/^MAIN_MODULE_/', $key)) {
//if (substr($key, 0, 12) == 'MAIN_MODULE_') {
if (strpos($key, 'MAIN_MODULE_') === 0) {
print "Found\n";
}
$i++;
}
$b = microtime(true);
print $b - $a."\n";

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -41,7 +41,7 @@ $action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int'); // id of record
$mode = GETPOST('mode', 'aZ09'); // '' or 'tmp'
$mode = GETPOST('mode', 'aZ09'); // '' or '_tmp'
$piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id)
// Security check
@ -114,11 +114,13 @@ if ($action == "confirm_update") {
$object->credit = $credit;
if (floatval($debit) != 0.0) {
$object->montant = $debit;
$object->montant = $debit; // deprecated
$object->amount = $debit;
$object->sens = 'D';
}
if (floatval($credit) != 0.0) {
$object->montant = $credit;
$object->montant = $credit; // deprecated
$object->amount = $credit;
$object->sens = 'C';
}
@ -173,12 +175,14 @@ if ($action == "confirm_update") {
$object->fk_docdet = (int) GETPOST('fk_docdet', 'int');
if (floatval($debit) != 0.0) {
$object->montant = $debit;
$object->montant = $debit; // deprecated
$object->amount = $debit;
$object->sens = 'D';
}
if (floatval($credit) != 0.0) {
$object->montant = $credit;
$object->montant = $credit; // deprecated
$object->amount = $credit;
$object->sens = 'C';
}
@ -241,7 +245,8 @@ if ($action == "confirm_update") {
$object->journal_label = $journal_label;
$object->fk_doc = 0;
$object->fk_docdet = 0;
$object->montant = 0;
$object->montant = 0; // deprecated
$object->amount = 0;
$result = $object->createStd($user, 0, $mode);
if ($result < 0) {

View File

@ -412,7 +412,7 @@ $sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.montant,";
$sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
@ -860,7 +860,8 @@ while ($i < min($num, $limit))
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->montant;
$line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->fk_user_author = $obj->fk_user_author;

View File

@ -1074,7 +1074,7 @@ class AccountancyExport
print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead
// MONT
print price(abs($line->montant), 0, '', 1, 2).$separator;
print price(abs($line->montant), 0, '', 1, 2, 2).$separator;
// CODC
print $line->sens.$separator;
// CPTG

View File

@ -129,9 +129,15 @@ class BookKeeping extends CommonObject
/**
* @var float FEC:Amount (Not necessary)
* @deprecated Use $amount
*/
public $montant;
/**
* @var float FEC:Amount (Not necessary)
*/
public $amount;
/**
* @var string FEC:Sens (Not necessary)
*/
@ -1124,7 +1130,7 @@ class BookKeeping extends CommonObject
*
* @param User $user User that modifies
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @param string $mode Mode
* @param string $mode Mode ('' or _tmp')
* @return int <0 if KO, >0 if OK
*/
public function update(User $user, $notrigger = false, $mode = '')
@ -1251,12 +1257,12 @@ class BookKeeping extends CommonObject
}
/**
* Update movement
* Update accounting movement
*
* @param string $piece_num Piece num
* @param string $field Field
* @param string $value Value
* @param string $mode Mode
* @param string $mode Mode ('' or _tmp')
* @return number <0 if KO, >0 if OK
*/
public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '')
@ -1265,9 +1271,9 @@ class BookKeeping extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode." as ab";
$sql .= ' SET ab.'.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'");
$sql .= ' WHERE ab.piece_num='.$piece_num;
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= ' SET '.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'");
$sql .= " WHERE piece_num = '".$this->db->escape($piece_num)."'";
$resql = $this->db->query($sql);
if (!$resql) {

View File

@ -34,8 +34,8 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$codeventil = GETPOST('codeventil');
$id = GETPOST('id');
$codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
if ($user->socid > 0)

View File

@ -38,8 +38,8 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$codeventil = GETPOST('codeventil');
$id = GETPOST('id');
$codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
if ($user->socid > 0)

View File

@ -38,8 +38,8 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$codeventil = GETPOST('codeventil');
$id = GETPOST('id');
$codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
if ($user->socid > 0)

View File

@ -889,7 +889,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
// EMail
print '<tr><td>'.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
// Address
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
@ -922,13 +923,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Pro phone
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td></tr>';
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td></tr>';
// Personal phone
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
// Mobile phone
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>';
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile').' <input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
@ -1122,7 +1126,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
// EMail
print '<tr><td>'.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"]) ?GETPOST("member_email", '', 2) : $object->email).'"></td></tr>';
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"]) ?GETPOST("member_email", '', 2) : $object->email).'"></td></tr>';
// Address
print '<tr><td>'.$langs->trans("Address").'</td><td>';
@ -1151,13 +1156,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Pro phone
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOSTISSET("phone") ? GETPOST("phone") : $object->phone).'"></td></tr>';
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" value="'.(GETPOSTISSET("phone") ? GETPOST("phone") : $object->phone).'"></td></tr>';
// Personal phone
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET("phone_perso") ? GETPOST("phone_perso") : $object->phone_perso).'"></td></tr>';
print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone_perso" value="'.(GETPOSTISSET("phone_perso") ? GETPOST("phone_perso") : $object->phone_perso).'"></td></tr>';
// Mobile phone
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile').' <input type="text" name="phone_mobile" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {

View File

@ -2747,7 +2747,7 @@ class Adherent extends CommonObject
$actioncomm->datef = $now;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $adherent->thirdparty->id;
$actioncomm->contactid = 0;
$actioncomm->contact_id = 0;
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is en email (content should be added into note)

View File

@ -99,7 +99,7 @@ class Subscription extends CommonObject
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'datef' =>array('type'=>'date', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'datef' =>array('type'=>'datetime', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1),
'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'note' =>array('type'=>'text', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50),

View File

@ -149,7 +149,10 @@ elseif ($action == 'setdoc')
$draft = GETPOST('CONTRACT_DRAFT_WATERMARK', 'alpha');
$res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res1 > 0 || !$res2 > 0) $error++;
$value = GETPOST('activate_hideClosedServiceByDefault', 'alpha');
$res3 = dolibarr_set_const($db, "CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value, 'chaine', 0, '', $conf->entity);
if (!$res1 > 0 || !$res2 > 0 || !$res3 > 0) $error++;
if (!$error)
{
@ -470,6 +473,13 @@ print '</td><td>';
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
print '</td></tr>'."\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HideClosedServiceByDefault").'</td>';
print '<td width="60" class="right">';
print $form->selectyesno("activate_hideClosedServiceByDefault", (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT)?$conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT:0), 1);
print '</td>';
print '</tr>';
print '</table>';
print '<div class="center">';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.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
@ -322,18 +322,18 @@ if ($conf->use_javascript_ajax)
$entry = '<table class="nobordernopadding centpercent"><tr><td>';
$entry .= '<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>';
$entry .= '</td><td class="right">';
$entry .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
$entry .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
$entry .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
$entry .= '<a class="editfielda marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
$entry .= '<a class="marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
$entry .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
$entry .= '&nbsp; &nbsp; &nbsp;';
$entry .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
$entry .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
$entry .= '</td></tr></table>';
$buttons = '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
$buttons .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
$buttons .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
$buttons = '<a class="editfielda marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
$buttons .= '<a class="marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
$buttons .= '&nbsp; &nbsp; &nbsp;';
$buttons .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
$data[] = array(
'rowid'=>$menu['rowid'],

View File

@ -256,7 +256,8 @@ if ($mode == 'config' && $user->admin) {
print '<input type="hidden" name="action" value="updateprinter">';
}
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
print $langs->trans("ReceiptPrinterDesc")."<br><br>\n";
@ -342,11 +343,11 @@ if ($mode == 'config' && $user->admin) {
}
print '</form>';
print '<div><p></div>';
print '<br>';
dol_fiche_head();
print $langs->trans("ReceiptPrinterTypeDesc")."<br><br>\n";
print load_fiche_titre($langs->trans("ReceiptPrinterTypeDesc"), '', '')."\n";
print '<table class="noborder centpercent">'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
@ -354,12 +355,12 @@ if ($mode == 'config' && $user->admin) {
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_CUPS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();
print '<div><p></div>';
print '<br>';
print load_fiche_titre($langs->trans("ReceiptPrinterProfileDesc"), '', '')."\n";
dol_fiche_head();
print $langs->trans("ReceiptPrinterProfileDesc")."<br><br>\n";
print '<table class="noborder centpercent">'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
@ -367,7 +368,6 @@ if ($mode == 'config' && $user->admin) {
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();
}
if ($mode == 'template' && $user->admin) {
@ -379,9 +379,9 @@ if ($mode == 'template' && $user->admin) {
print '<input type="hidden" name="action" value="updatetemplate">';
}
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
print $langs->trans("ReceiptPrinterTemplateDesc")."<br><br>\n";
print load_fiche_titre($langs->trans("ReceiptPrinterTemplateDesc"), '', '')."<br><br>\n";
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
@ -408,15 +408,15 @@ if ($mode == 'template' && $user->admin) {
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
// edit icon
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=edittemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
print '<td><a class="editfielda paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=edittemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
print img_picto($langs->trans("Edit"), 'edit');
print '</a>';
// delete icon
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=deletetemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=deletetemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print img_picto($langs->trans("Delete"), 'delete');
print '</a>';
// test icon
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=testtemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=testtemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
print '</a></td>';
}
@ -437,21 +437,22 @@ if ($mode == 'template' && $user->admin) {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
}
print '</form>';
print '<div><p></div>';
print '<br>';
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Tag").'</th>';
print '<th>'.$langs->trans("Description").'</th>';
print "</tr>\n";
$max = count($printer->tags);
for ($tag = 0; $tag < $max; $tag++) {
$langs->loadLangs(array("bills", "companies"));
foreach ($printer->tags as $key => $val) {
print '<tr class="oddeven">';
print '<td>&lt;'.$printer->tags[$tag].'&gt;</td><td>'.$langs->trans(strtoupper($printer->tags[$tag])).'</td>';
print '<td>&lt;'.$key.'&gt;</td><td>'.$langs->trans($val).'</td>';
print '</tr>';
}
print '</table>';
dol_fiche_end();
}
// End of page

View File

@ -530,13 +530,6 @@ if (!in_array($conf->browser->name, array('chrome', 'opera', 'safari', 'firefox'
}
print '<br>';
// Database statistics update
/*
print '<br>';
print '<strong>'.$langs->trans("DatabaseStatistics").'</strong>: ';
print '<br>';
*/
// End of page
llxFooter();
$db->close();

View File

@ -608,6 +608,12 @@ class Documents extends DolibarrApi
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$object = new ExpenseReport($this->db);
}
elseif ($modulepart == 'adherent' || $modulepart == 'member')
{
$modulepart = 'adherent';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$object = new Adherent($this->db);
}
// TODO Implement additional moduleparts
else
{
@ -652,6 +658,7 @@ class Documents extends DolibarrApi
else
{
if ($modulepart == 'invoice') $modulepart = 'facture';
if ($modulepart == 'member') $modulepart = 'adherent';
$relativefile = $subdir;

View File

@ -32,6 +32,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
if (!defined("NOSESSION")) define("NOSESSION", '1');
// Force entity if a value is provided into HTTP header. Otherwise, will use the entity of user of token used.
@ -72,7 +73,8 @@ if (empty($conf->global->MAIN_MODULE_API))
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
print $langs->trans("ToActivateModule");
exit;
//session_destroy();
exit(0);
}
// Test if explorer is not disabled
@ -81,7 +83,8 @@ if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API
$langs->load("admin");
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
exit;
//session_destroy();
exit(0);
}
@ -138,7 +141,7 @@ if (!empty($conf->global->API_RESTRICT_ON_IP))
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
print 'APIs are not allowed from the IP '.$ipremote;
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
//print $conf->global->API_RESTRICT_ON_IP;
//session_destroy();
exit(0);
}
}
@ -232,19 +235,19 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
$regbis = array();
if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root')))
{
$module = $reg[1];
if ($module == 'explorer') // If we call page to explore details of a service
$moduleobject = $reg[1];
if ($moduleobject == 'explorer') // If we call page to explore details of a service
{
$module = $regbis[2];
$moduleobject = $regbis[2];
}
$module = strtolower($module);
$moduledirforclass = getModuleDirForApiClass($module);
$moduleobject = strtolower($moduleobject);
$moduledirforclass = getModuleDirForApiClass($moduleobject);
// Load a dedicated API file
dol_syslog("Load a dedicated API file module=".$module." moduledirforclass=".$moduledirforclass);
dol_syslog("Load a dedicated API file moduleobject=".$moduleobject." moduledirforclass=".$moduledirforclass);
$tmpmodule = $module;
$tmpmodule = $moduleobject;
if ($tmpmodule != 'api')
$tmpmodule = preg_replace('/api$/i', '', $tmpmodule);
$classfile = str_replace('_', '', $tmpmodule);
@ -261,7 +264,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php', 0, 2);
$classname = ucwords($module);
$classname = ucwords($moduleobject);
dol_syslog('Search api file /'.$moduledirforclass.'/class/api_'.$classfile.'.class.php => dir_part_file='.$dir_part_file.' classname='.$classname);
@ -272,6 +275,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
dol_syslog('Failed to make include_once '.$dir_part_file, LOG_WARNING);
print 'API not found (failed to include API file)';
header('HTTP/1.1 501 API not found (failed to include API file)');
//session_destroy();
exit(0);
}
@ -279,9 +283,16 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
$api->r->addAPIClass($classname);
}
//var_dump($api->r->apiVersionMap);
//exit;
// Call API (we suppose we found it).
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
//Luracast\Restler\Defaults::$returnResponse = true;
//print $api->r->handle();
$api->r->handle();
//session_destroy();

View File

@ -184,7 +184,7 @@ llxHeader('', $langs->trans("MassBarcodeInit"));
print load_fiche_titre($langs->trans("MassBarcodeInit"), '', 'title_setup.png');
print '<br>';
print $langs->trans("MassBarcodeInitDesc").'<br>';
print '<span class="opacitymedium">'.$langs->trans("MassBarcodeInitDesc").'</span><br>';
print '<br>';
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
@ -302,6 +302,12 @@ if ($conf->product->enabled || $conf->product->service)
}
print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'generic');
print '<br>'."\n";
print $langs->trans("ClickHereToGoTo").' : <a href="'.DOL_URL_ROOT.'/barcode/printsheet.php">'.$langs->trans("BarCodePrintsheet").'</a>';
print '</form>';
print '<br>';

View File

@ -265,7 +265,7 @@ llxHeader('', $langs->trans("BarCodePrintsheet"));
print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'barcode');
print '<br>';
print $langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'<br>';
print '<span class="opacitymedium">'.$langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'</span><br>';
print '<br>';
dol_htmloutput_errors($mesg);

View File

@ -46,7 +46,7 @@ function blockedlogadmin_prepare_head()
$b = new BlockedLog($db);
if ($b->alreadyUsed())
{
$head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>';
$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">...</span>' : '');
}
$head[$h][2] = 'fingerprints';
$h++;

View File

@ -24,11 +24,11 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
/**
* \file bom/class/api_boms.class.php
* \ingroup bom
* \brief File for API management of bom.
* \brief File for API management of BOM.
*/
/**
* API class for bom
* API class for BOM
*
* @access protected
* @class DolibarrApiAccess {@requires user,external}
@ -120,7 +120,7 @@ class Boms extends DolibarrApi
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity('bom').')';
if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')';
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
if ($restrictonsocid && $socid) $sql .= " AND t.fk_soc = ".$socid;
if ($restrictonsocid && $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale

View File

@ -90,7 +90,7 @@ function bomPrepareHead($object)
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
$head[$h][2] = 'note';
$h++;
}
@ -102,7 +102,7 @@ function bomPrepareHead($object)
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>' : '');
$head[$h][2] = 'document';
$h++;

View File

@ -45,7 +45,7 @@ if (isset($_SESSION['serObjFacturation']))
$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart']
$total_ttc = $obj_facturation->prixTotalTtc();
$total_ttc = $obj_facturation->amountWithTax();
/*var_dump($obj_facturation);
var_dump($_SESSION['poscart']);

View File

@ -140,7 +140,7 @@ class Facturation
$remise_percent = 0;
}
$montant_remise_ht = ($resultarray[6] - $resultarray[0]);
$this->montantRemise($montant_remise_ht);
$this->amountDiscount($montant_remise_ht);
$newcartarray = $_SESSION['poscart'];
@ -256,7 +256,7 @@ class Facturation
$this->qte('RESET');
$this->stock('RESET');
$this->remisePercent('RESET');
$this->montantRemise('RESET');
$this->amountDiscount('RESET');
$this->prix('RESET');
$this->tva('RESET');
}
@ -270,13 +270,13 @@ class Facturation
{
$this->numInvoice('RESET');
$this->getSetPaymentMode('RESET');
$this->montantEncaisse('RESET');
$this->montantRendu('RESET');
$this->amountCollected('RESET');
$this->amountReturned('RESET');
$this->paiementLe('RESET');
$this->prixTotalHt('RESET');
$this->montantTva('RESET');
$this->prixTotalTtc('RESET');
$this->amountWithoutTax('RESET');
$this->amountVat('RESET');
$this->amountWithTax('RESET');
}
@ -387,7 +387,7 @@ class Facturation
* @param int $aMontantRemise Amount
* @return string Amount
*/
public function montantRemise($aMontantRemise = null)
public function amountDiscount($aMontantRemise = null)
{
if (is_null($aMontantRemise)) {
@ -475,7 +475,7 @@ class Facturation
* @param int $aMontantEncaisse Amount
* @return int Amount
*/
public function montantEncaisse($aMontantEncaisse = null)
public function amountCollected($aMontantEncaisse = null)
{
if (is_null($aMontantEncaisse)) {
@ -493,7 +493,7 @@ class Facturation
* @param int $aMontantRendu Amount
* @return int Amount
*/
public function montantRendu($aMontantRendu = null)
public function amountReturned($aMontantRendu = null)
{
if (is_null($aMontantRendu)) {
@ -528,7 +528,7 @@ class Facturation
* @param int $aTotalHt Total amount
* @return int Total amount
*/
public function prixTotalHt($aTotalHt = null)
public function amountWithoutTax($aTotalHt = null)
{
if (is_null($aTotalHt)) {
return $this->prix_total_ht;
@ -545,7 +545,7 @@ class Facturation
* @param int $aMontantTva Amount vat
* @return int Amount vat
*/
public function montantTva($aMontantTva = null)
public function amountVat($aMontantTva = null)
{
if (is_null($aMontantTva)) {
return $this->montant_tva;
@ -562,7 +562,7 @@ class Facturation
* @param int $aTotalTtc Amount ttc
* @return int Amount ttc
*/
public function prixTotalTtc($aTotalTtc = null)
public function amountWithTax($aTotalTtc = null)
{
if (is_null($aTotalTtc))
{

View File

@ -145,8 +145,8 @@ $i = 0;
// Reinitialisation du mode de paiement, en cas de retour aux achats apres validation
$obj_facturation->getSetPaymentMode('RESET');
$obj_facturation->montantEncaisse('RESET');
$obj_facturation->montantRendu('RESET');
$obj_facturation->amountCollected('RESET');
$obj_facturation->amountReturned('RESET');
$obj_facturation->paiementLe('RESET');

View File

@ -149,7 +149,7 @@ for ($i = 0; $i < $nbtoshow; $i++)
<tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr>
<tr>
<!-- Affichage du montant du -->
<td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prixTotalTtc(), 'MT'); ?>" disabled /></td>
<td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->amountWithTax(), 'MT'); ?>" disabled /></td>
<!-- Choix du montant encaisse -->
<td><input class="texte2 maxwidth100onsmartphone" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtEncaisse", "frmDifference"); ?>

View File

@ -102,13 +102,13 @@ $object->fetch($facid);
<table class="totaux">
<tr>
<th class="nowrap"><?php echo $langs->trans("TotalHT"); ?></th>
<td class="nowrap"><?php echo price(price2num($obj_facturation->prixTotalHt(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
<td class="nowrap"><?php echo price(price2num($obj_facturation->amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
<tr>
<th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->montantTva(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
<th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
<tr>
<th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->prixTotalTtc(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
<th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
</table>

View File

@ -35,16 +35,16 @@ $langs->loadLangs(array("main", "bills", "banks"));
<table class="table_resume">
<tr><td class="resume_label"><?php echo $langs->trans("Invoice"); ?></td><td><?php echo $obj_facturation->numInvoice(); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("TotalHT"); ?></td><td><?php echo price(price2num($obj_facturation->prixTotalHt(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("TotalHT"); ?></td><td><?php echo price(price2num($obj_facturation->amountWithoutTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<?php
// Affichage de la tva par taux
if ($obj_facturation->montantTva()) {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.price(price2num($obj_facturation->montantTva(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
if ($obj_facturation->amountVat()) {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.price(price2num($obj_facturation->amountVat(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
} else {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.$langs->trans("NoVAT").'</td></tr>');
}
?>
<tr><td class="resume_label"><?php echo $langs->trans("TotalTTC"); ?> </td><td><?php echo price(price2num($obj_facturation->prixTotalTtc(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("TotalTTC"); ?> </td><td><?php echo price(price2num($obj_facturation->amountWithTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("PaymentMode"); ?> </td><td>
<?php
switch ($obj_facturation->getSetPaymentMode())
@ -85,12 +85,12 @@ if ($obj_facturation->montantTva()) {
if ($obj_facturation->getsetPaymentMode() == 'DIF') {
echo ('<tr><td class="resume_label">'.$langs->trans("DateDue").'</td><td>'.$obj_facturation->paiementLe().'</td></tr>');
} else {
echo ('<tr><td class="resume_label">'.$langs->trans("Received").'</td><td>'.price(price2num($obj_facturation->montantEncaisse(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
echo ('<tr><td class="resume_label">'.$langs->trans("Received").'</td><td>'.price(price2num($obj_facturation->amountCollected(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
// Affichage du montant rendu (reglement en especes)
if ($obj_facturation->montantRendu()) {
echo ('<tr><td class="resume_label">'.$langs->trans("Change").'</td><td>'.price(price2num($obj_facturation->montantRendu(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
if ($obj_facturation->amountReturned()) {
echo ('<tr><td class="resume_label">'.$langs->trans("Change").'</td><td>'.price(price2num($obj_facturation->amountReturned(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
?>

View File

@ -83,19 +83,19 @@ switch ($action)
// Si paiement autre qu'en especes, montant encaisse = prix total
$mode_reglement = $obj_facturation->getSetPaymentMode();
if ($mode_reglement != 'ESP') {
$montant = $obj_facturation->prixTotalTtc();
$montant = $obj_facturation->amountWithTax();
} else {
$montant = $_POST['txtEncaisse'];
}
if ($mode_reglement != 'DIF') {
$obj_facturation->montantEncaisse($montant);
$obj_facturation->amountCollected($montant);
//Determination de la somme rendue
$total = $obj_facturation->prixTotalTtc();
$encaisse = $obj_facturation->montantEncaisse();
$total = $obj_facturation->amountWithTax();
$encaisse = $obj_facturation->amountCollected();
$obj_facturation->montantRendu($encaisse - $total);
$obj_facturation->amountReturned($encaisse - $total);
} else {
//$txtDatePaiement=$_POST['txtDatePaiement'];
$datePaiement = dol_mktime(0, 0, 0, $_POST['txtDatePaiementmonth'], $_POST['txtDatePaiementday'], $_POST['txtDatePaiementyear']);
@ -137,8 +137,8 @@ switch ($action)
$mode_reglement_id = dol_getIdFromCode($db, 'LIQ', 'c_paiement', 'code', 'id', 1);
$cond_reglement_id = 0;
$note .= $langs->trans("Cash")."\n";
$note .= $langs->trans("Received").' : '.$obj_facturation->montantEncaisse()." ".$conf->currency."\n";
$note .= $langs->trans("Rendu").' : '.$obj_facturation->montantRendu()." ".$conf->currency."\n";
$note .= $langs->trans("Received").' : '.$obj_facturation->amountCollected()." ".$conf->currency."\n";
$note .= $langs->trans("Rendu").' : '.$obj_facturation->amountReturned()." ".$conf->currency."\n";
$note .= "\n";
$note .= '--------------------------------------'."\n\n";
break;
@ -207,9 +207,9 @@ switch ($action)
$invoice->date_creation = $now;
$invoice->date = $now;
$invoice->date_lim_reglement = 0;
$invoice->total_ht = $obj_facturation->prixTotalHt();
$invoice->total_tva = $obj_facturation->montantTva();
$invoice->total_ttc = $obj_facturation->prixTotalTtc();
$invoice->total_ht = $obj_facturation->amountWithoutTax();
$invoice->total_tva = $obj_facturation->amountVat();
$invoice->total_ttc = $obj_facturation->amountWithTax();
$invoice->note_private = $note;
$invoice->cond_reglement_id = $cond_reglement_id;
$invoice->mode_reglement_id = $mode_reglement_id;
@ -295,7 +295,7 @@ switch ($action)
$payment = new Paiement($db);
$payment->datepaye = $now;
$payment->bank_account = $conf_fkaccount;
$payment->amounts[$invoice->id] = $obj_facturation->prixTotalTtc();
$payment->amounts[$invoice->id] = $obj_facturation->amountWithTax();
$payment->note = $langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice();
$payment->paiementid = $invoice->mode_reglement_id;
$payment->num_paiement = '';
@ -316,7 +316,7 @@ switch ($action)
if (!$error)
{
if ($invoice->total_ttc == $obj_facturation->prixTotalTtc()
if ($invoice->total_ttc == $obj_facturation->amountWithTax()
&& $obj_facturation->getSetPaymentMode() != 'DIFF')
{
// We set status to payed

View File

@ -1347,7 +1347,7 @@ class Categorie extends CommonObject
* separated by $sep (" >> " by default)
*
* @param string $sep Separator
* @param string $url Url
* @param string $url Url ('', 'none' or 'urltouse')
* @param int $nocolor 0
* @param string $addpicto Add picto into link
* @return array
@ -1381,13 +1381,16 @@ class Categorie extends CommonObject
}
}
if ($url == '')
{
if ($url == '') {
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$cat->id.'&type='.$cat->type.'" class="'.$forced_color.'">';
$linkend = '</a>';
$w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
} elseif ($url == 'none') {
$link = '<span class="'.$forced_color.'">';
$linkend = '</span>';
$w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
} else {
$w[] = "<a href='".DOL_URL_ROOT."/".$url."?catid=".$cat->id."'>".($addpicto ? img_object('', 'category') : '').$cat->label."</a>";
$w[] = '<a class="'.$forced_color.'" href="'.DOL_URL_ROOT.'/'.$url.'?catid='.$cat->id.'">'.($addpicto ? img_object('', 'category') : '').$cat->label.'</a>';
}
}
$newcategwithpath = preg_replace('/toreplace/', $forced_color, implode($sep, $w));

View File

@ -177,7 +177,7 @@ if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes')
//$object->fetch($id);
if (!empty($object->socpeopleassigned)) {
reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned);
$object->contact_id = key($object->socpeopleassigned);
}
$result = $object->createFromClone($user, GETPOST('socid', 'int'));
if ($result > 0) {
@ -350,7 +350,7 @@ if (empty($reshook) && $action == 'add')
if (!empty($object->socpeopleassigned))
{
reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned);
$object->contact_id = key($object->socpeopleassigned);
}
// Fill array 'array_options' with data from add form
@ -445,10 +445,10 @@ if (empty($reshook) && $action == 'update')
$socpeopleassigned = GETPOST("socpeopleassigned", 'array');
$object->socpeopleassigned = array();
foreach ($socpeopleassigned as $cid) $object->socpeopleassigned[$cid] = array('id' => $cid);
$object->contactid = GETPOST("contactid", 'int');
if (empty($object->contactid) && !empty($object->socpeopleassigned)) {
$object->contact_id = GETPOST("contactid", 'int');
if (empty($object->contact_id) && !empty($object->socpeopleassigned)) {
reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned);
$object->contact_id = key($object->socpeopleassigned);
}
$object->fk_project = GETPOST("projectid", 'int');
$object->note_private = GETPOST("note", "none");
@ -792,6 +792,7 @@ if ($action == 'create')
}
setdatefields();
$("#fullday").change(function() {
console.log("setdatefields");
setdatefields();
});
$("#selectcomplete").change(function() {
@ -846,9 +847,7 @@ if ($action == 'create')
if (GETPOST('datep', 'int', 1)) $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0);
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldayend');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart'); // Empty value not allowed for start date and hours if "todo"
} else {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart');
}
@ -863,11 +862,9 @@ if ($action == 'create')
}
print '<tr><td><span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span></td><td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
}
print '</td></tr>';
@ -1156,7 +1153,7 @@ if ($id > 0)
$object->socid = GETPOST("socid", "int");
$socpeopleassigned = GETPOST("socpeopleassigned", 'array');
foreach ($socpeopleassigned as $tmpid) $object->socpeopleassigned[$id] = array('id' => $tmpid);
$object->contactid = GETPOST("contactid", 'int');
$object->contact_id = GETPOST("contactid", 'int');
$object->fk_project = GETPOST("projectid", 'int');
$object_private = GETPOST("note", 'none');

View File

@ -492,7 +492,7 @@ class ActionComm extends CommonObject
$sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", ";
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", ";
$sql .= " '".$this->db->escape($this->note_private)."', ";
$sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", ";
$sql .= ((isset($this->contact_id) && $this->contact_id > 0) ? $this->contact_id : "null").", ";
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
$sql .= ($userdoneid > 0 ? $userdoneid : "null").", ";
@ -758,7 +758,7 @@ class ActionComm extends CommonObject
$this->transparency = $obj->transparency;
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->contactid = $obj->fk_contact; // To have fetch_contact method working
$this->contact_id = $obj->fk_contact; // To have fetch_contact method working
$this->fk_project = $obj->fk_project; // To have fetch_projet method working
//$this->societe->id = $obj->fk_soc; // deprecated
@ -999,7 +999,7 @@ class ActionComm extends CommonObject
}
$socid = (($this->socid > 0) ? $this->socid : 0);
$contactid = (($this->contactid > 0) ? $this->contactid : 0);
$contactid = (($this->contact_id > 0) ? $this->contact_id : 0);
$userownerid = ($this->userownerid ? $this->userownerid : 0);
$userdoneid = ($this->userdoneid ? $this->userdoneid : 0);

View File

@ -247,7 +247,7 @@ class AgendaEvents extends DolibarrApi
throw new RestException(404, 'actioncomm not found');
}
if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) {
if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach ($request_data as $field => $value) {
@ -289,7 +289,7 @@ class AgendaEvents extends DolibarrApi
throw new RestException(404, 'Agenda Event not found');
}
if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) {
if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

View File

@ -440,7 +440,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
$s .= '</script>'."\n";
// Local calendar
$s .= '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
$s .= '<div class="nowrap inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
// External calendars
if (is_array($showextcals) && count($showextcals) > 0)
@ -1642,7 +1642,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
$thirdparty_id = ($event->thirdparty_id > 0 ? $event->thirdparty_id : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0));
$contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->cotact->id > 0) ? $event->contact->id : 0));
$contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0));
// If action related to company / contact
$linerelatedto = '';

View File

@ -469,7 +469,7 @@ if ($resql)
$event->fk_project = $obj->fk_project;
$event->socid = $obj->fk_soc;
$event->contactid = $obj->fk_contact;
$event->contact_id = $obj->fk_contact;
$event->fk_element = $obj->fk_element;
$event->elementtype = $obj->elementtype;
@ -880,15 +880,15 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
$cases1[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name;
}
if ($event->contactid > 0)
if ($event->contact_id > 0)
{
if (empty($cachecontacts[$event->contactid]))
if (empty($cachecontacts[$event->contact_id]))
{
$tmpcontact = new Contact($db);
$tmpcontact->fetch($event->contactid);
$cachecontacts[$event->contactid] = $tmpcontact;
$tmpcontact->fetch($event->contact_id);
$cachecontacts[$event->contact_id] = $tmpcontact;
}
$cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs);
$cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs);
}
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
@ -926,15 +926,15 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
$cases2[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name;
}
if ($event->contactid > 0)
if ($event->contact_id > 0)
{
if (empty($cachecontacts[$event->contactid]))
if (empty($cachecontacts[$event->contact_id]))
{
$tmpcontact = new Contact($db);
$tmpcontact->fetch($event->contactid);
$cachecontacts[$event->contactid] = $tmpcontact;
$tmpcontact->fetch($event->contact_id);
$cachecontacts[$event->contact_id] = $tmpcontact;
}
$cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs);
$cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs);
}
}
} else {

View File

@ -534,7 +534,7 @@ if ($resql)
$event->fk_project = $obj->fk_project;
$event->socid = $obj->fk_soc;
$event->contactid = $obj->fk_contact;
$event->contact_id = $obj->fk_contact;
$event->fk_element = $obj->fk_element;
$event->elementtype = $obj->elementtype;
@ -1071,15 +1071,15 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
$cases1[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name;
}
if ($event->contactid > 0)
if ($event->contact_id > 0)
{
if (empty($cachecontacts[$event->contactid]))
if (empty($cachecontacts[$event->contact_id]))
{
$tmpcontact = new Contact($db);
$tmpcontact->fetch($event->contactid);
$cachecontacts[$event->contactid] = $tmpcontact;
$tmpcontact->fetch($event->contact_id);
$cachecontacts[$event->contact_id] = $tmpcontact;
}
$cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs);
$cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs);
}
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
@ -1117,15 +1117,15 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
$cases2[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name;
}
if ($event->contactid > 0)
if ($event->contact_id > 0)
{
if (empty($cachecontacts[$event->contactid]))
if (empty($cachecontacts[$event->contact_id]))
{
$tmpcontact = new Contact($db);
$tmpcontact->fetch($event->contactid);
$cachecontacts[$event->contactid] = $tmpcontact;
$tmpcontact->fetch($event->contact_id);
$cachecontacts[$event->contact_id] = $tmpcontact;
}
$cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs);
$cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs);
}
}
} else {

View File

@ -86,6 +86,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('thirdpartycomm', 'globalcard'));
$now = dol_now();
/*
@ -189,6 +190,13 @@ if (empty($reshook))
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// Set sales representatives
if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer)
{
$object->fetch($id);
$result = $object->setSalesRep(GETPOST('commercial', 'array'));
}
if ($action == 'update_extras') {
$object->fetch($id);
@ -568,7 +576,7 @@ if ($object->id > 0)
// Lien recap
$boxstat .= '<div class="box">';
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
$boxstat .= '<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
{
@ -652,7 +660,6 @@ if ($object->id > 0)
print $boxstat;
$now = dol_now();
/*
* Latest proposals
@ -665,7 +672,7 @@ if ($object->id > 0)
$sql .= ", p.tva as total_tva";
$sql .= ", p.total as total_ttc";
$sql .= ", p.ref, p.ref_client, p.remise";
$sql .= ", p.datep as dp, p.fin_validite as datelimite";
$sql .= ", p.datep as dp, p.fin_validite as date_limit";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
$sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
$sql .= " AND s.rowid = ".$object->id;
@ -704,7 +711,7 @@ if ($object->id > 0)
$propal_static->total_tva = $objp->total_tva;
$propal_static->total_ttc = $objp->total_ttc;
print $propal_static->getNomUrl(1);
if (($db->jdate($objp->datelimite) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1) {
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
print " ".img_warning();
}
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
@ -882,11 +889,11 @@ if ($object->id > 0)
}
/*
* Latest linked contracts
* Latest contracts
*/
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
$sql .= " WHERE c.fk_soc = s.rowid ";
$sql .= " AND s.rowid = ".$object->id;
@ -905,7 +912,7 @@ if ($object->id > 0)
print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">';
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
//print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
print '</tr></table></td>';
@ -921,15 +928,24 @@ if ($object->id > 0)
$contrat->ref = $objp->ref ? $objp->ref : $objp->id;
$contrat->ref_customer = $objp->refcus;
$contrat->ref_supplier = $objp->refsup;
$contrat->statut = $objp->contract_status;
$contrat->fetch_lines();
$late = '';
foreach ($contrat->lines as $line) {
if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) {
if (($line->date_fin_validite + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late"));
}
}
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $contrat->getNomUrl(1, 12);
print $late;
print "</td>\n";
print '<td class="nowrap">'.dol_trunc($objp->refsup, 12)."</td>\n";
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dcon), 'day')."</td>\n";
//print '<td class="right" width="80px"><span title="'.$langs->trans("DateCreation").'">'.dol_print_date($db->jdate($objp->dc), 'day')."</span></td>\n";
print '<td class="right" width="80px"><span title="'.$langs->trans("DateContract").'">'.dol_print_date($db->jdate($objp->dcon), 'day')."</span></td>\n";
print '<td width="20">&nbsp;</td>';
print '<td class="nowraponall right">';
print $contrat->getLibStatut(4);

View File

@ -339,72 +339,6 @@ class FormAdvTargetEmailing extends Form
return $return;
}
/**
* Return combo list with customer categories
*
* @param string $htmlname Name of categorie
* @param array $selected_array value selected
* @return string HTML combo
*/
public function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array())
{
return $this->multiselectCategories($htmlname, $selected_array, 2);
}
/**
* Return combo list with customer contact
*
* @param string $htmlname Name of categorie
* @param array $selected_array value selected
* @return string HTML combo
*/
public function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array())
{
return $this->multiselectCategories($htmlname, $selected_array, 4);
}
/**
* Return combo list of categories
*
* @param string $htmlname Name of categorie
* @param array $selected_array Value selected
* @param int $type Type
* @return string HTML combo
*/
public function multiselectCategories($htmlname = '', $selected_array = array(), $type = 0)
{
global $conf, $langs, $user;
$langs->load("dict");
$options_array = array();
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE type=".$type;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$options_array[$obj->rowid] = $obj->label;
$i++;
}
}
} else {
dol_print_error($this->db);
}
return $this->advMultiselectarray($htmlname, $options_array, $selected_array);
}
/**
* Return a combo list to select emailing target selector
*

View File

@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
$id = GETPOST('id');
$id = GETPOST('id', 'int');
// Load translation files required by the page
$langs->load("mails");

View File

@ -347,7 +347,7 @@ if (empty($reshook))
$object->remise_percent = GETPOST('remise_percent');
$object->remise_absolue = GETPOST('remise_absolue');
$object->socid = GETPOST('socid', 'int');
$object->contactid = GETPOST('contactid', 'int');
$object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
@ -375,7 +375,7 @@ if (empty($reshook))
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
$object->contactid = GETPOST('contactid', 'int');
$object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated

View File

@ -1497,7 +1497,9 @@ class Propal extends CommonObject
$this->note = $obj->note_private; // TODO deprecated
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->statut = (int) $obj->fk_statut;
$this->status = (int) $obj->fk_statut;
$this->statut = $this->status; // deprecated
$this->statut_libelle = $obj->statut_label;
$this->datec = $this->db->jdate($obj->datec); // TODO deprecated

View File

@ -278,7 +278,7 @@ if (empty($reshook))
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address');
$object->contactid = GETPOST('contactid');
$object->contact_id = GETPOST('contactid');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');

View File

@ -1338,7 +1338,7 @@ class Commande extends CommonOrder
$this->shipping_method_id = $object->shipping_method_id;
$this->warehouse_id = $object->warehouse_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->contact_id = $object->contact_id;
$this->ref_client = $object->ref_client;
if (empty($conf->global->MAIN_DISABLE_PROPAGATE_NOTES_FROM_ORIGIN))

View File

@ -333,7 +333,6 @@ class Account extends CommonObject
public function __toString()
{
$string = '';
foreach ($this->getFieldsToShow() as $val) {
if ($val == 'BankCode') {
$string .= $this->code_banque.' ';
@ -1357,6 +1356,8 @@ class Account extends CommonObject
$label = '<u>'.$langs->trans("BankAccount").'</u>';
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
$label .= '<br><b>'.$langs->trans('AccountNumber').':</b> '.$this->number;
$label .= '<br><b>'.$langs->trans('IBAN').':</b> '.$this->iban;
$label .= '<br><b>'.$langs->trans('BIC').':</b> '.$this->bic;
$label .= '<br><b>'.$langs->trans("AccountCurrency").':</b> '.$this->currency_code;
if (empty($user->rights->banque->lire) || !empty($user->socid))

View File

@ -313,15 +313,23 @@ if (empty($reshook))
if (($tmp_total_ht < 0 || $tmp_total_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
{
$langs->load("errors");
if ($object->type == $object::TYPE_DEPOSIT) {
$langs->load("errors");
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
$error++;
$action = '';
} else {
setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate"), null, 'errors');
$tmpvatratetoshow = explode('_', $vatrate);
$tmpvatratetoshow[0] = round($tmpvatratetoshow[0], 2);
if ($tmpvatratetoshow[0] != 0) {
$langs->load("errors");
setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate", $tmpvatratetoshow[0]), null, 'errors');
$error++;
$action = '';
}
}
$error++;
$action = '';
}
}
}
@ -3417,10 +3425,19 @@ if ($action == 'create')
}
// Other attributes
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2');
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE)) {
// copy from thirdparty
$tpExtrafields = new Extrafields($db);
$tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element);
if ($soc->fetch_optionals() > 0) {
$object->array_options = array_merge($object->array_options, $soc->array_options);
}
};
print $object->showOptionals($extrafields, 'edit', $parameters);
}

View File

@ -199,9 +199,10 @@ class FactureRec extends CommonInvoice
*
* @param User $user User object
* @param int $facid Id of source invoice
* @param int $notrigger No trigger
* @return int <0 if KO, id of invoice created if OK
*/
public function create($user, $facid)
public function create($user, $facid, $notrigger = 0)
{
global $conf;
@ -221,7 +222,6 @@ class FactureRec extends CommonInvoice
$this->date_when = null;
}
$this->frequency = abs($this->frequency);
$this->nb_gen_done = 0;
$this->nb_gen_max = empty($this->nb_gen_max) ? 0 : $this->nb_gen_max;
@ -389,6 +389,26 @@ class FactureRec extends CommonInvoice
}
}
if (!$error) {
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (!$error && !$notrigger)
{
// Call trigger
$result = $this->call_trigger('BILLREC_CREATE', $user);
if ($result < 0)
{
$this->db->rollback();
return -2;
}
// End call triggers
}
if ($error)
{
$this->db->rollback();

View File

@ -1311,7 +1311,7 @@ class Facture extends CommonInvoice
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->fk_delivery_address = $object->fk_delivery_address; // deprecated
$this->contact_id = $object->contactid;
$this->contact_id = $object->contact_id;
$this->ref_client = $object->ref_client;
if (empty($conf->global->MAIN_DISABLE_PROPAGATE_NOTES_FROM_ORIGIN))
@ -3979,135 +3979,6 @@ class Facture extends CommonInvoice
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a withdrawal request for a standing order.
* Use the remain to pay excluding all existing open direct debit requests.
*
* @param User $fuser User asking the direct debit transfer
* @param float $amount Amount we request direct debit for
* @return int <0 if KO, >0 if OK
*/
public function demande_prelevement($fuser, $amount = 0)
{
// phpcs:enable
$error = 0;
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
if ($this->statut > self::STATUS_DRAFT && $this->paye == 0)
{
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $this->socid);
$sql = 'SELECT count(*)';
$sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' WHERE fk_facture = '.$this->id;
$sql .= ' AND traite = 0';
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
if ($row[0] == 0)
{
$now = dol_now();
$totalpaye = $this->getSommePaiement();
$totalcreditnotes = $this->getSumCreditNotesUsed();
$totaldeposits = $this->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
if (empty($amount)) $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
if (is_numeric($amount) && $amount != 0)
{
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($amount)."'";
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",".$fuser->id;
$sql .= ",'".$bac->code_banque."'";
$sql .= ",'".$bac->code_guichet."'";
$sql .= ",'".$bac->number."'";
$sql .= ",'".$bac->cle_rib."')";
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur');
$error++;
}
} else {
$this->error = 'WithdrawRequestErrorNilAmount';
dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount');
$error++;
}
if (!$error)
{
// Force payment mode of invoice to withdraw
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1);
if ($payment_mode_id > 0)
{
$result = $this->setPaymentMethods($payment_mode_id);
}
}
if ($error) return -1;
return 1;
} else {
$this->error = "A request already exists";
dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours');
return 0;
}
} else {
$this->error = $this->db->error();
dol_syslog(get_class($this).'::demandeprelevement Erreur -2');
return -2;
}
} else {
$this->error = "Status of invoice does not allow this";
dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id");
return -3;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Supprime une demande de prelevement
*
* @param User $fuser User making delete
* @param int $did id de la demande a supprimer
* @return int <0 if OK, >0 if KO
*/
public function demande_prelevement_delete($fuser, $did)
{
// phpcs:enable
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' WHERE rowid = '.$did;
$sql .= ' AND traite = 0';
if ($this->db->query($sql))
{
return 0;
} else {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error);
return -1;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)

View File

@ -376,7 +376,7 @@ if ($massaction == 'makepayment'){
foreach ($listofbills as $aBill)
{
$db->begin();
$result = $aBill->demande_prelevement($user, $aBill->resteapayer);
$result = $aBill->demande_prelevement($user, $aBill->resteapayer, 'direct-debit', 'facture');
if ($result > 0)
{
$db->commit();
@ -448,6 +448,7 @@ if (!$sall) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.f
if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture';
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid';
// We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($search_user > 0)
@ -455,7 +456,7 @@ if ($search_user > 0)
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
}
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid';
$sql .= ' WHERE f.fk_soc = s.rowid';
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -548,7 +549,8 @@ if (!$sall)
$sql .= ' typent.code,';
$sql .= ' state.code_departement, state.nom,';
$sql .= ' country.code,';
$sql .= " p.rowid, p.ref, p.title";
$sql .= " p.rowid, p.ref, p.title,";
$sql .= " u.login";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {

View File

@ -24,15 +24,19 @@
/**
* \file htdocs/compta/facture/prelevement.php
* \ingroup facture
* \brief Management of direct debit order of invoices
* \brief Management of direct debit order or credit tranfer of invoices
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
if (!$user->rights->facture->lire) accessforbidden();
@ -43,12 +47,18 @@ $id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); //
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'alpha');
$type = GETPOST('type', 'aZ09');
$mode = GETPOST('mode', 'aZ09');
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
$object = new Facture($db);
if ($mode == 'bank-transfer') {
$object = new FactureFournisseur($db);
} else {
$object = new Facture($db);
}
// Load object
if ($id > 0 || !empty($ref))
@ -80,7 +90,13 @@ if (empty($reshook))
{
$db->begin();
$result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount'));
$newtype = $type;
$sourcetype = 'facture';
if ($type == 'bank-transfer') {
$sourcetype = 'supplier_invoice';
}
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
if ($result > 0)
{
$db->commit();
@ -96,12 +112,12 @@ if (empty($reshook))
if ($action == "delete")
{
if ($object->id > 0)
if ($object->id > 0)
{
$result = $object->demande_prelevement_delete($user, GETPOST('did'));
$result = $object->demande_prelevement_delete($user, GETPOST('did', 'int'));
if ($result == 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&mode='.$mode);
exit;
}
}
@ -113,13 +129,20 @@ if (empty($reshook))
* View
*/
$form = new Form($db);
$now = dol_now();
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
if ($mode == 'bank-transfer') {
$title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer');
$helpurl = "";
} else {
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
}
llxHeader('', $title, $helpurl);
$form = new Form($db);
/* *************************************************************************** */
/* */
@ -145,18 +168,33 @@ if ($object->id > 0)
if ($object->paye) $resteapayer = 0;
$resteapayeraffiche = $resteapayer;
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
if ($mode == 'bank-transfer') {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
}
$absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount);
$absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote);
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
$absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
$absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote, 0, 1);
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
} else {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
$absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount);
$absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote);
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
}
$author = new User($db);
if ($object->user_author)
@ -164,20 +202,37 @@ if ($object->id > 0)
$author->fetch($object->user_author);
}
$head = facture_prepare_head($object);
if ($mode == 'bank-transfer') {
$head = facturefourn_prepare_head($object);
} else {
$head = facture_prepare_head($object);
}
dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'), -1, 'bill');
dol_fiche_head($head, 'standingorders', $title, -1, 'bill');
// Invoice content
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
if ($mode == 'bank-transfer') {
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
} else {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
}
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
if ($mode == 'bank-transfer') {
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
} else {
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
}
// Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
if ($mode == 'bank-transfer') {
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
} else {
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
}
// Project
if (!empty($conf->projet->enabled))
{
@ -194,6 +249,7 @@ if ($object->id > 0)
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= '<input type="hidden" name="type" value="'.$type.'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
@ -227,15 +283,26 @@ if ($object->id > 0)
// Type
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="3">';
print $object->getLibType();
if ($object->type == Facture::TYPE_REPLACEMENT)
if ($object->module_source) {
print ' <span class="opacitymediumbycolor">('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.')</span>';
}
if ($object->type == $object::TYPE_REPLACEMENT)
{
$facreplaced = new Facture($db);
if ($mode == 'bank-transfer') {
$facreplaced = new FactureFournisseur($db);
} else {
$facreplaced = new Facture($db);
}
$facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')';
}
if ($object->type == Facture::TYPE_CREDIT_NOTE)
if ($object->type == $object::TYPE_CREDIT_NOTE)
{
$facusing = new Facture($db);
if ($mode == 'bank-transfer') {
$facusing = new FactureFournisseur($db);
} else {
$facusing = new Facture($db);
}
$facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
}
@ -249,7 +316,11 @@ if ($object->id > 0)
{
if ($i == 0) print ' ';
else print ',';
$facavoir = new Facture($db);
if ($mode == 'bank-transfer') {
$facavoir = new FactureFournisseur($db);
} else {
$facavoir = new Facture($db);
}
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
@ -268,33 +339,48 @@ if ($object->id > 0)
// Discounts
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
$thirdparty = $object->thirdparty;
$discount_type = 0;
if ($mode == 'bank-transfer') {
//$societe = new Fournisseur($db);
//$result = $societe->fetch($object->socid);
$thirdparty = $object->thirdparty;
$discount_type = 1;
} else {
$thirdparty = $object->thirdparty;
$discount_type = 0;
}
$backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
$cannotApplyDiscount = 1;
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>';
// Label
if ($mode == 'bank-transfer') {
print '<tr>';
print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, 0).'</td>';
print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, 0).'</td>';
print '</tr>';
}
// Date invoice
print '<tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateInvoice');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($object->type != Facture::TYPE_CREDIT_NOTE)
if ($object->type != $object::TYPE_CREDIT_NOTE)
{
if ($action == 'editinvoicedate')
{
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate');
} else {
print dol_print_date($object->date, 'daytext');
print dol_print_date($object->date, 'day');
}
} else {
print dol_print_date($object->date, 'daytext');
print dol_print_date($object->date, 'day');
}
print '</td>';
print '</tr>';
@ -304,10 +390,10 @@ if ($object->id > 0)
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($object->type != Facture::TYPE_CREDIT_NOTE)
if ($object->type != $object::TYPE_CREDIT_NOTE)
{
if ($action == 'editconditions')
{
@ -325,16 +411,21 @@ if ($object->id > 0)
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateMaxPayment');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($object->type != Facture::TYPE_CREDIT_NOTE)
if ($object->type != $object::TYPE_CREDIT_NOTE)
{
$duedate = $object->date_lim_reglement;
if ($mode == 'bank-transfer') {
$duedate = $object->date_echeance;
}
if ($action == 'editpaymentterm')
{
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date_lim_reglement, 'paymentterm');
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm');
} else {
print dol_print_date($object->date_lim_reglement, 'daytext');
print dol_print_date($duedate, 'day');
if ($object->hasDelay()) {
print img_warning($langs->trans('Late'));
}
@ -378,8 +469,22 @@ if ($object->id > 0)
print "</td>";
print '</tr>';
print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="3">';
print $object->thirdparty->display_rib();
$title = 'CustomerIBAN';
if ($mode == 'bank-transfer') {
$title = 'SupplierIBAN';
}
print '<tr><td>'.$langs->trans($title).'</td><td colspan="3">';
$bac = new CompanyBankAccount($db);
$bac->fetch(0, $object->thirdparty->id);
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
if (!empty($bac->iban)) {
if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
} else {
print img_warning($langs->trans("NoDefaultIBANFound"));
}
print '</td></tr>';
print '</table>';
@ -475,8 +580,13 @@ if ($object->id > 0)
$sql .= " , pfd.date_traite as date_traite";
$sql .= " , pfd.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE fk_facture = ".$object->id;
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".$object->id;
} else {
$sql .= " WHERE fk_facture = ".$object->id;
}
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
@ -488,12 +598,17 @@ if ($object->id > 0)
dol_print_error($db);
}
// For wich amount ?
// For which amount ?
$sql = "SELECT SUM(pfd.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE fk_facture = ".$object->id;
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".$object->id;
} else {
$sql .= " WHERE fk_facture = ".$object->id;
}
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$result_sql = $db->query($sql);
if ($result_sql)
@ -511,8 +626,13 @@ if ($object->id > 0)
print "\n<div class=\"tabsAction\">\n";
$buttonlabel = $langs->trans("MakeWithdrawRequest");
if ($mode == 'bank-transfer') {
$buttonlabel = $langs->trans("MakeBankTransferOrder");
}
// Add a transfer request
if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0)
if ($object->statut > $object::STATUS_DRAFT && $object->paye == 0 && $num == 0)
{
if ($resteapayer > 0)
{
@ -521,31 +641,37 @@ if ($object->id > 0)
$remaintopaylesspendingdebit = $resteapayer - $pending;
print '<form method="POST" action="">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="id" value="'.$object->id.'" />';
print '<input type="hidden" name="action" value="new" />';
print '<label for="withdraw_request_amount">'.$langs->trans('WithdrawRequestAmount').' </label>';
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="10" />';
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
print '<label for="withdraw_request_amount">'.$langs->trans('BankTransferAmount').' </label>';
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
print '</form>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$buttonlabel.'</a>';
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$buttonlabel.'</a>';
}
} else {
if ($num == 0)
{
if ($object->statut > Facture::STATUS_DRAFT) print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
} else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
if ($object->statut > $object::STATUS_DRAFT) print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$buttonlabel.'</a>';
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$buttonlabel.'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$buttonlabel.'</a>';
}
}
print "</div><br>\n";
print '<div class="opacitymedium">'.$langs->trans("DoStandingOrdersBeforePayments").'</div><br>';
if ($mode == 'bank-transfer') {
print '<div class="opacitymedium">'.$langs->trans("DoCreditTransferBeforePayments").'</div><br>';
} else {
print '<div class="opacitymedium">'.$langs->trans("DoStandingOrdersBeforePayments").'</div><br>';
}
/*
* Withdrawals
@ -558,20 +684,29 @@ if ($object->id > 0)
print '<td class="left">'.$langs->trans("DateRequest").'</td>';
print '<td class="center">'.$langs->trans("User").'</td>';
print '<td class="center">'.$langs->trans("Amount").'</td>';
print '<td class="center">'.$langs->trans("WithdrawalReceipt").'</td>';
if ($mode == 'bank-transfer') {
print '<td class="center">'.$langs->trans("BankTransferReceipt").'</td>';
} else {
print '<td class="center">'.$langs->trans("WithdrawalReceipt").'</td>';
}
print '<td>&nbsp;</td>';
print '<td class="center">'.$langs->trans("DateProcess").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$sql .= " , pfd.date_traite as date_traite, pfd.amount,";
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
$sql .= " pfd.date_traite as date_traite, pfd.amount,";
$sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
$sql .= " WHERE fk_facture = ".$object->id;
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".$object->id;
} else {
$sql .= " WHERE fk_facture = ".$object->id;
}
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
@ -587,7 +722,7 @@ if ($object->id > 0)
$obj = $db->fetch_object($result_sql);
print '<tr class="oddeven">';
print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande), 'day')."</td>\n";
print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."</td>\n";
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a></td>';
print '<td class="center">'.price($obj->amount).'</td>';
print '<td align="center">-</td>';
@ -596,7 +731,7 @@ if ($object->id > 0)
print '<td class="center">'.$langs->trans("OrderWaiting").'</td>';
print '<td class="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=delete&amp;did='.$obj->rowid.'">';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&did='.$obj->rowid.'&mode='.$mode.'">';
print img_delete();
print '</a></td>';
@ -618,8 +753,13 @@ if ($object->id > 0)
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
$sql .= " WHERE fk_facture = ".$object->id;
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".$object->id;
} else {
$sql .= " WHERE fk_facture = ".$object->id;
}
$sql .= " AND pfd.traite = 1";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result = $db->query($sql);

View File

@ -68,9 +68,11 @@ class Paiement extends CommonObject
*/
public $montant;
public $amount; // Total amount of payment
public $amounts = array(); // Array of amounts
public $multicurrency_amounts = array(); // Array of amounts
public $amount; // Total amount of payment (in the main currency)
public $multicurrency_amount; // Total amount of payment (in the currency of the bank account)
public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)>
public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)>
public $author;
public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement
public $paiementcode; // Code of payment.
@ -159,7 +161,7 @@ class Paiement extends CommonObject
*/
public function fetch($id, $ref = '', $fk_bank = '')
{
$sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank,';
$sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank, p.multicurrency_amount,';
$sql .= ' c.code as type_code, c.libelle as type_label,';
$sql .= ' p.num_paiement as num_payment, p.note,';
$sql .= ' b.fk_account';
@ -179,6 +181,7 @@ class Paiement extends CommonObject
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->ref ? $obj->ref : $obj->rowid;
$this->date = $this->db->jdate($obj->dp);
@ -187,6 +190,7 @@ class Paiement extends CommonObject
$this->num_payment = $obj->num_payment;
$this->montant = $obj->amount; // deprecated
$this->amount = $obj->amount;
$this->multicurrency_amount = $obj->multicurrency_amount;
$this->note = $obj->note;
$this->type_label = $obj->type_label;
$this->type_code = $obj->type_code;
@ -494,8 +498,10 @@ class Paiement extends CommonObject
{
$accline = new AccountLine($this->db);
$result = $accline->fetch($bank_line_id);
if ($result == 0) $accline->rowid = $bank_line_id; // If not found, we set artificially rowid to allow delete of llx_bank_url
$result=$accline->fetch($bank_line_id);
if ($result == 0) {
$accline->id = $accline->rowid = $bank_line_id; // If not found, we set artificially rowid to allow delete of llx_bank_url
}
// Delete bank account url lines linked to payment
$result = $accline->delete_urls($user);

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'companies'));
$id = GETPOST('id');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');

View File

@ -78,13 +78,13 @@ print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToPayByBankTransfer").'</td>';
print '<td class="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer">';
print $bprev->nbOfInvoiceToPay('credit-transfer');
print $bprev->nbOfInvoiceToPay('bank-transfer');
print '</a>';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("AmountToWithdraw").'</td>';
print '<td class="right">';
print price($bprev->SommeAPrelever('credit-transfer'), '', '', 1, -1, -1, 'auto');
print price($bprev->SommeAPrelever('bank-transfer'), '', '', 1, -1, -1, 'auto');
print '</td></tr></table></div><br>';

View File

@ -174,35 +174,40 @@ if ($result)
$directdebitorder = new BonPrelevement($db);
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
if ($num) {
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$directdebitorder->id = $obj->rowid;
$directdebitorder->ref = $obj->ref;
$directdebitorder->datec = $obj->datec;
$directdebitorder->amount = $obj->amount;
$directdebitorder->statut = $obj->statut;
$directdebitorder->id = $obj->rowid;
$directdebitorder->ref = $obj->ref;
$directdebitorder->datec = $obj->datec;
$directdebitorder->amount = $obj->amount;
$directdebitorder->statut = $obj->statut;
print '<tr class="oddeven">';
print '<tr class="oddeven">';
print '<td>';
print $directdebitorder->getNomUrl(1);
print "</td>\n";
print '<td>';
print $directdebitorder->getNomUrl(1);
print "</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right">';
print $bon->LibStatut($obj->statut, 3);
print '</td>';
print '<td class="right">';
print $bon->LibStatut($obj->statut, 3);
print '</td>';
print '<td class="right"></td>'."\n";
print '<td class="right"></td>'."\n";
print "</tr>\n";
$i++;
print "</tr>\n";
$i++;
}
} else {
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
}
print "</table>";
print '</div>';

View File

@ -292,7 +292,7 @@ if ($id > 0 || $ref)
print $form->selectDate('', '', '', '', '', "infocredit", 1, 1);
print '</td></tr>';
print '</table>';
print '<br>'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice");
print '<br><div class="center"><span class="opacitymedium">'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice").'</span></div>';
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("ClassCredited")).'"></div>';
print '</form>';
print '<br>';
@ -405,13 +405,26 @@ if ($id > 0 || $ref)
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td>';
print '<td class="right">';
if ($obj->statut == 3)
{
print '<b>'.$langs->trans("StatusRefused").'</b>';
} else {
print "&nbsp;";
if ($object->statut == BonPrelevement::STATUS_CREDITED)
{
if ($obj->statut == 2) {
if ($user->rights->prelevement->bons->credit)
{
//print '<a class="butActionDelete" href="line.php?action=rejet&id='.$obj->rowid.'">'.$langs->trans("StandingOrderReject").'</a>';
print '<a href="line.php?action=rejet&id='.$obj->rowid.'">'.$langs->trans("StandingOrderReject").'</a>';
} else {
//print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("StandingOrderReject").'</a>';
}
}
} else {
//print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine").'">'.$langs->trans("StandingOrderReject").'</a>';
}
}
print '</td></tr>';

View File

@ -276,7 +276,7 @@ class BonPrelevement extends CommonObject
$sql .= ", p.method_trans, p.fk_user_trans";
$sql .= ", p.date_credit as date_credit";
$sql .= ", p.fk_user_credit";
$sql .= ", p.statut";
$sql .= ", p.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
if ($rowid > 0) $sql .= " AND p.rowid = ".$rowid;
@ -303,7 +303,8 @@ class BonPrelevement extends CommonObject
$this->date_credit = $this->db->jdate($obj->date_credit);
$this->user_credit = $obj->fk_user_credit;
$this->statut = $obj->statut;
$this->status = $obj->status;
$this->statut = $obj->status; // For backward compatibility
$this->fetched = 1;
@ -646,7 +647,7 @@ class BonPrelevement extends CommonObject
/**
* Returns amount of withdrawal
*
* @param string $mode 'direct-debit' or 'credit-transfer'
* @param string $mode 'direct-debit' or 'bank-transfer'
* @return double <O if KO, Total amount
*/
public function SommeAPrelever($mode = 'direct-debit')
@ -655,7 +656,7 @@ class BonPrelevement extends CommonObject
global $conf;
$sql = "SELECT sum(pfd.amount) as nb";
if ($mode != 'credit-transfer') {
if ($mode != 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
} else {
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
@ -688,7 +689,7 @@ class BonPrelevement extends CommonObject
/**
* Get number of invoices waiting for payment
*
* @param string $mode 'direct-debit' or 'credit-transfer'
* @param string $mode 'direct-debit' or 'bank-transfer'
* @return int <O if KO, number of invoices if OK
*/
public function nbOfInvoiceToPay($mode = 'direct-debit')
@ -700,7 +701,7 @@ class BonPrelevement extends CommonObject
/**
* Get number of invoices to withdrawal
*
* @param string $mode 'direct-debit' or 'credit-transfer'
* @param string $mode 'direct-debit' or 'bank-transfer'
* @return int <O if KO, number of invoices if OK
*/
public function NbFactureAPrelever($mode = 'direct-debit')
@ -709,7 +710,7 @@ class BonPrelevement extends CommonObject
global $conf;
$sql = "SELECT count(f.rowid) as nb";
if ($mode == 'credit-transfer') {
if ($mode == 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
} else {
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
@ -720,7 +721,7 @@ class BonPrelevement extends CommonObject
{
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
if ($mode == 'credit-transfer') {
if ($mode == 'bank-transfer') {
$sql .= " AND f.rowid = pfd.fk_facture_fourn";
} else {
$sql .= " AND f.rowid = pfd.fk_facture";

View File

@ -66,14 +66,14 @@ class LignePrelevement
/**
* Recupere l'objet prelevement
*
* @param int $rowid id de la facture a recuperer
* @return integer
* @param int $rowid Id de la facture a recuperer
* @return integer <0 if KO, >=0 if OK
*/
public function fetch($rowid)
{
global $conf;
$result = 0;
$error = 0;
$sql = "SELECT pl.rowid, pl.amount, p.ref, p.rowid as bon_rowid";
$sql .= ", pl.statut, pl.fk_soc";
@ -97,18 +97,18 @@ class LignePrelevement
$this->bon_ref = $obj->ref;
$this->bon_rowid = $obj->bon_rowid;
} else {
$result++;
$error++;
dol_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0");
}
$this->db->free($resql);
} else {
$result++;
$error++;
dol_syslog("LignePrelevement::Fetch rowid=$rowid");
dol_syslog($this->db->error());
}
return $result;
return $error;
}
/**

View File

@ -96,6 +96,9 @@ if (empty($reshook))
}
} else {
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id);
exit;
}
}
}
@ -138,8 +141,8 @@ print load_fiche_titre($title);
dol_fiche_head();
$nb = $bprev->NbFactureAPrelever();
$pricetowithdraw = $bprev->SommeAPrelever();
$nb = $bprev->nbOfInvoiceToPay($type);
$pricetowithdraw = $bprev->SommeAPrelever($type);
if ($nb < 0)
{
dol_print_error($bprev->error);
@ -151,7 +154,7 @@ if ($type == 'bank-transfer') {
$title = $langs->trans("NbOfInvoiceToPayByBankTransfer");
}
print '<tr><td class="titlefield">'.$title.'</td>';
print '<tr><td class="titlefieldcreate">'.$title.'</td>';
print '<td>';
print $nb;
print '</td></tr>';
@ -175,17 +178,32 @@ if ($nb) {
if ($pricetowithdraw) {
print $langs->trans('ExecutionDate').' ';
print $form->selectDate();
if ($mysoc->isInEEC()) {
$title = $langs->trans("CreateForSepa");
print '<select name="format"><option value="FRST">'.$langs->trans('SEPAFRST').'</option><option value="RCUR">'.$langs->trans('SEPARCUR').'</option></select>';
print '<input class="butAction" type="submit" value="'.$langs->trans("CreateForSepa").'"/>';
print '<input class="butAction" type="submit" value="'.$title.'"/>';
} else {
print '<a class="butAction" type="submit" href="create.php?action=create&format=ALL">'.$langs->trans("CreateAll")."</a>\n";
$title = $langs->trans("CreateAll");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
}
print '<a class="butAction" type="submit" href="create.php?action=create&format=ALL&type='.$type.'">'.$title."</a>\n";
}
} else {
if ($mysoc->isInEEC())
{
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaFRST")."</a>\n";
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaRCUR")."</a>\n";
$title = $langs->trans("CreateForSepaFRST");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
}
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
if ($type != 'bank-transfer') {
$title = $langs->trans("CreateForSepaRCUR");
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
}
} else {
$title = $langs->trans("CreateAll");
if ($type == 'bank-transfer') {
@ -195,7 +213,13 @@ if ($nb) {
}
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."</a>\n";
$titlefortab = $langs->transnoentitiesnoconv("StandingOrders");
$title = $langs->trans("CreateAll");
if ($type == 'bank-transfer') {
$titlefortab = $langs->transnoentitiesnoconv("PaymentByBankTransfers");
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
}
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $titlefortab, $titlefortab)).'">'.$title."</a>\n";
}
print "</form>\n";
@ -227,9 +251,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
$sql .= " AND f.total_ttc > 0";
$sql .= " AND pfd.traite = 0";
if ($type == 'bank-transfer') {
$sql .= " AND pfd.fk_facture = f.rowid";
} else {
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
} else {
$sql .= " AND pfd.fk_facture = f.rowid";
}
if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid;
@ -290,23 +314,29 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
$bac->fetch(0, $obj->socid);
print '<tr class="oddeven">';
// Ref invoice
print '<td>';
$invoicestatic->id = $obj->rowid;
$invoicestatic->ref = $obj->ref;
print $invoicestatic->getNomUrl(1, 'withdraw');
print '</td>';
// Thirdparty
print '<td>';
$thirdpartystatic->fetch($obj->socid);
print $thirdpartystatic->getNomUrl(1, 'ban');
print '</td>';
// RIB
print '<td>';
print $thirdpartystatic->display_rib();
$bac->fetch(0, $obj->socid);
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
print '</td>';
// RUM
print '<td>';
print $thirdpartystatic->display_rib('rum');

View File

@ -197,14 +197,14 @@ print '<table class="liste centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, 'class="right"');
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, 'class="center"');
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
print_liste_field_titre('');
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag($search_facture).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth150" name="search_facture" value="'.dol_escape_htmltag($search_facture).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth150" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column

View File

@ -38,7 +38,7 @@ $langs->loadLangs(array('banks', 'categories', 'companies', 'withdrawals', 'bill
if ($user->socid > 0) accessforbidden();
// Get supervariables
$prev_id = GETPOST('id', 'int');
$id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
@ -68,9 +68,9 @@ $thirdpartytmp = new Societe($db);
llxHeader('', $langs->trans("WithdrawalsReceipts"));
if ($prev_id > 0 || $ref)
if ($id > 0 || $ref)
{
if ($object->fetch($prev_id, $ref) >= 0)
if ($object->fetch($id, $ref) >= 0)
{
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
@ -181,7 +181,7 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
$param = "&amp;id=".$prev_id;
$param = "&id=".$id;
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -193,7 +193,7 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="id" value="'.$id.'">';
$massactionbutton = '';

View File

@ -118,11 +118,18 @@ if ($action == 'confirm_rejet')
$invoicestatic = new Facture($db);
llxHeader('', $langs->trans("StandingOrder"));
$title = $langs->trans("WithdrawalsLine");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransferLine");
}
llxHeader('', $title);
$head = array();
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id;
$head[$h][1] = $langs->trans("StandingOrder");
$head[$h][1] = $title;
$hselected = $h;
$h++;
@ -130,20 +137,24 @@ if ($id)
{
$lipre = new LignePrelevement($db);
if ($lipre->fetch($id) == 0)
if ($lipre->fetch($id) >= 0)
{
$bon = new BonPrelevement($db);
$bon->fetch($lipre->bon_rowid);
dol_fiche_head($head, $hselected, $langs->trans("StandingOrder"));
dol_fiche_head($head, $hselected, $title);
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
print '<tr><td width="20%">'.$langs->trans("WithdrawalsReceipts").'</td><td>';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $id.'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("WithdrawalsReceipts").'</td><td>';
print $bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec, 'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut, 1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut, 1).'</td></tr>';
if ($lipre->statut == 3)
{
@ -151,8 +162,8 @@ if ($id)
$resf = $rej->fetch($lipre->id);
if ($resf == 0)
{
print '<tr><td width="20%">'.$langs->trans("RefusedReason").'</td><td>'.$rej->motif.'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("RefusedData").'</td><td>';
print '<tr><td>'.$langs->trans("RefusedReason").'</td><td>'.$rej->motif.'</td></tr>';
print '<tr><td>'.$langs->trans("RefusedData").'</td><td>';
if ($rej->date_rejet == 0)
{
/* Historique pour certaines install */
@ -161,9 +172,9 @@ if ($id)
print dol_print_date($rej->date_rejet, 'day');
}
print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("RefusedInvoicing").'</td><td>'.$rej->invoicing.'</td></tr>';
print '<tr><td>'.$langs->trans("RefusedInvoicing").'</td><td>'.$rej->invoicing.'</td></tr>';
} else {
print '<tr><td width="20%">'.$resf.'</td></tr>';
print '<tr><td>'.$resf.'</td></tr>';
}
}
@ -185,7 +196,7 @@ if ($id)
print '<form name="confirm_rejet" method="post" action="line.php?id='.$id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="confirm_rejet">';
print '<table class="border centpercent">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("WithdrawalRefused").'</td></tr>';
@ -205,13 +216,13 @@ if ($id)
//Reason
print '<tr><td class="fieldrequired valid">'.$langs->trans("RefusedReason").'</td>';
print '<td class="valid">';
print $form->selectarray("motif", $rej->motifs);
print $form->selectarray("motif", $rej->motifs, GETPOSTISSET('motif') ? GETPOST('motif', 'int') : '');
print '</td></tr>';
//Facturer
print '<tr><td class="valid">'.$langs->trans("RefusedInvoicing").'</td>';
print '<td class="valid" colspan="2">';
print $form->selectarray("facturer", $rej->facturer);
print $form->selectarray("facturer", $rej->facturer, GETPOSTISSET('facturer') ? GETPOST('facturer', 'int') : '');
print '</td></tr>';
print '</table><br>';
@ -230,16 +241,18 @@ if ($id)
if ($action == '')
{
if ($bon->statut == 2 && $lipre->statut == 2)
if ($bon->statut == BonPrelevement::STATUS_CREDITED)
{
if ($user->rights->prelevement->bons->credit)
{
print "<a class=\"butAction\" href=\"line.php?action=rejet&amp;id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>";
} else {
print "<a class=\"butActionRefused classfortooltip\" href=\"#\" title=\"".$langs->trans("NotAllowed")."\">".$langs->trans("StandingOrderReject")."</a>";
if ($lipre->statut == 2) {
if ($user->rights->prelevement->bons->credit)
{
print '<a class="butActionDelete" href="line.php?action=rejet&id='.$lipre->id.'">'.$langs->trans("StandingOrderReject").'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("StandingOrderReject").'</a>';
}
}
} else {
print "<a class=\"butActionRefused classfortooltip\" href=\"#\" title=\"".$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject")."</a>";
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine").'">'.$langs->trans("StandingOrderReject").'</a>';
}
}

View File

@ -21,7 +21,7 @@
/**
* \file htdocs/compta/prelevement/list.php
* \ingroup prelevement
* \brief Page liste des prelevements
* \brief Page list of direct debit orders or credit transfers orders
*/
require '../../main.inc.php';
@ -96,23 +96,35 @@ $form = new Form($db);
llxHeader('', $langs->trans("WithdrawalsLines"));
$sql = "SELECT p.rowid, p.ref, p.statut as status, p.datec";
$sql .= " ,f.rowid as facid, f.ref as invoiceref, f.total_ttc";
$sql .= " , f.rowid as facid, f.ref as invoiceref, f.total_ttc";
$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.email";
$sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
if ($type == 'bank-transfer') {
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
} else {
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
}
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE pl.fk_prelevement_bons = p.rowid";
$sql .= " AND pf.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pf.fk_facture = f.rowid";
if ($type == 'bank-transfer') {
$sql .= " AND pf.fk_facture_fourn = f.rowid";
} else {
$sql .= " AND pf.fk_facture = f.rowid";
}
$sql .= " AND f.fk_soc = s.rowid";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) $sql .= " AND s.rowid = ".$socid;
if ($search_line) $sql .= " AND pl.rowid = '".$db->escape($search_line)."'";
if ($search_bon) $sql .= natural_search("p.ref", $search_bon);
if ($search_code) $sql .= natural_search("s.code_client", $search_code);
if ($type == 'bank-transfer') {
if ($search_code) $sql .= natural_search("s.code_fourn", $search_code);
} else {
if ($search_code) $sql .= natural_search("s.code_client", $search_code);
}
if ($search_company) $sql .= natural_search("s.nom", $search_company);
$sql .= $db->order($sortfield, $sortorder);
@ -152,7 +164,11 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1);
$title = $langs->trans("WithdrawalsLines");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransferLines");
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1);
$moreforfilter = '';
@ -173,9 +189,14 @@ if ($result)
print '</td>';
print '</tr>';
$columntitle= "WithdrawalsReceipts";
if ($type == 'bank-transfer') {
$columntitle= "BankTransferReceipts";
}
print '<tr class="liste_titre">';
print_liste_field_titre($columntitle, $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Line", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"], "f.ref", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", '', $param, '', $sortfield, $sortorder, 'center ');
@ -184,53 +205,58 @@ if ($result)
print_liste_field_titre('');
print "</tr>\n";
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
if ($num) {
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$bon->ref = $obj->ref;
$bon->statut = $obj->status;
$bon->id = $obj->rowid;
$bon->ref = $obj->ref;
$bon->statut = $obj->status;
$company->id = $obj->socid;
$company->name = $obj->name;
$company->email = $obj->email;
$company->code_client = $obj->code_client;
$company->id = $obj->socid;
$company->name = $obj->name;
$company->email = $obj->email;
$company->code_client = $obj->code_client;
print '<tr class="oddeven">';
print '<tr class="oddeven">';
print '<td>';
print $line->LibStatut($obj->statut_ligne, 2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6);
print '</a></td>';
print '<td>';
print $bon->getNomUrl(1);
print "</td>\n";
print '<td>';
print $bon->getNomUrl(1);
print "</td>\n";
print '<td>';
print $line->LibStatut($obj->statut_ligne, 2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6);
print '</a></td>';
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"), "bill");
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->invoiceref."</a></td>\n";
print '</a>';
print '</td>';
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"), "bill");
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->invoiceref."</a></td>\n";
print '</a>';
print '</td>';
print '<td>';
print $company->getNomUrl(1);
print "</td>\n";
print '<td>';
print $company->getNomUrl(1);
print "</td>\n";
print '<td align="center"><a href="card.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n";
print '<td align="center"><a href="card.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$i++;
}
print "</tr>\n";
$i++;
}
} else {
print '<tr><td class="opacitymedium" colspan="8">'.$langs->trans("None").'</td></tr>';
}
print "</table>";
print '</div>';

View File

@ -55,7 +55,12 @@ $pagenext = $page + 1;
* View
*/
llxHeader('', $langs->trans("WithdrawsRefused"));
$title = $langs->trans("WithdrawsRefused");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransfersRefused");
}
llxHeader('', $title);
if ($sortorder == "") $sortorder = "DESC";
if ($sortfield == "") $sortfield = "p.datec";
@ -80,9 +85,14 @@ $sql .= " WHERE pr.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND pl.fk_soc = s.rowid";
$sql .= " AND p.entity = ".$conf->entity;
if ($type == 'bank-transfer') {
$sql .= " AND p.type = 'bank-transfer'";
} else {
$sql .= " AND p.type = 'debit-order'";
}
if ($socid) $sql .= " AND s.rowid = ".$socid;
$sql .= " ".$db->order($sortfield, $sortorder);
$sql .= " ".$db->plimit($conf->liste_limit + 1, $offset);
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
@ -90,33 +100,39 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("WithdrawsRefused"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
$param = '';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="noborder tagtable liste" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Line", $_SERVER["PHP_SELF"], "p.ref", '', $urladd);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd);
print_liste_field_titre("Reason", $_SERVER["PHP_SELF"], "pr.motif", "", $urladd);
print_liste_field_titre("Line", $_SERVER["PHP_SELF"], "p.ref", '', $param);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param);
print_liste_field_titre("Reason", $_SERVER["PHP_SELF"], "pr.motif", "", $param);
print "</tr>\n";
$total = 0;
if ($num) {
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
while ($i < min($num, $conf->liste_limit))
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">';
print '<tr class="oddeven"><td>';
print $line->LibStatut($obj->statut, 2).'&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print '<td>';
print $line->LibStatut($obj->statut, 2).'&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print substr('000000'.$obj->rowid, -6)."</a></td>";
print substr('000000'.$obj->rowid, -6)."</a></td>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->nom."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print "</tr>\n";
print "</tr>\n";
$i++;
$i++;
}
} else {
print '<tr><td class="opacitymedium" colspan="3">'.$langs->trans("None").'</td></tr>';
}
print "</table>";

View File

@ -43,15 +43,25 @@ $type = GETPOST('type', 'aZ09');
* View
*/
llxHeader('', $langs->trans("WithdrawStatistics"));
$title = $langs->trans("WithdrawStatistics");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransferStatistics");
}
print load_fiche_titre($langs->trans("Statistics"));
llxHeader('', $title);
print load_fiche_titre($title);
// Define total and nbtotal
$sql = "SELECT sum(pl.amount), count(pl.amount)";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= " WHERE pl.fk_prelevement_bons = pb.rowid";
if ($type == 'bank-transfer') {
$sql .= " AND pb.type = 'bank-transfer'";
} else {
$sql .= " AND pb.type = 'debit-order'";
}
$sql .= " AND pb.entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql)
@ -73,7 +83,7 @@ if ($resql)
*/
print '<br>';
print load_fiche_titre($langs->trans("WithdrawStatistics"), '', '');
print load_fiche_titre($langs->trans("ByStatus"), '', '');
$ligne = new LignePrelevement($db);
@ -82,6 +92,11 @@ $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= " WHERE pl.fk_prelevement_bons = pb.rowid";
$sql .= " AND pb.entity = ".$conf->entity;
if ($type == 'bank-transfer') {
$sql .= " AND pb.type = 'bank-transfer'";
} else {
$sql .= " AND pb.type = 'debit-order'";
}
$sql .= " GROUP BY pl.statut";
$resql = $db->query($sql);
@ -137,7 +152,7 @@ if ($resql)
*/
print '<br>';
print load_fiche_titre($langs->trans("WithdrawRejectStatistics"), '', '');
print load_fiche_titre($langs->trans("Rejects"), '', '');
// Define total and nbtotal
@ -147,6 +162,11 @@ $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= " WHERE pl.fk_prelevement_bons = pb.rowid";
$sql .= " AND pb.entity = ".$conf->entity;
$sql .= " AND pl.statut = 3";
if ($type == 'bank-transfer') {
$sql .= " AND pb.type = 'bank-transfer'";
} else {
$sql .= " AND pb.type = 'debit-order'";
}
$resql = $db->query($sql);
if ($resql)
{
@ -164,6 +184,7 @@ if ($resql)
/*
* Stats sur les rejets
*/
$sql = "SELECT sum(pl.amount), count(pl.amount) as cc, pr.motif";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
@ -172,6 +193,11 @@ $sql .= " WHERE pl.fk_prelevement_bons = pb.rowid";
$sql .= " AND pb.entity = ".$conf->entity;
$sql .= " AND pl.statut = 3";
$sql .= " AND pr.fk_prelevement_lignes = pl.rowid";
if ($type == 'bank-transfer') {
$sql .= " AND pb.type = 'bank-transfer'";
} else {
$sql .= " AND pb.type = 'debit-order'";
}
$sql .= " GROUP BY pr.motif";
$sql .= " ORDER BY cc DESC";

View File

@ -150,6 +150,7 @@ if ($search_typeid) {
$sql .= " AND cs.fk_type=".$db->escape($search_typeid);
}
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
if (!empty($conf->projet->enabled)) $sql .= ", p.rowid, p.ref, p.title";
$sql .= $db->order($sortfield, $sortorder);
$totalnboflines = 0;

View File

@ -1125,7 +1125,7 @@ if ($action == 'create')
} else {
print '<td>';
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300');
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
print '</tr>'."\n";
@ -1167,7 +1167,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, "projectid", 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print "</td></tr>";
}
@ -1490,7 +1490,9 @@ if ($action == 'create')
// Line in view mode
if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
{
print '<tr class="tdtop oddeven">';
$moreparam = '';
if (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) && $objp->statut == ContratLigne::STATUS_CLOSED && $action != 'showclosedlines') $moreparam = 'style="display: none;"';
print '<tr class="tdtop oddeven" '.$moreparam.'>';
// Label
if ($objp->fk_product > 0)
{
@ -1586,7 +1588,7 @@ if ($action == 'create')
$colspan = 7;
}
print '<tr class="oddeven">';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td colspan="'.$colspan.'">';
// Date planned
@ -1622,7 +1624,7 @@ if ($action == 'create')
$line = new ContratLigne($db);
$line->id = $objp->rowid;
$line->fetch_optionals();
print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
print $line->showOptionals($extrafields, 'view', array('class'=>'oddeven','style'=>$moreparam, 'colspan'=>$colspan), '', '', 1);
}
}
// Line in mode update
@ -1721,7 +1723,9 @@ if ($action == 'create')
if ($object->statut > 0)
{
print '<tr class="oddeven">';
$moreparam = '';
if (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) && $object->lines[$cursorline-1]->statut == ContratLigne::STATUS_CLOSED && $action != 'showclosedlines') $moreparam = 'style="display: none;"';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td class="tdhrthin" colspan="'.($conf->margin->enabled ? 7 : 6).'"><hr class="opacitymedium tdhrthin"></td>';
print "</tr>\n";
}
@ -1797,7 +1801,7 @@ if ($action == 'create')
{
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
print '<tr class="oddeven">';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline - 1]->getLibStatut(4).'</td>';
print '<td width="30" class="right">';
if ($user->socid == 0)
@ -1824,7 +1828,7 @@ if ($action == 'create')
print '</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td>';
// Si pas encore active
@ -2082,7 +2086,11 @@ if ($action == 'create')
// print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a></div>';
//}
}
if (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) && $object->nbofservicesclosed > 0)
{
if ($action == 'showclosedlines') print '<div class="inline-block divButAction"><a class="butAction" id="btnhideclosedlines" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=hideclosedlines">'.$langs->trans("HideClosedServices").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butAction" id="btnshowclosedlines" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=showclosedlines">'.$langs->trans("ShowClosedServices").'</a></div>';
}
// On peut supprimer entite si
// - Droit de creer + mode brouillon (erreur creation)
// - Droit de supprimer

View File

@ -186,7 +186,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
// Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code.
if (isAFileWithExecutableContent($filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED))
{
$filenameto .= '.noexe';
// $upload_dir ends with a slash, so be must be sure the medias dir to compare to ends with slash too.
$publicmediasdirwithslash = $conf->medias->multidir_output[$conf->entity];
if (! preg_match('/\/$/', $publicmediasdirwithslash)) $publicmediasdirwithslash.='/';
if (strpos($upload_dir, $publicmediasdirwithslash) !== 0) { // We never add .noexe on files into media directory
$filenameto .= '.noexe';
}
}
if ($filenamefrom && $filenameto)
@ -200,8 +206,10 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
if (empty($reshook))
{
if (!file_exists($destpath))
{
if (preg_match('/^\./', $filenameto)) {
$langs->load("errors"); // lang must be loaded because we can't rely on loading during output, we need var substitution to be done now.
setEventMessages($langs->trans("ErrorFilenameCantStartWithDot", $filenameto), null, 'errors');
} elseif (!file_exists($destpath)) {
$result = dol_move($srcpath, $destpath);
if ($result)
{
@ -225,11 +233,11 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
setEventMessages($langs->trans("FileRenamed"), null);
} else {
$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
$langs->load("errors"); // lang must be loaded because we can't rely on loading during output, we need var substitution to be done now.
setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors');
}
} else {
$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
$langs->load("errors"); // lang must be loaded because we can't rely on loading during output, we need var substitution to be done now.
setEventMessages($langs->trans("ErrorDestinationAlreadyExists", $filenameto), null, 'errors');
}
}

View File

@ -1109,8 +1109,6 @@ if (!$error && $massaction == 'validate' && $permissiontoadd)
$result = $objecttmp->fetch($toselectid);
if ($result > 0)
{
//if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
//else
$result = $objecttmp->validate($user);
if ($result == 0)
{

View File

@ -84,7 +84,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
$sql = "SELECT DISTINCT b.piece_num";
$sql .= ", b.doc_date as date_movement";
$sql .= ", b.label_operation";
$sql .= ", b.montant";
$sql .= ", b.montant as amount";
$sql .= ", b.code_journal";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.fk_doc = 0";
@ -103,7 +103,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
$date = $this->db->jdate($objp->date_movement);
$journal = $objp->code_journal;
$label = $objp->label_operation;
$amount = $objp->montant;
$amount = $objp->amount;
$bookkeepingstatic->id = $objp->id;
$bookkeepingstatic->piece_num = $objp->piece_num;

View File

@ -101,13 +101,15 @@ class box_external_rss extends ModeleBoxes
if ($result < 0 || !empty($rssparser->error))
{
// Show warning
$title .= " ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate", ($rssparser->getLastFetchDate() ?dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown"))));
$errormessage = $langs->trans("FailedToRefreshDataInfoNotUpToDate", ($rssparser->getLastFetchDate() ? dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown")));
if ($rssparser->error) $errormessage .= " - ".$rssparser->error;
$title .= " ".img_error($errormessage);
$this->info_box_head = array('text' => $title, 'limit' => 0);
} else {
$this->info_box_head = array(
'text' => $title,
'sublink' => $link,
'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate() ?dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown")),
'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate() ? dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown")),
'subpicto'=>'globe',
'target'=>'_blank',
);

View File

@ -90,7 +90,7 @@ class box_services_contracts extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,";
$sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type,";
$sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type, cd.date_fin_validite as date_line,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity, p.tobuy, p.tosell";
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
@ -113,6 +113,8 @@ class box_services_contracts extends ModeleBoxes
while ($i < $num)
{
$late = '';
$objp = $this->db->fetch_object($result);
$datem = $this->db->jdate($objp->datem);
@ -124,11 +126,11 @@ class box_services_contracts extends ModeleBoxes
$contractlinestatic->product_id = $objp->product_id;
$contractlinestatic->product_ref = $objp->product_ref;
$contractstatic->statut = $objp->contract_status;
$contractstatic->id = $objp->rowid;
$contractstatic->ref = $objp->ref;
$contractstatic->ref_customer = $objp->ref_customer;
$contractstatic->ref_supplier = $objp->ref_supplier;
$contractstatic->statut = $objp->contract_status;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->id = $objp->socid;
@ -140,6 +142,9 @@ class box_services_contracts extends ModeleBoxes
$thirdpartytmp->code_compta = $objp->code_compta;
$thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur;
$dateline = $this->db->jdate($objp->date_line);
if ($contractstatic->statut == Contrat::STATUS_VALIDATED && $objp->statut == ContratLigne::STATUS_OPEN && ($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late"));
// Multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && $objp->product_id > 0) // if option multilang is on
{
@ -212,6 +217,7 @@ class box_services_contracts extends ModeleBoxes
$this->info_box_contents[$i][] = array(
'td' => '',
'text' => dol_print_date($datem, 'day'),
'text2'=> $late,
);
$this->info_box_contents[$i][] = array(

View File

@ -103,10 +103,10 @@ class box_shipments extends ModeleBoxes
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql .= " WHERE e.entity = ".$conf->entity;
if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id;
else $sql .= " ORDER BY e.date_delivery, e.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@ -131,7 +131,7 @@ class CSMSFile
$sms->nostop = $this->nostop;
$sms->socid = $this->socid;
$sms->contactid = $this->contactid;
$sms->contact_id = $this->contact_id;
$sms->project = $this->fk_project;
$res = $sms->SmsSend();
@ -162,7 +162,7 @@ class CSMSFile
$sms->nostop = $this->nostop;
$sms->socid = $this->socid;
$sms->contactid = $this->contactid;
$sms->contact_id = $this->contact_id;
$sms->fk_project = $this->fk_project;
$res = $sms->SmsSend();

View File

@ -648,10 +648,153 @@ abstract class CommonInvoice extends CommonObject
if ($diff < 0) $datelim = $date_lim_current;
else $datelim = $date_lim_next;
} else return 'Bad value for type_cdr in database for record cond_reglement = '.$cond_reglement;
} else {
return 'Bad value for type_cdr in database for record cond_reglement = '.$cond_reglement;
}
return $datelim;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a withdrawal request for a direct debit order or a credit transfer order.
* Use the remain to pay excluding all existing open direct debit requests.
*
* @param User $fuser User asking the direct debit transfer
* @param float $amount Amount we request direct debit for
* @param string $type 'direct-debit' or 'bank-transfer'
* @param string $sourcetype Source ('facture' or 'supplier_invoice')
* @return int <0 if KO, >0 if OK
*/
public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture')
{
// phpcs:enable
global $conf;
$error = 0;
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
if ($this->statut > self::STATUS_DRAFT && $this->paye == 0)
{
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $this->socid);
$sql = 'SELECT count(*)';
$sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
if ($type == 'bank-transfer') {
$sql .= ' WHERE fk_facture_fourn = '.$this->id;
} else {
$sql .= ' WHERE fk_facture = '.$this->id;
}
$sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments
$sql .= ' AND traite = 0';
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
if ($row[0] == 0)
{
$now = dol_now();
$totalpaye = $this->getSommePaiement();
$totalcreditnotes = $this->getSumCreditNotesUsed();
$totaldeposits = $this->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
if (empty($amount)) $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
if (is_numeric($amount) && $amount != 0)
{
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande(';
if ($type == 'bank-transfer') {
$sql .= 'fk_facture_fourn, ';
} else {
$sql .= 'fk_facture, ';
}
$sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, entity)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($amount)."'";
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",".$fuser->id;
$sql .= ",'".$this->db->escape($bac->code_banque)."'";
$sql .= ",'".$this->db->escape($bac->code_guichet)."'";
$sql .= ",'".$this->db->escape($bac->number)."'";
$sql .= ",'".$this->db->escape($bac->cle_rib)."'";
$sql .= ",'".$this->db->escape($sourcetype)."'";
$sql .= ",".$conf->entity;
$sql .= ")";
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur');
$error++;
}
} else {
$this->error = 'WithdrawRequestErrorNilAmount';
dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount');
$error++;
}
if (!$error) {
// Force payment mode of invoice to withdraw
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1);
if ($payment_mode_id > 0) {
$result = $this->setPaymentMethods($payment_mode_id);
}
}
if ($error) return -1;
return 1;
} else {
$this->error = "A request already exists";
dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours');
return 0;
}
} else {
$this->error = $this->db->error();
dol_syslog(get_class($this).'::demandeprelevement Erreur -2');
return -2;
}
} else {
$this->error = "Status of invoice does not allow this";
dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id");
return -3;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Remove a direct debit request or a credit transfer request
*
* @param User $fuser User making delete
* @param int $did ID of request to delete
* @return int <0 if OK, >0 if KO
*/
public function demande_prelevement_delete($fuser, $did)
{
// phpcs:enable
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' WHERE rowid = '.$did;
$sql .= ' AND traite = 0';
if ($this->db->query($sql))
{
return 0;
} else {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error);
return -1;
}
}
}

View File

@ -1424,15 +1424,15 @@ abstract class CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load object contact with id=$this->contactid into $this->contact
* Load object contact with id=$this->contact_id into $this->contact
*
* @param int $contactid Id du contact. Use this->contactid if empty.
* @param int $contactid Id du contact. Use this->contact_id if empty.
* @return int <0 if KO, >0 if OK
*/
public function fetch_contact($contactid = null)
{
// phpcs:enable
if (empty($contactid)) $contactid = $this->contactid;
if (empty($contactid)) $contactid = $this->contact_id;
if (empty($contactid)) return 0;
@ -3043,7 +3043,12 @@ abstract class CommonObject
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n";
if ($diff)
{
if (abs($diff) > 0.1) { dol_syslog('A rounding difference was detected into TOTAL but is too high to be corrected', LOG_WARNING); exit; }
if (abs($diff) > 0.1) {
$errmsg = 'A rounding difference was detected into TOTAL but is too high to be corrected. Some data in your line may be corrupted. Try to edit each line manually.';
dol_syslog($errmsg, LOG_WARNING);
dol_print_error('', $errmsg);
exit;
}
$sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid;
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
$resqlfix = $this->db->query($sqlfix);
@ -5839,7 +5844,7 @@ abstract class CommonObject
if ($type == 'date')
{
$morecss = 'minwidth100imp';
} elseif ($type == 'datetime' || $type == 'link')
} elseif ($type == 'datetime' || $type == 'link') // link means an foreign key to another primary id
{
$morecss = 'minwidth200imp';
} elseif (in_array($type, array('int', 'integer', 'price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type))
@ -6273,11 +6278,13 @@ abstract class CommonObject
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]'
$param_list_array = explode(':', $param_list[0]);
$showempty = (($required && $default != '') ? 0 : 1);
if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button
$morecss .= ' widthcentpercentminusx';
}
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, empty($val['disabled']) ? 0 : 1);
if (!empty($param_list_array[2])) // If we set to add a create button
{
if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button
if (!GETPOSTISSET('backtopage') && empty($val['disabled']) && empty($nonewbutton)) // To avoid to open several times the 'Create Object' button and to avoid to have button if field is protected by a "disabled".
{
list($class, $classfile) = explode(':', $param_list[0]);
@ -7972,7 +7979,9 @@ abstract class CommonObject
break;
}
} else {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $table . ' WHERE ' . $this->fk_element . ' = ' . $this->id;
// Delete record in child table
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $table . ' WHERE ' . $this->fk_element . ' = ' . $this->id;
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -8052,7 +8061,11 @@ abstract class CommonObject
$error++;
$this->errors[] = $this->error;
} else {
$result = $this->delete($user);
if (get_class($this) == 'Contact') { // TODO special code because delete() for contact has not been standardized like other delete.
$result = $this->delete();
} else {
$result = $this->delete($user);
}
if ($result < 0) {
$error++;
$this->errors[] = $this->error;
@ -8257,6 +8270,27 @@ abstract class CommonObject
/* Part for categories/tags */
/**
* Sets object to given categories.
*
* Deletes object from existing categories not supplied.
* Adds it to non existing supplied categories.
* Existing categories are left untouch.
*
* @param string $type_categ Category type ('customer', 'supplier', 'website_page', ...)
* @return int Array of category objects or < 0 if KO
*/
public function getCategoriesCommon($type_categ)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Get current categories
$c = new Categorie($this->db);
$existing = $c->containing($this->id, $type_categ, 'id');
return $existing;
}
/**
* Sets object to given categories.
*

View File

@ -183,7 +183,7 @@ class Conf
//if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install)
$this->global->$key = $value;
if ($value && preg_match('/^MAIN_MODULE_/', $key))
if ($value && strpos($key, 'MAIN_MODULE_') === 0)
{
$reg = array();
// If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
@ -191,7 +191,7 @@ class Conf
{
$partname = 'tabs';
$params = explode(':', $value, 2);
if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
if (!is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
$this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array
}
// If this is constant for all generic part activated by a module. It initializes
@ -203,7 +203,7 @@ class Conf
{
$modulename = strtolower($reg[1]);
$partname = strtolower($reg[2]);
if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
if (!is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
$arrValue = json_decode($value, true);
if (is_array($arrValue) && !empty($arrValue)) $value = $arrValue;
elseif (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/';
@ -270,14 +270,7 @@ class Conf
if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD = "eldy_menu.php";
if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
// Clean var use vat for company
if (!isset($this->global->FACTURE_TVAOPTION)) $this->global->FACTURE_TVAOPTION = 1;
elseif (!empty($this->global->FACTURE_TVAOPTION) && !is_numeric($this->global->FACTURE_TVAOPTION))
{
// Old value of option, we clean to use new value (0 or 1)
if ($this->global->FACTURE_TVAOPTION != "franchise") $this->global->FACTURE_TVAOPTION = 1;
else $this->global->FACTURE_TVAOPTION = 0;
}
// Variable globales LDAP
if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME = '';
@ -407,28 +400,22 @@ class Conf
$this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility
$this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility
// To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice
if (!empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties
// To prepare split of module fournisseur into module 'fournisseur' + supplier_order + supplier_invoice
if (!empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, and we don't use yet the new modules, we set artificialy the module properties
{
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
{
$this->supplier_order = new stdClass();
$this->supplier_order->enabled = 1;
$this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
$this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
$this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
$this->supplier_order->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
}
$this->supplier_order = new stdClass();
$this->supplier_order->enabled = 1;
$this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
$this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
$this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
$this->supplier_order->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
{
$this->supplier_invoice = new stdClass();
$this->supplier_invoice->enabled = 1;
$this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
$this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
$this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
$this->supplier_invoice->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
}
$this->supplier_invoice = new stdClass();
$this->supplier_invoice->enabled = 1;
$this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
$this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
$this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
$this->supplier_invoice->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
}
}
@ -496,7 +483,9 @@ class Conf
$this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0;
$this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0;
$this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0;
if (empty($this->reception->enabled))$this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1;
if (empty($this->reception->enabled)) {
$this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1;
}
else {
$this->global->STOCK_CALCULATE_ON_RECEPTION = 1;
$this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 0;
@ -614,58 +603,58 @@ class Conf
// Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx
if (isset($this->agenda)) {
$this->adherent->subscription = new stdClass();
$this->adherent->subscription->warning_delay = (isset($this->global->MAIN_DELAY_MEMBERS) ? $this->global->MAIN_DELAY_MEMBERS : 0) * 24 * 60 * 60;
$this->adherent->subscription->warning_delay = (isset($this->global->MAIN_DELAY_MEMBERS) ? $this->global->MAIN_DELAY_MEMBERS : 0) * 86400;
}
if (isset($this->agenda)) {
$this->agenda->warning_delay = (isset($this->global->MAIN_DELAY_ACTIONS_TODO) ? $this->global->MAIN_DELAY_ACTIONS_TODO : 7) * 24 * 60 * 60;
$this->agenda->warning_delay = (isset($this->global->MAIN_DELAY_ACTIONS_TODO) ? $this->global->MAIN_DELAY_ACTIONS_TODO : 7) * 86400;
}
if (isset($this->projet))
{
$this->projet->warning_delay = (isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE) ? $this->global->MAIN_DELAY_PROJECT_TO_CLOSE : 7) * 24 * 60 * 60;
$this->projet->warning_delay = (isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE) ? $this->global->MAIN_DELAY_PROJECT_TO_CLOSE : 7) * 86400;
$this->projet->task = new StdClass();
$this->projet->task->warning_delay = (isset($this->global->MAIN_DELAY_TASKS_TODO) ? $this->global->MAIN_DELAY_TASKS_TODO : 7) * 24 * 60 * 60;
$this->projet->task->warning_delay = (isset($this->global->MAIN_DELAY_TASKS_TODO) ? $this->global->MAIN_DELAY_TASKS_TODO : 7) * 86400;
}
if (isset($this->commande)) {
$this->commande->client = new stdClass();
$this->commande->fournisseur = new stdClass();
$this->commande->client->warning_delay = (isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS) ? $this->global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 24 * 60 * 60;
$this->commande->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS) ? $this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS : 7) * 24 * 60 * 60;
$this->commande->client->warning_delay = (isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS) ? $this->global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 86400;
$this->commande->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS) ? $this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS : 7) * 86400;
}
if (isset($this->propal)) {
$this->propal->cloture = new stdClass();
$this->propal->facturation = new stdClass();
$this->propal->cloture->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE) ? $this->global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 24 * 60 * 60;
$this->propal->facturation->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_BILL) ? $this->global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 24 * 60 * 60;
$this->propal->cloture->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE) ? $this->global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 86400;
$this->propal->facturation->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_BILL) ? $this->global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 86400;
}
if (isset($this->facture)) {
$this->facture->client = new stdClass();
$this->facture->fournisseur = new stdClass();
$this->facture->client->warning_delay = (isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? $this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 24 * 60 * 60;
$this->facture->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY) ? $this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY : 0) * 24 * 60 * 60;
$this->facture->client->warning_delay = (isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? $this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 86400;
$this->facture->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY) ? $this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY : 0) * 86400;
}
if (isset($this->contrat)) {
$this->contrat->services = new stdClass();
$this->contrat->services->inactifs = new stdClass();
$this->contrat->services->expires = new stdClass();
$this->contrat->services->inactifs->warning_delay = (isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? $this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 24 * 60 * 60;
$this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 24 * 60 * 60;
$this->contrat->services->inactifs->warning_delay = (isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? $this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 86400;
$this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 86400;
}
if (isset($this->commande)) {
$this->bank->rappro = new stdClass();
$this->bank->cheque = new stdClass();
$this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 24 * 60 * 60;
$this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 24 * 60 * 60;
$this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 86400;
$this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 86400;
}
if (isset($this->expensereport)) {
$this->expensereport->approve = new stdClass();
$this->expensereport->approve->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS) ? $this->global->MAIN_DELAY_EXPENSEREPORTS : 0) * 24 * 60 * 60;
$this->expensereport->approve->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS) ? $this->global->MAIN_DELAY_EXPENSEREPORTS : 0) * 86400;
$this->expensereport->payment = new stdClass();
$this->expensereport->payment->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? $this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 24 * 60 * 60;
$this->expensereport->payment->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? $this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 86400;
}
if (isset($this->holiday)) {
$this->holiday->approve = new stdClass();
$this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? $this->global->MAIN_DELAY_HOLIDAYS : 0) * 24 * 60 * 60;
$this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? $this->global->MAIN_DELAY_HOLIDAYS : 0) * 86400;
}
if (!empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT))
@ -709,39 +698,42 @@ class Conf
if (is_object($mc)) $mc->setValues($this);
}
// We init log handlers
if (!empty($this->global->SYSLOG_HANDLERS)) {
$handlers = json_decode($this->global->SYSLOG_HANDLERS);
} else {
$handlers = array();
}
foreach ($handlers as $handler) {
$handler_files = array();
$dirsyslogs = array_merge(array('/core/modules/syslog/'), $this->modules_parts['syslog']);
foreach ($dirsyslogs as $reldir) {
$dir = dol_buildpath($reldir, 0);
$newdir = dol_osencode($dir);
if (is_dir($newdir)) {
$file = $newdir.$handler.'.php';
if (file_exists($file)) {
$handler_files[] = $file;
if (!empty($this->syslog->enabled)) {
// We init log handlers
if (!empty($this->global->SYSLOG_HANDLERS)) {
$handlers = json_decode($this->global->SYSLOG_HANDLERS);
} else {
$handlers = array();
}
foreach ($handlers as $handler) {
$handler_file_found = '';
$dirsyslogs = array_merge(array('/core/modules/syslog/'), $this->modules_parts['syslog']);
foreach ($dirsyslogs as $reldir) {
$dir = dol_buildpath($reldir, 0);
$newdir = dol_osencode($dir);
if (is_dir($newdir)) {
$file = $newdir.$handler.'.php';
if (file_exists($file)) {
$handler_file_found = $file;
break;
}
}
}
}
if (empty($handler_files)) {
throw new Exception('Missing log handler file '.$handler.'.php');
}
if (empty($handler_file_found)) {
throw new Exception('Missing log handler file '.$handler.'.php');
}
require_once $handler_files[0];
$loghandlerinstance = new $handler();
if (!$loghandlerinstance instanceof LogHandlerInterface) {
throw new Exception('Log handler does not extend LogHandlerInterface');
}
require_once $handler_file_found;
$loghandlerinstance = new $handler();
if (!$loghandlerinstance instanceof LogHandlerInterface) {
throw new Exception('Log handler does not extend LogHandlerInterface');
}
if (empty($this->loghandlers[$handler])) {
$this->loghandlers[$handler] = $loghandlerinstance;
if (empty($this->loghandlers[$handler])) {
$this->loghandlers[$handler] = $loghandlerinstance;
}
}
}
}
}
}

View File

@ -1127,7 +1127,7 @@ class DolGraph
foreach ($legends as $val) // Loop on each serie
{
if ($i > 0) $this->stringtoshow .= ', ';
$this->stringtoshow .= "'".$val."'";
$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
$i++;
}
@ -1189,7 +1189,7 @@ class DolGraph
foreach ($legends as $val) // Loop on each serie
{
if ($i > 0) $this->stringtoshow .= ', ';
$this->stringtoshow .= "'".$val."'";
$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
$i++;
}

View File

@ -158,79 +158,72 @@ class dolReceiptPrinter extends Printer
{
$this->db = $db;
$this->tags = array(
'dol_line_feed',
'dol_line_feed_reverse',
'dol_align_left',
'dol_align_center',
'dol_align_right',
'dol_use_font_a',
'dol_use_font_b',
'dol_use_font_c',
'dol_bold',
'dol_bold_disabled',
'dol_double_height',
'dol_double_width',
'dol_default_height_width',
'dol_underline',
'dol_underline_disabled',
'dol_cut_paper_full',
'dol_cut_paper_partial',
'dol_open_drawer',
'dol_beep',
'dol_print_text',
'dol_print_barcode',
'dol_value_date',
'dol_value_date_time',
'dol_value_year',
'dol_value_month_letters',
'dol_value_month',
'dol_value_day',
'dol_value_day_letters',
'dol_line_feed' => 'DOL_LINE_FEED',
'dol_line_feed_reverse' => 'DOL_LINE_FEED_REVERSE',
'dol_align_left' => 'DOL_ALIGN_LEFT',
'dol_align_center' => 'DOL_ALIGN_CENTER',
'dol_align_right' => 'DOL_ALIGN_RIGHT',
'dol_use_font_a' => 'DOL_USE_FONT_A',
'dol_use_font_b' => 'DOL_USE_FONT_B',
'dol_use_font_c' => 'DOL_USE_FONT_C',
'dol_bold' => 'DOL_BOLD',
'dol_bold_disabled' => 'DOL_BOLD_DISABLED',
'dol_double_height' => 'DOL_DOUBLE_HEIGHT',
'dol_double_width' => 'DOL_DOUBLE_WIDTH',
'dol_default_height_width' => 'DOL_DEFAULT_HEIGHT_WIDTH',
'dol_underline' => 'DOL_UNDERLINE',
'dol_underline_disabled' => 'DOL_UNDERLINE_DISABLED',
'dol_cut_paper_full' => 'DOL_CUT_PAPER_FULL',
'dol_cut_paper_partial' => 'DOL_CUT_PAPER_PARTIAL',
'dol_open_drawer' => 'DOL_OPEN_DRAWER',
'dol_beep' => 'DOL_BEEP',
'dol_print_text' => 'DOL_PRINT_TEXT',
'dol_print_barcode' => 'DOL_PRINT_BARCODE',
'dol_value_date' => 'DateInvoice',
'dol_value_date_time' => 'DateInvoiceWithTime',
'dol_value_year' => 'YearInvoice',
'dol_value_month_letters' => 'DOL_VALUE_MONTH_LETTERS',
'dol_value_month' => 'DOL_VALUE_MONTH',
'dol_value_day' => 'DOL_VALUE_DAY',
'dol_value_day_letters' => 'DOL_VALUE_DAY',
//'dol_print_payment',
'dol_print_logo',
'dol_print_logo_old',
'dol_value_object_id',
'dol_value_object_ref',
'dol_print_object_lines',
'dol_print_object_tax',
'dol_print_object_local_tax',
'dol_print_object_total',
'dol_print_object_number',
'dol_print_order_lines',
'dol_value_customer_firstname',
'dol_value_customer_lastname',
'dol_value_customer_mail',
'dol_value_customer_phone',
'dol_value_customer_mobile',
'dol_value_customer_skype',
'dol_value_customer_tax_number',
'dol_value_customer_account_balance',
'dol_value_mysoc_name',
'dol_value_mysoc_address',
'dol_value_mysoc_zip',
'dol_value_mysoc_town',
'dol_value_mysoc_country',
'dol_value_mysoc_idprof1',
'dol_value_mysoc_idprof2',
'dol_value_mysoc_idprof3',
'dol_value_mysoc_idprof4',
'dol_value_mysoc_idprof5',
'dol_value_mysoc_idprof6',
'dol_value_mysoc_tva_intra',
'dol_value_mysoc_capital',
'dol_value_vendor_lastname',
'dol_value_vendor_firstname',
'dol_value_vendor_mail',
'dol_value_customer_points',
'dol_value_object_points',
//'dol_print_if_customer',
//'dol_print_if_vendor',
//'dol_print_if_happy_hour',
//'dol_print_if_num_object_unique',
//'dol_print_if_customer_points',
//'dol_print_if_object_points',
//'dol_print_if_customer_tax_number',
//'dol_print_if_customer_account_balance_positive',
'dol_print_logo' => 'DOL_PRINT_LOGO',
'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD',
'dol_value_object_id' => 'InvoiceID',
'dol_value_object_ref' => 'InvoiceRef',
'dol_print_object_lines' => 'DOL_PRINT_OBJECT_LINES',
'dol_print_object_tax' => 'TotalVAT',
'dol_print_object_local_tax1' => 'TotalLT1',
'dol_print_object_local_tax2' => 'TotalLT2',
'dol_print_object_total' => 'Total',
'dol_print_object_number' => 'DOL_PRINT_OBJECT_NUMBER',
'dol_value_object_points' => 'DOL_VALUE_OBJECT_POINTS',
'dol_print_order_lines' => 'DOL_PRINT_ORDER_LINES',
'dol_value_customer_firstname' => 'DOL_VALUE_CUSTOMER_FIRSTNAME',
'dol_value_customer_lastname' => 'DOL_VALUE_CUSTOMER_LASTNAME',
'dol_value_customer_mail' => 'DOL_VALUE_CUSTOMER_MAIL',
'dol_value_customer_phone' => 'DOL_VALUE_CUSTOMER_PHONE',
'dol_value_customer_mobile' => 'DOL_VALUE_CUSTOMER_MOBILE',
'dol_value_customer_skype' => 'DOL_VALUE_CUSTOMER_SKYPE',
'dol_value_customer_tax_number' => 'DOL_VALUE_CUSTOMER_TAX_NUMBER',
'dol_value_customer_account_balance' => 'DOL_VALUE_CUSTOMER_ACCOUNT_BALANCE',
'dol_value_customer_points' => 'DOL_VALUE_CUSTOMER_POINTS',
'dol_value_mysoc_name' => 'DOL_VALUE_MYSOC_NAME',
'dol_value_mysoc_address' => 'Address',
'dol_value_mysoc_zip' => 'Zip',
'dol_value_mysoc_town' => 'Town',
'dol_value_mysoc_country' => 'Country',
'dol_value_mysoc_idprof1' => 'ProfId1',
'dol_value_mysoc_idprof2' => 'ProfId2',
'dol_value_mysoc_idprof3' => 'ProfId3',
'dol_value_mysoc_idprof4' => 'ProfId4',
'dol_value_mysoc_idprof5' => 'ProfId5',
'dol_value_mysoc_idprof6' => 'ProfId6',
'dol_value_mysoc_tva_intra' => 'VATIntra',
'dol_value_mysoc_capital' => 'Capital',
'dol_value_vendor_lastname' => 'VendorLastname',
'dol_value_vendor_firstname' => 'VendorFirstname',
'dol_value_vendor_mail' => 'VendorEmail',
);
}
@ -545,14 +538,14 @@ class dolReceiptPrinter extends Printer
/**
* Function to Print Receipt Ticket
*
* @param object $object order or invoice object
* @param int $templateid Template id
* @param int $printerid Printer id
* @return int 0 if OK; >0 if KO
* @param Facture|Commande $object Order or invoice object
* @param int $templateid Template id
* @param int $printerid Printer id
* @return int 0 if OK; >0 if KO
*/
public function sendToPrinter($object, $templateid, $printerid)
{
global $conf, $mysoc, $langs;
global $conf, $mysoc, $langs, $user;
$error = 0;
$ret = $this->loadTemplate($templateid);
@ -560,15 +553,23 @@ class dolReceiptPrinter extends Printer
$this->template = str_replace('<dol_value_object_id>', $object->id, $this->template);
$this->template = str_replace('<dol_value_object_ref>', $object->ref, $this->template);
$this->template = str_replace('<dol_value_object_points>', $object->points, $this->template);
$this->template = str_replace('<dol_value_customer_firstname>', $object->customer_firstname, $this->template);
$this->template = str_replace('<dol_value_customer_lastname>', $object->customer_lastname, $this->template);
$this->template = str_replace('<dol_value_customer_mail>', $object->customer_mail, $this->template);
$this->template = str_replace('<dol_value_customer_phone>', $object->customer_phone, $this->template);
$this->template = str_replace('<dol_value_customer_mobile>', $object->customer_mobile, $this->template);
$this->template = str_replace('<dol_value_customer_skype>', $object->customer_skype, $this->template);
$this->template = str_replace('<dol_value_customer_tax_number>', $object->customer_tax_number, $this->template);
$this->template = str_replace('<dol_value_date>', dol_print_date($object->date, 'day'), $this->template);
$this->template = str_replace('<dol_value_date_time>', dol_print_date($object->date, 'dayhour'), $this->template);
$this->template = str_replace('<dol_value_year>', dol_print_date($object->date, '%Y'), $this->template);
$this->template = str_replace('<dol_value_month_letters>', $langs->trans("Month".dol_print_date($object->date, '%m')), $this->template);
$this->template = str_replace('<dol_value_month>', dol_print_date($object->date, '%m'), $this->template);
$this->template = str_replace('<dol_value_day>', dol_print_date($object->date, '%d'), $this->template);
$this->template = str_replace('<dol_value_day_letters>', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template);
$this->template = str_replace('<dol_value_customer_firstname>', $object->thirdparty->firstname, $this->template);
$this->template = str_replace('<dol_value_customer_lastname>', $object->thirdparty->lastname, $this->template);
$this->template = str_replace('<dol_value_customer_mail>', $object->thirdparty->mail, $this->template);
$this->template = str_replace('<dol_value_customer_phone>', $object->thirdparty->phone, $this->template);
$this->template = str_replace('<dol_value_customer_mobile>', $object->thirdparty->mobile, $this->template);
$this->template = str_replace('<dol_value_customer_tax_number>', $object->thirdparty->vatintra, $this->template);
$this->template = str_replace('<dol_value_customer_account_balance>', $object->customer_account_balance, $this->template);
$this->template = str_replace('<dol_value_customer_points>', $object->customer_points, $this->template);
$this->template = str_replace('<dol_value_mysoc_name>', $mysoc->name, $this->template);
$this->template = str_replace('<dol_value_mysoc_address>', $mysoc->address, $this->template);
$this->template = str_replace('<dol_value_mysoc_zip>', $mysoc->zip, $this->template);
@ -582,16 +583,10 @@ class dolReceiptPrinter extends Printer
$this->template = str_replace('<dol_value_mysoc_idprof6>', $mysoc->idprof6, $this->template);
$this->template = str_replace('<dol_value_mysoc_tva_intra>', $mysoc->tva_intra, $this->template);
$this->template = str_replace('<dol_value_mysoc_capital>', $mysoc->capital, $this->template);
$this->template = str_replace('<dol_value_vendor_firstname>', $object->vendor_firstname, $this->template);
$this->template = str_replace('<dol_value_vendor_lastname>', $object->vendor_lastname, $this->template);
$this->template = str_replace('<dol_value_vendor_mail>', $object->vendor_mail, $this->template);
$this->template = str_replace('<dol_value_date>', dol_print_date($object->date, 'day'), $this->template);
$this->template = str_replace('<dol_value_date_time>', dol_print_date($object->date, 'dayhour'), $this->template);
$this->template = str_replace('<dol_value_year>', dol_print_date($object->date, '%Y'), $this->template);
$this->template = str_replace('<dol_value_month_letters>', $langs->trans("Month".dol_print_date($object->date, '%m')), $this->template);
$this->template = str_replace('<dol_value_month>', dol_print_date($object->date, '%m'), $this->template);
$this->template = str_replace('<dol_value_day>', dol_print_date($object->date, '%d'), $this->template);
$this->template = str_replace('<dol_value_day_letters>', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template);
$this->template = str_replace('<dol_value_vendor_firstname>', $user->firstname, $this->template);
$this->template = str_replace('<dol_value_vendor_lastname>', $user->lastname, $this->template);
$this->template = str_replace('<dol_value_vendor_mail>', $user->email, $this->template);
// parse template
$p = xml_parser_create();
@ -634,6 +629,26 @@ class dolReceiptPrinter extends Printer
$this->printer->text($spaces.$vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n");
}
break;
case 'DOL_PRINT_OBJECT_TAX1':
//var_dump($object);
$total_localtax1 = 0;
foreach ($object->lines as $line) {
$total_localtax1 += $line->total_localtax1;
}
foreach ($vatarray as $vatkey => $vatvalue) {
$this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n");
}
break;
case 'DOL_PRINT_OBJECT_TAX2':
//var_dump($object);
$total_localtax2 = 0;
foreach ($object->lines as $line) {
$total_localtax2 += $line->total_localtax2;
}
foreach ($vatarray as $vatkey => $vatvalue) {
$this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n");
}
break;
case 'DOL_PRINT_OBJECT_TOTAL':
$title = $langs->trans('TotalHT');
$spacestoadd = $nbcharactbyline - strlen($title) - 10;

View File

@ -4104,7 +4104,7 @@ class Form
} elseif ($input['type'] == 'select')
{
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
if (!empty($input['label'])) $more .= $input['label'].'</div><div class="tagtd tdtop left">';
if (!empty($input['label'])) $more .= $input['label'].'</div><div class="tagtd left">';
$more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss);
$more .= '</div></div>'."\n";
} elseif ($input['type'] == 'checkbox')
@ -5280,7 +5280,7 @@ class Form
* @param int $d 1=Show days, month, years
* @param int $addnowlink Add a link "Now", 1 with server time, 2 with local computer time
* @param int $disabled Disable input fields
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param int $fullday When a checkbox with id #fullday is cheked, hours are set with 00:00 (if value if 'fulldaystart') or 23:59 (if value is 'fulldayend')
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
* @param datetime $adddateof Add a link "Date of ..." using the following date. See also $labeladddateof for the label used.
* @param string $openinghours Specify hour start and hour end for the select ex 8,20
@ -5371,7 +5371,7 @@ class Form
if ($usecalendar == "eldy")
{
// Zone de saisie manuelle de la date
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"';
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= '>';
@ -5424,7 +5424,7 @@ class Form
// Zone de saisie manuelle de la date
$retstring .= '<div class="nowrap inline-block">';
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"';
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= '>';
@ -5567,10 +5567,17 @@ class Form
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
} elseif ($addnowlink == 2)
{
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
* This break application for foreign languages.
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(d.getDate().pad());';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
*/
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
}
/*if ($usecalendar == "eldy")
{
@ -5698,8 +5705,7 @@ class Form
$minSelected = convertSecondToTime($iSecond, 'min');
}
if ($typehour == 'select')
{
if ($typehour == 'select') {
$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
for ($hour = 0; $hour < 25; $hour++) // For a duration, we allow 24 hours
{
@ -5711,10 +5717,11 @@ class Form
$retstring .= ">".$hour."</option>";
}
$retstring .= "</select>";
} elseif ($typehour == 'text' || $typehour == 'textselect')
{
$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" size="1" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
} else return 'BadValueForParameterTypeHour';
} elseif ($typehour == 'text' || $typehour == 'textselect') {
$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
} else {
return 'BadValueForParameterTypeHour';
}
if ($typehour != 'text') $retstring .= ' '.$langs->trans('HourShort');
else $retstring .= '<span class="hideonsmartphone">:</span>';
@ -5735,7 +5742,7 @@ class Form
$retstring .= "</select>";
} elseif ($typehour == 'text')
{
$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" size="1" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
}
if ($typehour != 'text') $retstring .= ' '.$langs->trans('MinuteShort');
@ -6576,9 +6583,10 @@ class Form
* @param int $id Id of object
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect (recommended)
* @param int $nolink 1=Do not add html links
* @return string String with categories
*/
public function showCategories($id, $type, $rendermode = 0)
public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
{
global $db;
@ -6592,7 +6600,7 @@ class Form
$toprint = array();
foreach ($categories as $c)
{
$ways = $c->print_all_ways(' &gt;&gt; ', '', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
foreach ($ways as $way)
{
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.$way.'</li>';

View File

@ -23,6 +23,8 @@
* \brief File of class with all html predefined components
*/
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
/**
* Class to manage generation of HTML components for bank module

View File

@ -319,6 +319,10 @@ class FormMail extends Form
// phpcs:enable
global $conf, $langs, $user, $hookmanager, $form;
// Required to show preview of mail attachments
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile = new Formfile($this->db);
if (!is_object($form)) $form = new Form($this->db);
// Load translation files required by the page
@ -845,7 +849,10 @@ class FormMail extends Form
foreach ($listofpaths as $key => $val)
{
$out .= '<div id="attachfile_'.$key.'">';
// Preview of attachment
preg_match('#^(/)(\w+)(/)(.+)$#', substr($val, (strlen(DOL_DATA_ROOT)-strlen($val))), $formfile_params);
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
if (!$this->withfilereadonly)
{
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';

View File

@ -338,7 +338,7 @@ class FormTicket
print '</td></tr>';
} else {
print '<tr><td class="titlefield"><input type="hidden" name="socid" value="'.$user->socid.'"/></td>';
print '<td><input type="hidden" name="contactid" value="'.$user->contactid.'"/></td>';
print '<td><input type="hidden" name="contactid" value="'.$user->contact_id.'"/></td>';
print '<td><input type="hidden" name="type" value="Z"/></td></tr>';
}
@ -987,12 +987,12 @@ class FormTicket
print '</td></tr>';
}
// MESSAGE
$defaultmessage = "";
if (is_array($arraydefaultmessage) && count($arraydefaultmessage) > 0 && $arraydefaultmessage->content) {
// MESSAGE
$defaultmessage="";
if (is_object($arraydefaultmessage) && $arraydefaultmessage->content) {
$defaultmessage = $arraydefaultmessage->content;
}
$defaultmessage = str_replace('\n', "\n", $defaultmessage);
$defaultmessage = str_replace('\n', "\n", $defaultmessage);
// Deal with format differences between message and signature (text / HTML)
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) {

View File

@ -55,6 +55,10 @@ class Ldap
/**
* Version du protocole ldap
*/
public $ldapProtocolVersion;
/**
* Server DN
*/
public $domain;
/**
* User administrateur Ldap
@ -160,7 +164,7 @@ class Ldap
public function connect_bind()
{
// phpcs:enable
global $langs, $conf;
global $conf;
$connected = 0;
$this->bind = 0;
@ -183,7 +187,7 @@ class Ldap
if (empty($this->error))
{
// Loop on each ldap server
foreach ($this->server as $key => $host)
foreach ($this->server as $host)
{
if ($connected) break;
if (empty($host)) continue;
@ -395,8 +399,6 @@ class Ldap
*/
public function add($dn, $info, $user)
{
global $conf;
dol_syslog(get_class($this)."::add dn=".$dn." info=".join(',', $info));
// Check parameters
@ -442,13 +444,11 @@ class Ldap
*
* @param string $dn DN entry key
* @param array $info Attributes array
* @param User $user Objet user that modify
* @param User $user Objet user that modify
* @return int <0 if KO, >0 if OK
*/
public function modify($dn, $info, $user)
{
global $conf;
dol_syslog(get_class($this)."::modify dn=".$dn." info=".join(',', $info));
// Check parameters
@ -473,6 +473,11 @@ class Ldap
$this->dump($dn, $info);
//print_r($info);
// For better compatibility with Samba4 AD
if ($this->serverType == "activedirectory") {
unset($info['cn']); // For avoid error : Operation not allowed on RDN (Code 67)
}
$result = @ldap_modify($this->connection, $dn, $info);
if ($result)
@ -499,8 +504,6 @@ class Ldap
*/
public function rename($dn, $newrdn, $newparent, $user, $deleteoldrdn = true)
{
global $conf;
dol_syslog(get_class($this)."::modify dn=".$dn." newrdn=".$newrdn." newparent=".$newparent." deleteoldrdn=".($deleteoldrdn ? 1 : 0));
// Check parameters
@ -548,8 +551,6 @@ class Ldap
*/
public function update($dn, $info, $user, $olddn, $newrdn = false, $newparent = false)
{
global $conf;
dol_syslog(get_class($this)."::update dn=".$dn." olddn=".$olddn);
// Check parameters
@ -566,11 +567,12 @@ class Ldap
if (!$olddn || $olddn != $dn)
{
if (!empty($olddn) && !empty($newrdn) && !empty($newparent) && $conf->global->LDAP_SERVER_PROTOCOLVERSION === '3')
if (! empty($olddn) && ! empty($newrdn) && ! empty($newparent) && $this->ldapProtocolVersion === '3')
{
// This function currently only works with LDAPv3
$result = $this->rename($olddn, $newrdn, $newparent, $user, true);
} else {
$result = $this->modify($dn, $info, $user); // We force "modify" for avoid some fields not modify
} else {
// If change we make is rename the key of LDAP record, we create new one and if ok, we delete old one.
$result = $this->add($dn, $info, $user);
if ($result > 0 && $olddn && $olddn != $dn) $result = $this->delete($olddn); // If add fails, we do not try to delete old one
@ -602,8 +604,6 @@ class Ldap
*/
public function delete($dn)
{
global $conf;
dol_syslog(get_class($this)."::delete Delete LDAP entry dn=".$dn);
// Check parameters
@ -658,7 +658,7 @@ class Ldap
{
$content .= "$key: $value\n";
} else {
foreach ($value as $valuekey => $valuevalue)
foreach ($value as $valuevalue)
{
$content .= "$key: $valuevalue\n";
}
@ -738,8 +738,6 @@ class Ldap
*/
public function addAttribute($dn, $info, $user)
{
global $conf;
dol_syslog(get_class($this)."::addAttribute dn=".$dn." info=".join(',', $info));
// Check parameters
@ -788,8 +786,6 @@ class Ldap
*/
public function updateAttribute($dn, $info, $user)
{
global $conf;
dol_syslog(get_class($this)."::updateAttribute dn=".$dn." info=".join(',', $info));
// Check parameters
@ -838,8 +834,6 @@ class Ldap
*/
public function deleteAttribute($dn, $info, $user)
{
global $conf;
dol_syslog(get_class($this)."::deleteAttribute dn=".$dn." info=".join(',', $info));
// Check parameters

View File

@ -645,7 +645,7 @@ class Menubase
// Define $right
$perms = true;
if ($menu['perms'])
if (isset($menu['perms']))
{
$tmpcond = $menu['perms'];
if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
@ -655,7 +655,7 @@ class Menubase
// Define $enabled
$enabled = true;
if ($menu['enabled'])
if (isset($menu['enabled']))
{
$tmpcond = $menu['enabled'];
if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true

View File

@ -254,9 +254,15 @@ class RssParser
libxml_use_internal_errors(false);
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
} else {
if (! function_exists('xml_parser_create')) {
$this->error = 'Function xml_parser_create are not supported by your PHP';
return -1;
}
$xmlparser = xml_parser_create('');
if (!is_resource($xmlparser)) {
$this->error = "ErrorFailedToCreateParser"; return -1;
$this->error = "ErrorFailedToCreateParser";
return -1;
}
xml_set_object($xmlparser, $this);

Some files were not shown because too many files have changed in this diff Show More