Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into fix_develop_issue_2858
Conflicts: htdocs/core/class/ldap.class.php
This commit is contained in:
commit
8c133d8546
@ -15,3 +15,5 @@ indent_style = tab
|
||||
indent_style = tab
|
||||
[*.xml]
|
||||
indent_style = tab
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
@ -285,7 +285,7 @@ script:
|
||||
php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log
|
||||
php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log
|
||||
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
|
||||
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
||||
cd -
|
||||
set +e
|
||||
|
||||
@ -40,7 +40,7 @@ jQuery blockUI 2.70.0 GPL and MIT License Yes
|
||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||
jQuery DataTables 1.9.4 BSD Yes JS library for tables output
|
||||
jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
|
||||
jQuery Flot 0.7 MIT License Yes JS library to build graph
|
||||
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
||||
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
||||
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
||||
jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups)
|
||||
|
||||
43
ChangeLog
43
ChangeLog
@ -12,7 +12,7 @@ Upgrading to any other version or any other database system is abolutely require
|
||||
make a Dolibarr upgrade.
|
||||
|
||||
|
||||
***** ChangeLog for 4.0 compared to 3.9.* *****
|
||||
***** ChangeLog for 4.0.0 compared to 3.9.* *****
|
||||
For users:
|
||||
|
||||
NEW: Add reccuring invoice feature and automatic generation of invoices.
|
||||
@ -162,6 +162,47 @@ So if you included it into your module, change your code like this to be compati
|
||||
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.2 compared to 3.9.1 *****
|
||||
FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN
|
||||
FIX: #5008 SQL error when editing the reference of a supplier invoice that already exists
|
||||
FIX: #5236 Cron module activated but "Modules tools" does not appear in the left menu.
|
||||
FIX: Accountancy - 3.9 - Chart of accounts are limited on only one country
|
||||
FIX: bug on email template
|
||||
FIX: Can't create a stock transfer from product card
|
||||
FIX: can't fetch by siret or siren because of first "if"
|
||||
FIX: Check stock of product by warehouse if $entrepot_id defined on shippings
|
||||
FIX: Compatible with multicompany
|
||||
FIX: Creation of the second ressource type fails.
|
||||
FIX: end of select when no fournprice
|
||||
FIX: Filter on assigned to was preselected on current user on list "All events" (instead of no filtering)
|
||||
FIX: Filter on category tag for suppliers
|
||||
FIX: hook on group card called but not initialized
|
||||
FIX: Infinite loop on menu tree output for edition
|
||||
FIX: Can show tree of entries added by external modules using fk_mainmenu and fk_leftmenu instead of fk_menu.
|
||||
FIX: init var at wrong place report incorrect "shippable" flag on draft order.
|
||||
FIX: It doesn't check if there is enough stock to update the lines of orders/invoices
|
||||
FIX: Menu statistics was not visible if module proposal was not enabled
|
||||
FIX: Merge manually PR #5161 - Bad translation key
|
||||
FIX: missing column when module was installed before standard integration
|
||||
FIX: Missing number total of modules
|
||||
FIX: Not filtering correctly when coming from dashboard
|
||||
FIX: PROPAL_MERGE_PDF with PRODUCT_USE_OLD_PATH
|
||||
FIX: Remove PHP Warning: Creating default object from empty value.
|
||||
FIX: same page added several times on mergepropal option
|
||||
FIX: search on date into supplier invoice list dont work because of status -1
|
||||
FIX: Search supplier ref on contract
|
||||
FIX: Split of credit note into discount page generates records not correctly recognised as credit note.
|
||||
FIX: SQL error function on getAvailableDiscounts function, on bill create mode if socid is empty
|
||||
FIX: #5087
|
||||
FIX: #5108
|
||||
FIX: #5163
|
||||
FIX: #5195
|
||||
FIX: #5203
|
||||
FIX: #5207
|
||||
FIX: #5209
|
||||
FIX: #5230
|
||||
|
||||
***** ChangeLog for 3.9.1 compared to 3.9.* *****
|
||||
FIX: #3815 Call to undefined function local_by_date()
|
||||
FIX: #4424 Missing email of user popup in supplier orders area
|
||||
|
||||
@ -5,4 +5,17 @@ Require all denied
|
||||
<IfVersion < 2.3>
|
||||
Order deny, allow
|
||||
Denied from all
|
||||
</IfVersion>
|
||||
</IfVersion>
|
||||
|
||||
|
||||
# OPTIMIZE: To use cache on static pages (A259200 = 1 month, A7200 = 2 hours, A691600 = 8 days = recommanded for static resources).
|
||||
# Note that you must also enable the module mod_expires.
|
||||
#ExpiresActive On
|
||||
#ExpiresByType image/x-icon A2592000
|
||||
#ExpiresByType image/gif A2592000
|
||||
#ExpiresByType image/png A2592000
|
||||
#ExpiresByType image/jpeg A2592000
|
||||
#ExpiresByType text/css A2592000
|
||||
#ExpiresByType text/javascript A2592000
|
||||
#ExpiresByType application/x-javascript A2592000
|
||||
#ExpiresByType application/javascript A2592000
|
||||
|
||||
@ -101,6 +101,7 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi
|
||||
; Put here path of Wampserver applications
|
||||
; 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 or 5.1.36
|
||||
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 or 5.1.36
|
||||
; Value ???: apache 2.4.19, php 5.5.12, mysql 5.6.17
|
||||
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:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
||||
@ -109,7 +110,7 @@ Source: "C:\Program Files\Wamp\bin\mysql\mysql5.6.17\*.*"; DestDir: "{app}\bin\m
|
||||
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
|
||||
; Dolibarr
|
||||
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
|
||||
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*"
|
||||
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*"
|
||||
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
|
||||
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
|
||||
Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
|
||||
@ -255,9 +256,7 @@ begin
|
||||
|
||||
// Prepare an object calle "Page" of type wpInstalling.
|
||||
// Object will be show later in NextButtonClick function.
|
||||
Page := CreateInputQueryPage(wpInstalling,
|
||||
CustomMessage('TechnicalParameters'), '',
|
||||
CustomMessage('IfFirstInstall'));
|
||||
Page := CreateInputQueryPage(wpInstalling, CustomMessage('TechnicalParameters'), '', CustomMessage('IfFirstInstall'));
|
||||
|
||||
// TODO Add control differently if first install or update
|
||||
if firstinstall
|
||||
@ -334,6 +333,19 @@ begin
|
||||
exedirold := pathWithSlashes+'/bin/mysql/mysql5.6.17';
|
||||
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.6.17';
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Test if VC11Redist has been installed
|
||||
//----------------------------------------------
|
||||
|
||||
if not FileExists ('c:/windows/system32/msvcr70.dll') and not FileExists ('c:/windows/sysWOW64/msvcr70.dll') and not FileExists ('c:/winnt/system32/msvcr70.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr70.dll') then
|
||||
begin
|
||||
// TODO Copy file or ask to install package ?
|
||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
||||
MsgBox('The package vcredist_x64.exe or vcredist_86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
end;
|
||||
|
||||
|
||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
|
||||
// Install of service and stop/start scripts are already rebuild by installer.
|
||||
|
||||
@ -745,7 +745,7 @@ SSLCertificateKeyFile "WAMPROOT/myserver.key"
|
||||
# You can also set this with constant MAIN_OPTIMIZE_SPEED and bit 2 set.
|
||||
#TODO
|
||||
|
||||
# OPTIMIZE: To use cache on static pages (A259200 = 1 month).
|
||||
# OPTIMIZE: To use cache on static pages (A259200 = 1 month, A7200 = 2 hours, A691600 = 8 days = recommanded for static resources).
|
||||
# Note that you must also enable the module mod_expires.
|
||||
#ExpiresActive On
|
||||
#ExpiresByType image/x-icon A2592000
|
||||
|
||||
@ -53,7 +53,7 @@ if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake
|
||||
|
||||
|
||||
use vars qw/ $REVISION $VERSION /;
|
||||
$VERSION="3.3";
|
||||
$VERSION="4.0";
|
||||
|
||||
|
||||
|
||||
@ -356,6 +356,7 @@ if ($nboftargetok) {
|
||||
# Test that the ChangeLog is ok
|
||||
$TMPBUILDTOCHECKCHANGELOG=$BUILD;
|
||||
$TMPBUILDTOCHECKCHANGELOG =~ s/\-rc\d*//;
|
||||
$TMPBUILDTOCHECKCHANGELOG =~ s/\-beta\d*//;
|
||||
print "Check if ChangeLog is ok for version $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG\n";
|
||||
$ret=`grep "ChangeLog for $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG" "$SOURCE/ChangeLog" 2>&1`;
|
||||
if (! $ret)
|
||||
@ -458,6 +459,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdemo`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`;
|
||||
@ -1121,7 +1123,7 @@ if ($nboftargetok) {
|
||||
{
|
||||
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
||||
|
||||
print "\nList of files to publish\n";
|
||||
print "\nList of files to publish (BUILD=$BUILD)\n";
|
||||
%filestoscansf=(
|
||||
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
|
||||
@ -1136,6 +1138,22 @@ if ($nboftargetok) {
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
|
||||
"$DESTI/standard/$FILENAMETGZ.zip"=>'standard'
|
||||
);
|
||||
if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { # Not stable
|
||||
%filestoscansf=(
|
||||
"$DESTI/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
|
||||
"$DESTI/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
|
||||
"$DESTI/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
|
||||
"$DESTI/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
|
||||
"$DESTI/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
|
||||
);
|
||||
%filestoscanstableasso=(
|
||||
"$DESTI/$FILENAMERPM"=>'',
|
||||
"$DESTI/${FILENAMEDEB}_all.deb"=>'',
|
||||
"$DESTI/$FILENAMEEXEDOLIWAMP.exe"=>'',
|
||||
"$DESTI/$FILENAMETGZ.tgz"=>'',
|
||||
"$DESTI/$FILENAMETGZ.zip"=>''
|
||||
);
|
||||
}
|
||||
|
||||
use POSIX qw/strftime/;
|
||||
foreach my $file (sort keys %filestoscansf)
|
||||
|
||||
@ -192,6 +192,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/multicurrency
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
@ -206,6 +207,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/theme
|
||||
%_datadir/dolibarr/htdocs/user
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/websites
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
%_datadir/dolibarr/htdocs/*.php
|
||||
|
||||
@ -272,6 +272,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/multicurrency
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
@ -286,6 +287,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/theme
|
||||
%_datadir/dolibarr/htdocs/user
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/websites
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
%_datadir/dolibarr/htdocs/*.php
|
||||
|
||||
@ -189,6 +189,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/multicurrency
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
@ -203,6 +204,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/theme
|
||||
%_datadir/dolibarr/htdocs/user
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/websites
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
%_datadir/dolibarr/htdocs/*.php
|
||||
|
||||
@ -200,6 +200,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/multicurrency
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
@ -214,6 +215,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/theme
|
||||
%_datadir/dolibarr/htdocs/user
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/websites
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
%_datadir/dolibarr/htdocs/*.php
|
||||
|
||||
@ -17,14 +17,14 @@ fi
|
||||
# To detec
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
|
||||
fi
|
||||
|
||||
# To convert
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
do
|
||||
echo "Fix file $fic"
|
||||
dos2unix "$fic"
|
||||
|
||||
@ -180,8 +180,8 @@ class modMyModule extends DolibarrModules
|
||||
|
||||
// Cronjobs
|
||||
$this->cronjobs = array(); // List of cron jobs entries to add
|
||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
|
||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'test'=>true)
|
||||
// );
|
||||
|
||||
// Permissions
|
||||
@ -241,7 +241,7 @@ class modMyModule extends DolibarrModules
|
||||
// $this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
// $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
// $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled.
|
||||
// $this->export_icon[$r]='generic:MyModule';
|
||||
// $this->export_icon[$r]='generic:MyModule'; // Put here code of icon then string for translation key of module name
|
||||
// $this->export_permission[$r]=array(array("mymodule","level1","level2"));
|
||||
// $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef');
|
||||
// $this->export_TypeFields_array[$r]=array('t.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric', 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
|
||||
@ -85,7 +85,7 @@ if ($web)
|
||||
echo "<body>";
|
||||
}
|
||||
|
||||
echo "If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used.\n";
|
||||
echo "If you call this with argument \"unused=true\" it searches for the translation strings that exist in en_US but are never used.\n";
|
||||
if ($web) print "<br>";
|
||||
echo "IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly.\n";
|
||||
if ($web) print "<br>";
|
||||
@ -96,10 +96,11 @@ if ($web) print "<br>";
|
||||
|
||||
|
||||
// directory containing the php and lang files
|
||||
$htdocs = $path."/../../htdocs/";
|
||||
$htdocs = $path."../../htdocs/";
|
||||
$scripts = $path."../../scripts/";
|
||||
|
||||
// directory containing the english lang files
|
||||
$workdir = $htdocs."langs/en_US/";
|
||||
$workdir = $htdocs."langs/en_US/";
|
||||
|
||||
|
||||
$files = scandir($workdir);
|
||||
@ -109,8 +110,14 @@ if (empty($files))
|
||||
exit;
|
||||
}
|
||||
|
||||
$dups=array();
|
||||
$exludefiles = array('.','..','README');
|
||||
$files = array_diff($files,$exludefiles);
|
||||
// To force a file: $files=array('myfile.lang');
|
||||
if (isset($argv[2]))
|
||||
{
|
||||
$files = array($argv[2]);
|
||||
}
|
||||
$langstrings_3d = array();
|
||||
$langstrings_full = array();
|
||||
foreach ($files AS $file) {
|
||||
@ -127,7 +134,7 @@ foreach ($files AS $file) {
|
||||
$langstrings_3d[$path_file['basename']][$line+1]=$row_array[0];
|
||||
$langstrings_3dtrans[$path_file['basename']][$line+1]=$row_array[1];
|
||||
$langstrings_full[]=$row_array[0];
|
||||
$langstrings_dist[$row_array[0]]=$row_array[0];
|
||||
$langstrings_dist[$row_array[0]]=$row;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -241,26 +248,120 @@ if ($web)
|
||||
|
||||
// STEP 2 - Search key not used
|
||||
|
||||
|
||||
if (! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true')
|
||||
if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($argv[1]) && $argv[1]=='unused=true'))
|
||||
{
|
||||
foreach ($langstrings_dist AS $value)
|
||||
print "***** Strings in en_US that are never used:\n";
|
||||
|
||||
$unused=array();
|
||||
foreach ($langstrings_dist AS $value => $line)
|
||||
{
|
||||
$search = '\'trans("'.$value.'")\'';
|
||||
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'*';
|
||||
$qualifiedforclean=1;
|
||||
// Check if we must keep this key to be into file for removal
|
||||
if (preg_match('/^Module\d+/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Permission\d+/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^PermissionAdvanced\d+/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^ProfId\d+/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Delays_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^BarcodeDesc/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Extrafield/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^LocalTax/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Country/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Civility/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Currency/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^DemandReasonTypeSRC/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^PaperFormat/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^AmountLT/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TotalLT/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Month/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^MonthShort/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Day\d/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Short/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^ExportDataset_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^ImportDataset_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^ActionAC_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TypeLocaltax/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^StatusProspect/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^PL_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TE_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^newLT/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^LT\d/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0;
|
||||
// main.lang
|
||||
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^DateFormat/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^.b$/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^.*Bytes$/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^NoteSomeFeaturesAreDisabled/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) $qualifiedforclean=0;
|
||||
// orders
|
||||
if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TypeContact_/', $value)) $qualifiedforclean=0;
|
||||
// other.lang
|
||||
if (preg_match('/^Notify_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^PredefinedMail/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^DemoCompany/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^WeightUnit/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^LengthUnit/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^SurfaceUnit/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^VolumeUnit/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^SizeUnit/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^EMailText/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/ById$/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/ByLogin$/', $value)) $qualifiedforclean=0;
|
||||
// printing
|
||||
if (preg_match('/PrintingDriverDesc$/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/PrintTestDesc$/', $value)) $qualifiedforclean=0;
|
||||
// products
|
||||
if (preg_match('/GlobalVariableUpdaterType$/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
|
||||
|
||||
if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/descWORKFLOW_/i', $value)) $qualifiedforclean=0;
|
||||
|
||||
if (! $qualifiedforclean)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//$search = '\'trans("'.$value.'")\'';
|
||||
$search = '-e "\''.$value.'\'" -e \'"'.$value.'"\' -e "('.$value.')"';
|
||||
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'* '.$scripts.'*';
|
||||
//print $string."<br>\n";
|
||||
exec($string,$output);
|
||||
if (empty($output)) {
|
||||
$unused[$value] = true;
|
||||
echo $value.'<br>';
|
||||
$unused[$value] = $line;
|
||||
echo $line; // $trad contains the \n
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($output);
|
||||
//print 'X'.$output.'Y';
|
||||
}
|
||||
}
|
||||
|
||||
if ($web) print "<h2>\n";
|
||||
print "Strings in en_US that are never used\n";
|
||||
if ($web) print "</h2>\n";
|
||||
if ($web) echo "<pre>";
|
||||
print_r($unused);
|
||||
if ($web) echo "</pre>\n";
|
||||
if (empty($unused)) print "No string not used found.\n";
|
||||
else
|
||||
{
|
||||
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
||||
file_put_contents($filetosave, join("",$unused));
|
||||
print "To remove from original file, run command :\n";
|
||||
if (($argv[2]?$argv[2]:"")) print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; ";
|
||||
print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2]?$argv[2]:"");
|
||||
if (($argv[2]?$argv[2]:"")) print "; rm ".($argv[2]?$argv[2]:"").".tmp;\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -42,12 +42,15 @@ if (! $sortorder) $sortorder="ASC";
|
||||
$langs->load("admin");
|
||||
$langs->load("compta");
|
||||
|
||||
if (! $user->admin)
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear)
|
||||
accessforbidden();
|
||||
|
||||
$error = 0;
|
||||
|
||||
// List of statut
|
||||
// List of status
|
||||
static $tmpstatut2label = array (
|
||||
'0' => 'OpenFiscalYear',
|
||||
'1' => 'CloseFiscalYear'
|
||||
@ -132,7 +135,7 @@ if ($result) {
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
print '<tr ' . $bc[$var] . '><td colspan="5">' . $langs->trans("None") . '</td></tr>';
|
||||
print '<tr ' . $bc[$var] . '><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home customer ventilation
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home customer ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -44,7 +44,7 @@ if ($user->societe_id > 0)
|
||||
if (! $user->rights->accounting->ventilation->read)
|
||||
accessforbidden();
|
||||
|
||||
// Filter
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
@ -170,35 +170,17 @@ $var = true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AprilMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MayMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JuneMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JulyMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AugustMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("SeptemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("OctoberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("NovemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT IF(aa.account_number IS NULL, 'Non pointe', aa.account_number) AS 'code comptable',";
|
||||
$sql .= " IF(aa.label IS NULL, 'Non pointe', aa.label) AS 'Intitulé',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,fd.total_ht,0)),2) AS 'Fevrier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=4,fd.total_ht,0)),2) AS 'Avril',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=5,fd.total_ht,0)),2) AS 'Mai',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=6,fd.total_ht,0)),2) AS 'Juin',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=7,fd.total_ht,0)),2) AS 'Juillet',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=8,fd.total_ht,0)),2) AS 'Aout',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=9,fd.total_ht,0)),2) AS 'Septembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=10,fd.total_ht,0)),2) AS 'Octobre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=11,fd.total_ht,0)),2) AS 'Novembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=12,fd.total_ht,0)),2) AS 'Decembre',";
|
||||
$sql .= " ROUND(SUM(fd.total_ht),2) as 'Total'";
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
@ -209,7 +191,7 @@ if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation";
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
@ -222,17 +204,9 @@ if ($resql) {
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
print '<td align="right">' . price($row[2]) . '</td>';
|
||||
print '<td align="right">' . price($row[3]) . '</td>';
|
||||
print '<td align="right">' . price($row[4]) . '</td>';
|
||||
print '<td align="right">' . price($row[5]) . '</td>';
|
||||
print '<td align="right">' . price($row[6]) . '</td>';
|
||||
print '<td align="right">' . price($row[7]) . '</td>';
|
||||
print '<td align="right">' . price($row[8]) . '</td>';
|
||||
print '<td align="right">' . price($row[9]) . '</td>';
|
||||
print '<td align="right">' . price($row[10]) . '</td>';
|
||||
print '<td align="right">' . price($row[11]) . '</td>';
|
||||
print '<td align="right">' . price($row[12]) . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
@ -247,34 +221,16 @@ print "</table>\n";
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AprilMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MayMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JuneMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JulyMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AugustMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("SeptemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("OctoberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("NovemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS 'Total',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,fd.total_ht,0)),2) AS 'Fevrier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=4,fd.total_ht,0)),2) AS 'Avril',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=5,fd.total_ht,0)),2) AS 'Mai',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=6,fd.total_ht,0)),2) AS 'Juin',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=7,fd.total_ht,0)),2) AS 'Juillet',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=8,fd.total_ht,0)),2) AS 'Aout',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=9,fd.total_ht,0)),2) AS 'Septembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=10,fd.total_ht,0)),2) AS 'Octobre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=11,fd.total_ht,0)),2) AS 'Novembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=12,fd.total_ht,0)),2) AS 'Decembre',";
|
||||
$sql .= " ROUND(SUM(fd.total_ht),2) as 'Total'";
|
||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
@ -294,18 +250,9 @@ if ($resql) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
print '<td align="right">' . price($row[1]) . '</td>';
|
||||
print '<td align="right">' . price($row[2]) . '</td>';
|
||||
print '<td align="right">' . price($row[3]) . '</td>';
|
||||
print '<td align="right">' . price($row[4]) . '</td>';
|
||||
print '<td align="right">' . price($row[5]) . '</td>';
|
||||
print '<td align="right">' . price($row[6]) . '</td>';
|
||||
print '<td align="right">' . price($row[7]) . '</td>';
|
||||
print '<td align="right">' . price($row[8]) . '</td>';
|
||||
print '<td align="right">' . price($row[9]) . '</td>';
|
||||
print '<td align="right">' . price($row[10]) . '</td>';
|
||||
print '<td align="right">' . price($row[11]) . '</td>';
|
||||
print '<td align="right">' . price($row[12]) . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
@ -320,34 +267,16 @@ if (! empty($conf->margin->enabled)) {
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AprilMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MayMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JuneMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JulyMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AugustMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("SeptemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("OctoberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("NovemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS 'Marge',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Janvier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Fevrier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Mars',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=4,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Avril',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=5,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Mai',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=6,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Juin',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=7,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Juillet',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=8,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Aout',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=9,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Septembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=10,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Octobre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=11,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Novembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=12,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Decembre',";
|
||||
$sql .= " ROUND(SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))),2) as 'Total'";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as 'Total'";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
@ -367,18 +296,9 @@ if (! empty($conf->margin->enabled)) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
print '<td align="right">' . price($row[1]) . '</td>';
|
||||
print '<td align="right">' . price($row[2]) . '</td>';
|
||||
print '<td align="right">' . price($row[3]) . '</td>';
|
||||
print '<td align="right">' . price($row[4]) . '</td>';
|
||||
print '<td align="right">' . price($row[5]) . '</td>';
|
||||
print '<td align="right">' . price($row[6]) . '</td>';
|
||||
print '<td align="right">' . price($row[7]) . '</td>';
|
||||
print '<td align="right">' . price($row[8]) . '</td>';
|
||||
print '<td align="right">' . price($row[9]) . '</td>';
|
||||
print '<td align="right">' . price($row[10]) . '</td>';
|
||||
print '<td align="right">' . price($row[11]) . '</td>';
|
||||
print '<td align="right">' . price($row[12]) . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
@ -393,4 +313,4 @@ print "</table>\n";
|
||||
print '</td></tr></table>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -166,14 +166,13 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->ref = (string) $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
|
||||
@ -207,7 +207,7 @@ if ($action == 'writebookkeeping') {
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->ref = (string) $val["ref"];
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -94,7 +94,7 @@ if ($rowid > 0)
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id)
|
||||
{
|
||||
// $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite
|
||||
// $ User is the user who edits, $ object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
@ -209,7 +209,7 @@ if (empty($reshook))
|
||||
{
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation user
|
||||
// User creation
|
||||
$company = new Societe($db);
|
||||
$result=$company->create_from_member($object,GETPOST('companyname'));
|
||||
|
||||
@ -265,6 +265,11 @@ if (empty($reshook))
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
|
||||
}
|
||||
if ($morphy == 'mor' && empty($societe)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors');
|
||||
}
|
||||
// Test si le login existe deja
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
@ -399,11 +404,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
@ -490,7 +491,7 @@ if (empty($reshook))
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Nature")), null, 'errors');
|
||||
}
|
||||
// Test si le login existe deja
|
||||
// Tests if the login already exists
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
if (empty($login)) {
|
||||
@ -514,6 +515,11 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors');
|
||||
}
|
||||
}
|
||||
if ($morphy == 'mor' && empty($societe)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors');
|
||||
}
|
||||
if ($morphy != 'mor' && empty($lastname)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
@ -540,11 +546,11 @@ if (empty($reshook))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
// Email a peu pres correct et le login n'existe pas
|
||||
// Email about right and login does not exist
|
||||
$result=$object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Categories association
|
||||
// Foundation categories
|
||||
$memcats = GETPOST('memcats', 'array');
|
||||
$object->setCategories($memcats);
|
||||
|
||||
@ -605,7 +611,7 @@ if (empty($reshook))
|
||||
|
||||
if ($result >= 0 && ! count($object->errors))
|
||||
{
|
||||
// Send confirmation Email (selon param du type adherent sinon generique)
|
||||
// Send confirmation email (according to parameters of member type. Otherwise generic)
|
||||
if ($object->email && GETPOST("send_mail"))
|
||||
{
|
||||
$result=$object->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
|
||||
@ -854,7 +860,7 @@ else
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="address" wrap="soft" cols="40" rows="2">'.(GETPOST('address','alpha')?GETPOST('address','alpha'):$object->address).'</textarea>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOST('address','alpha')?GETPOST('address','alpha'):$object->address).'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
@ -1115,7 +1121,7 @@ else
|
||||
|
||||
// Address
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="address" wrap="soft" cols="40" rows="2">'.(isset($_POST["address"])?$_POST["address"]:$object->address).'</textarea>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(isset($_POST["address"])?$_POST["address"]:$object->address).'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
@ -1369,7 +1375,7 @@ else
|
||||
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
|
||||
$label=$form->textwithpicto($tmp,$helpcontent,1,'help');
|
||||
|
||||
// Cree un tableau formulaire
|
||||
// Create an array
|
||||
$formquestion=array();
|
||||
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false'));
|
||||
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
|
||||
@ -1433,6 +1439,12 @@ else
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i','*',$object->pass);
|
||||
if ($object->pass) print preg_replace('/./i','*',$object->pass);
|
||||
else
|
||||
{
|
||||
if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
|
||||
else print $langs->trans("Hidden");
|
||||
}
|
||||
if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id))
|
||||
{
|
||||
$langs->load("errors");
|
||||
@ -1441,7 +1453,7 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
@ -1473,6 +1485,30 @@ else
|
||||
print $object->showOptionals($extrafields, 'view', $parameters);
|
||||
}
|
||||
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
||||
if ($object->datefin)
|
||||
{
|
||||
print dol_print_date($object->datefin,'day');
|
||||
if ($object->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("Late"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $adht->cotisation)
|
||||
{
|
||||
print $langs->trans("SubscriptionNotRecorded");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party Dolibarr
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
@ -1543,30 +1579,6 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
||||
if ($object->datefin)
|
||||
{
|
||||
print dol_print_date($object->datefin,'day');
|
||||
if ($object->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("Late"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $adht->cotisation)
|
||||
{
|
||||
print $langs->trans("SubscriptionNotRecorded");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div></div>\n";
|
||||
|
||||
@ -53,6 +53,10 @@ $result=restrictedArea($user,'adherent',$rowid,'','cotisation');
|
||||
$object = new Adherent($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$adht = new AdherentType($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$errmsg='';
|
||||
$errmsgs=array();
|
||||
|
||||
@ -379,6 +383,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
|
||||
$invoice->socid=$object->fk_soc;
|
||||
$invoice->date=$datecotisation;
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$invoice->linked_objects['subscription'] = $crowid;
|
||||
if (! empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects']))
|
||||
{
|
||||
$invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']);
|
||||
}
|
||||
|
||||
$result=$invoice->create($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
@ -641,6 +652,30 @@ if ($rowid > 0)
|
||||
print $object->showOptionals($extrafields, 'view', $parameters);
|
||||
}
|
||||
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
||||
if ($object->datefin)
|
||||
{
|
||||
print dol_print_date($object->datefin,'day');
|
||||
if ($object->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("Late"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $adht->cotisation)
|
||||
{
|
||||
print $langs->trans("SubscriptionNotRecorded");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party Dolibarr
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
@ -711,30 +746,6 @@ if ($rowid > 0)
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
||||
if ($object->datefin)
|
||||
{
|
||||
print dol_print_date($object->datefin,'day');
|
||||
if ($object->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("Late"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $adht->cotisation)
|
||||
{
|
||||
print $langs->trans("SubscriptionNotRecorded");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div></div>\n";
|
||||
|
||||
@ -47,8 +47,15 @@ class Adherent extends CommonObject
|
||||
var $mesgs;
|
||||
|
||||
var $login;
|
||||
var $pass;
|
||||
var $societe;
|
||||
|
||||
//! Clear password in memory
|
||||
var $pass;
|
||||
//! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
|
||||
var $pass_indatabase;
|
||||
//! Encrypted password in database (always defined)
|
||||
var $pass_indatabase_crypted;
|
||||
|
||||
var $societe;
|
||||
var $company;
|
||||
var $address;
|
||||
var $zip;
|
||||
@ -309,7 +316,7 @@ class Adherent extends CommonObject
|
||||
if ($id > 0)
|
||||
{
|
||||
$this->id=$id;
|
||||
$this->ref=$id;
|
||||
$this->ref=(string) $id;
|
||||
|
||||
// Update minor fields
|
||||
$result=$this->update($user,1,1,0,0,'add'); // nosync is 1 to avoid update data of user
|
||||
@ -482,8 +489,10 @@ class Adherent extends CommonObject
|
||||
dol_syslog(get_class($this)."::update update password");
|
||||
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted)
|
||||
{
|
||||
// Si mot de passe saisi et different de celui en base
|
||||
$result=$this->setPassword($user,$this->pass,0,$notrigger,$nosyncuserpass);
|
||||
$isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1;
|
||||
|
||||
// If password to set differs from the one found into database
|
||||
$result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass);
|
||||
if (! $nbrowsaffected) $nbrowsaffected++;
|
||||
}
|
||||
}
|
||||
@ -509,7 +518,7 @@ class Adherent extends CommonObject
|
||||
if (! $error && $nbrowsaffected) // If something has change in main data
|
||||
{
|
||||
// Update information on linked user if it is an update
|
||||
if ($this->user_id > 0 && ! $nosyncuser)
|
||||
if (! $error && $this->user_id > 0 && ! $nosyncuser)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
@ -552,7 +561,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
// Update information on linked thirdparty if it is an update
|
||||
if ($this->fk_soc > 0 && ! $nosyncthirdparty)
|
||||
if (! $error && $this->fk_soc > 0 && ! $nosyncthirdparty)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
@ -810,13 +819,11 @@ class Adherent extends CommonObject
|
||||
$password=getRandomPassword(false);
|
||||
}
|
||||
|
||||
// Cryptage mot de passe
|
||||
if ($isencrypted)
|
||||
{
|
||||
// Encryption
|
||||
$password_indatabase = dol_hash($password);
|
||||
}
|
||||
else
|
||||
// Crypt password
|
||||
$password_crypted = dol_hash($password);
|
||||
|
||||
$password_indatabase = '';
|
||||
if (! $isencrypted)
|
||||
{
|
||||
$password_indatabase = $password;
|
||||
}
|
||||
@ -824,7 +831,17 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
|
||||
$sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."'";
|
||||
//if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
||||
if ($isencrypted)
|
||||
{
|
||||
$sql.= ", pass = null";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= ", pass = '".$this->db->escape($password_indatabase)."'";
|
||||
}
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
//dol_syslog("Adherent::Password sql=hidden");
|
||||
@ -838,7 +855,8 @@ class Adherent extends CommonObject
|
||||
{
|
||||
$this->pass=$password;
|
||||
$this->pass_indatabase=$password_indatabase;
|
||||
|
||||
$this->pass_indatabase_crypted=$password_crypted;
|
||||
|
||||
if ($this->user_id && ! $nosyncuser)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
@ -1042,7 +1060,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql.= " d.note_public,";
|
||||
$sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
|
||||
$sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
|
||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
||||
$sql.= " d.datec as datec,";
|
||||
$sql.= " d.tms as datem,";
|
||||
@ -1087,7 +1105,6 @@ class Adherent extends CommonObject
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->login = $obj->login;
|
||||
$this->pass = $obj->pass;
|
||||
$this->societe = $obj->company;
|
||||
$this->company = $obj->company;
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
@ -1095,6 +1112,10 @@ class Adherent extends CommonObject
|
||||
$this->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
|
||||
$this->pass = $obj->pass;
|
||||
$this->pass_indatabase = $obj->pass;
|
||||
$this->pass_indatabase_crypted = $obj->pass_crypted;
|
||||
|
||||
$this->state_id = $obj->state_id;
|
||||
$this->state_code = $obj->state_id?$obj->state_code:'';
|
||||
$this->state = $obj->state_id?$obj->state:'';
|
||||
@ -1423,9 +1444,10 @@ class Adherent extends CommonObject
|
||||
$err=0;
|
||||
|
||||
// mailman
|
||||
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||
if (! empty($conf->global->ADHERENT_USE_MAILMAN) && ! empty($conf->mailmanspip->enabled))
|
||||
{
|
||||
$result=$mailmanspip->add_to_mailman($this);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error;
|
||||
@ -1444,7 +1466,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
// spip
|
||||
if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled))
|
||||
if (! empty($conf->global->ADHERENT_USE_SPIP) && ! empty($conf->mailmanspip->enabled))
|
||||
{
|
||||
$result=$mailmanspip->add_to_spip($this);
|
||||
if ($result < 0)
|
||||
@ -1458,7 +1480,7 @@ class Adherent extends CommonObject
|
||||
return -$err;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -1556,6 +1578,7 @@ class Adherent extends CommonObject
|
||||
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
$link=''; $linkend='';
|
||||
if ($option == 'card')
|
||||
{
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
|
||||
@ -1737,7 +1760,7 @@ class Adherent extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
|
||||
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1';
|
||||
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
$response->img=img_object($langs->trans("Members"),"user");
|
||||
|
||||
$adherentstatic = new Adherent($this->db);
|
||||
@ -2006,14 +2029,18 @@ class Adherent extends CommonObject
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a member is late (subscription late) or not
|
||||
*
|
||||
* @return boolean True if late, False if not late
|
||||
*/
|
||||
public function hasDelay()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//Only valid members
|
||||
if ($this->statut <= 0) {
|
||||
return false;
|
||||
}
|
||||
if ($this->statut <= 0) return false;
|
||||
if (! $this->datefin) return false;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
@ -213,7 +213,7 @@ class Cotisation extends CommonObject
|
||||
$result=$member->fetch($this->fk_adherent);
|
||||
$result=$member->update_end_date($user);
|
||||
|
||||
if ($accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
|
||||
if (is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
|
||||
{
|
||||
$result=$accountline->delete($user); // Return false if refused because line is conciliated
|
||||
if ($result > 0)
|
||||
|
||||
@ -128,9 +128,10 @@ if ($result)
|
||||
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($statut != '') $param.="&statut=".$statut;
|
||||
if ($date_select) $param.="&date_select=".$date_select;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
|
||||
if ($search_login) $param.="&search_login=".$search_login;
|
||||
if ($search_acount) $param.="&search_account=".$search_account;
|
||||
|
||||
@ -33,35 +33,49 @@ $langs->load("members");
|
||||
$langs->load("users");
|
||||
|
||||
$adh = new Adherent($db);
|
||||
$subscription = new Cotisation($db);
|
||||
$object = new Cotisation($db);
|
||||
$errmsg='';
|
||||
|
||||
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
||||
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
||||
$typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"];
|
||||
$action=GETPOST("action",'alpha');
|
||||
$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int");
|
||||
$typeid=GETPOST("typeid","int");
|
||||
$cancel=GETPOST('cancel');
|
||||
|
||||
if (! $user->rights->adherent->cotisation->lire)
|
||||
accessforbidden();
|
||||
|
||||
$permissionnote = $user->rights->adherent->cotisation->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel) $action='';
|
||||
|
||||
//include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
|
||||
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update' && ! $_POST["cancel"])
|
||||
{
|
||||
// Charge objet actuel
|
||||
$result=$subscription->fetch($_POST["rowid"]);
|
||||
$result=$object->fetch($_POST["rowid"]);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$errmsg='';
|
||||
|
||||
if ($subscription->fk_bank)
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
$accountline=new AccountLine($db);
|
||||
$result=$accountline->fetch($subscription->fk_bank);
|
||||
$result=$accountline->fetch($object->fk_bank);
|
||||
|
||||
// If transaction consolidated
|
||||
if ($accountline->rappro)
|
||||
@ -84,31 +98,31 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update
|
||||
if (! $errmsg)
|
||||
{
|
||||
// Modifie valeures
|
||||
$subscription->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||
$subscription->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']);
|
||||
$subscription->note=$_POST["note"];
|
||||
$subscription->amount=$_POST["amount"];
|
||||
//print 'datef='.$subscription->datef.' '.$_POST['datesubendday'];
|
||||
$object->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||
$object->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']);
|
||||
$object->note=$_POST["note"];
|
||||
$object->amount=$_POST["amount"];
|
||||
//print 'datef='.$object->datef.' '.$_POST['datesubendday'];
|
||||
|
||||
$result=$subscription->update($user);
|
||||
if ($result >= 0 && ! count($subscription->errors))
|
||||
$result=$object->update($user);
|
||||
if ($result >= 0 && ! count($object->errors))
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
header("Location: fiche_subscription.php?rowid=".$subscription->id);
|
||||
header("Location: fiche_subscription.php?rowid=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
|
||||
if ($subscription->error)
|
||||
if ($object->error)
|
||||
{
|
||||
$errmsg=$subscription->error;
|
||||
$errmsg=$object->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($subscription->errors as $error)
|
||||
foreach($object->errors as $error)
|
||||
{
|
||||
if ($errmsg) $errmsg.='<br>';
|
||||
$errmsg.=$error;
|
||||
@ -126,11 +140,11 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update
|
||||
|
||||
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
$result=$subscription->fetch($rowid);
|
||||
$result=$subscription->delete($user);
|
||||
$result=$object->fetch($rowid);
|
||||
$result=$object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: card_subscriptions.php?rowid=".$subscription->fk_adherent);
|
||||
header("Location: card_subscriptions.php?rowid=".$object->fk_adherent);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -145,11 +159,12 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' &&
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
|
||||
dol_htmloutput_errors($errmsg);
|
||||
|
||||
|
||||
@ -161,8 +176,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
*
|
||||
********************************************/
|
||||
|
||||
$subscription->fetch($rowid);
|
||||
$result=$adh->fetch($subscription->fk_adherent);
|
||||
$object->fetch($rowid);
|
||||
$result=$adh->fetch($object->fk_adherent);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
@ -170,12 +185,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("SubscriptionCard");
|
||||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
@ -184,7 +199,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
|
||||
print "<input type=\"hidden\" name=\"fk_bank\" value=\"".$subscription->fk_bank."\">";
|
||||
print "<input type=\"hidden\" name=\"fk_bank\" value=\"".$object->fk_bank."\">";
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
|
||||
|
||||
@ -196,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur" colspan="3">';
|
||||
print $form->showrefnav($subscription, 'rowid', $linkback, 1);
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Member
|
||||
@ -207,34 +222,34 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
|
||||
// Date start subscription
|
||||
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
|
||||
$form->select_date($subscription->dateh,'datesub',1,1,0,'update',1);
|
||||
$form->select_date($object->dateh,'datesub',1,1,0,'update',1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="2">';
|
||||
$form->select_date($subscription->datef,'datesubend',0,0,0,'update',1);
|
||||
$form->select_date($object->datef,'datesubend',0,0,0,'update',1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="2">';
|
||||
print '<input type="text" class="flat" size="10" name="amount" value="'.price($subscription->amount).'"></td></tr>';
|
||||
print '<input type="text" class="flat" size="10" name="amount" value="'.price($object->amount).'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur" colspan="2">';
|
||||
print '<input type="text" class="flat" size="60" name="note" value="'.$subscription->note.'"></td></tr>';
|
||||
print '<input type="text" class="flat" size="60" name="note" value="'.$object->note.'"></td></tr>';
|
||||
|
||||
// Bank line
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank)
|
||||
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="2">';
|
||||
if ($subscription->fk_bank)
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$result=$bankline->fetch($subscription->fk_bank);
|
||||
$result=$bankline->fetch($object->fk_bank);
|
||||
print $bankline->getNomUrl(1,0,'showall');
|
||||
}
|
||||
else
|
||||
@ -267,8 +282,8 @@ if ($rowid && $action != 'edit')
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
$result=$subscription->fetch($rowid);
|
||||
$result=$adh->fetch($subscription->fk_adherent);
|
||||
$result=$object->fetch($rowid);
|
||||
$result=$adh->fetch($object->fk_adherent);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
@ -276,12 +291,12 @@ if ($rowid && $action != 'edit')
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("SubscriptionCard");
|
||||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
@ -295,7 +310,7 @@ if ($rowid && $action != 'edit')
|
||||
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
|
||||
$text=$langs->trans("ConfirmDeleteSubscription");
|
||||
if (! empty($conf->banque->enabled) && ! empty($conf->global->ADHERENT_BANK_USE)) $text.='<br>'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1);
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
@ -307,7 +322,7 @@ if ($rowid && $action != 'edit')
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur" colspan="3">';
|
||||
print $form->showrefnav($subscription, 'rowid', $linkback, 1);
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Member
|
||||
@ -318,35 +333,35 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
// Date record
|
||||
/*print '<tr>';
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($subscription->datec,'dayhour').'</td>';
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($object->datec,'dayhour').'</td>';
|
||||
print '</tr>';*/
|
||||
|
||||
// Date subscription
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($subscription->dateh,'day').'</td>';
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($object->dateh,'day').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end subscription
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($subscription->datef,'day').'</td>';
|
||||
print '<td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($object->datef,'day').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="3">'.price($subscription->amount).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="3">'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur" colspan="3">'.$subscription->note.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur" colspan="3">'.$object->note.'</td></tr>';
|
||||
|
||||
// Bank line
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank)
|
||||
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="3">';
|
||||
if ($subscription->fk_bank)
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$result=$bankline->fetch($subscription->fk_bank);
|
||||
$result=$bankline->fetch($object->fk_bank);
|
||||
print $bankline->getNomUrl(1,0,'showall');
|
||||
}
|
||||
else
|
||||
@ -373,7 +388,7 @@ if ($rowid && $action != 'edit')
|
||||
{
|
||||
if (! $bankline->rappro)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=edit\">".$langs->trans("Modify")."</a></div>";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id."&action=edit\">".$langs->trans("Modify")."</a></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -384,12 +399,49 @@ if ($rowid && $action != 'edit')
|
||||
// Supprimer
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=delete\">".$langs->trans("Delete")."</a></div>\n";
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id."&action=delete\">".$langs->trans("Delete")."</a></div>\n";
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
// Documents generes
|
||||
/*
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||
$genallowed = $user->rights->facture->creer;
|
||||
$delallowed = $user->rights->facture->supprimer;
|
||||
|
||||
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
*/
|
||||
// Linked object block
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
// Link for paypal payment
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
||||
}
|
||||
*/
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid);
|
||||
*/
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
55
htdocs/adherents/tpl/linkedobjectblock.tpl.php
Normal file
55
htdocs/adherents/tpl/linkedobjectblock.tpl.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
$langs->load("members");
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $langs->trans("Subscription"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->dateh,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->adherent->lire) {
|
||||
$total = $total + $objectlink->amount;
|
||||
echo price($objectlink->amount);
|
||||
} ?></td>
|
||||
<td align="right"></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -166,8 +166,8 @@ else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->COMMANDE_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
@ -181,8 +181,8 @@ else if ($action == 'setdoc')
|
||||
|
||||
else if ($action == 'setmod')
|
||||
{
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
// TODO Check if numbering module chosen can be activated
|
||||
// by calling method canBeActivated
|
||||
|
||||
dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
@ -494,7 +494,7 @@ foreach ($dirmodels as $reldir)
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
// Default
|
||||
print '<td align="center">';
|
||||
if ($conf->global->COMMANDE_ADDON_PDF == $name)
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -308,13 +308,15 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th width="35%">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
|
||||
// Name
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<input name="nom" id="name" size="30" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM:$_POST["nom"]) . '" autofocus="autofocus"></td></tr>'."\n";
|
||||
|
||||
// Addresse
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||
print '<textarea name="address" id="address" cols="80" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:$_POST["address"]) . '</textarea></td></tr>'."\n";
|
||||
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:$_POST["address"]) . '</textarea></td></tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||
@ -392,14 +394,14 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// Note
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td valign="top"><label for="note">'.$langs->trans("Note").'</label></td><td>';
|
||||
print '<textarea class="flat" name="note" id="note" cols="80" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '').'</textarea></td></tr>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '').'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Identifiants de la societe (country-specific)
|
||||
// IDs of the company (country-specific)
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
$var=true;
|
||||
@ -416,7 +418,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '<tr '.$bc[$var].'><td width="35%"><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
|
||||
print '<input name="capital" id="capital" size="20" value="' . $conf->global->MAIN_INFO_CAPITAL . '"></td></tr>';
|
||||
|
||||
// Forme juridique
|
||||
// Juridical Status
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
|
||||
if ($mysoc->country_code) {
|
||||
@ -531,7 +533,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// Object of the company
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%"><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
|
||||
print '<textarea class="flat" name="object" id="object" cols="80" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -764,7 +766,7 @@ else
|
||||
print $mysoc->logo;
|
||||
print '</td><td class="nocellnopadd" valign="center" align="right">';
|
||||
|
||||
// On propose la generation de la vignette si elle n'existe pas
|
||||
// It offers the generation of the thumbnail if it does not exist
|
||||
if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=addthumb&file='.urlencode($mysoc->logo).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'</a> ';
|
||||
@ -790,7 +792,7 @@ else
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Identifiants de la societe (country-specific)
|
||||
// IDs of the company (country-specific)
|
||||
print '<form name="formsoc" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -807,7 +809,7 @@ else
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>';
|
||||
print $conf->global->MAIN_INFO_CAPITAL . '</td></tr>';
|
||||
|
||||
// Forme juridique
|
||||
// Juridical Status
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("JuridicalStatus").'</td><td>';
|
||||
print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
|
||||
@ -898,7 +900,7 @@ else
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// TVA
|
||||
// VAT
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("VATIntra").'</td>';
|
||||
print '<td>';
|
||||
@ -943,7 +945,7 @@ else
|
||||
print '</form>';
|
||||
|
||||
/*
|
||||
* Debut d'annee fiscale
|
||||
* fiscal year beginning
|
||||
*/
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -960,7 +962,7 @@ else
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
* Options fiscale
|
||||
* tax options
|
||||
*/
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -114,7 +114,7 @@ print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Cas du parametre ACCOUNTING_MODE
|
||||
// case of the parameter ACCOUNTING_MODE
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('OptionMode').'</td><td>'.$langs->trans('Description').'</td>';
|
||||
|
||||
@ -41,6 +41,10 @@ $modules=array(
|
||||
)
|
||||
),
|
||||
'projet' => array(
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE',
|
||||
'img' => 'project'
|
||||
),
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_TASKS_TODO',
|
||||
'img' => 'task'
|
||||
|
||||
@ -42,7 +42,7 @@ if (! $user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='invoice';
|
||||
|
||||
|
||||
@ -380,7 +380,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -566,7 +566,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -578,7 +578,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -62,6 +62,23 @@ if ($action == 'update')
|
||||
{
|
||||
if (! $_POST['cancel'])
|
||||
{
|
||||
$leftmenu=''; $mainmenu='';
|
||||
if (! empty($_POST['menuIdParent']) && ! is_numeric($_POST['menuIdParent']))
|
||||
{
|
||||
$tmp=explode('&',$_POST['menuIdParent']);
|
||||
foreach($tmp as $s)
|
||||
{
|
||||
if (preg_match('/fk_mainmenu=/',$s))
|
||||
{
|
||||
$mainmenu=preg_replace('/fk_mainmenu=/','',$s);
|
||||
}
|
||||
if (preg_match('/fk_leftmenu=/',$s))
|
||||
{
|
||||
$leftmenu=preg_replace('/fk_leftmenu=/','',$s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$menu = new Menubase($db);
|
||||
$result=$menu->fetch($_POST['menuId']);
|
||||
if ($result > 0)
|
||||
@ -75,7 +92,18 @@ if ($action == 'update')
|
||||
$menu->perms=$_POST['perms'];
|
||||
$menu->target=$_POST['target'];
|
||||
$menu->user=$_POST['user'];
|
||||
$menu->fk_menu=$_POST['fk_menu'];
|
||||
if (is_numeric($_POST['menuIdParent']))
|
||||
{
|
||||
$menu->fk_menu=$_POST['menuIdParent'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_POST['type'] == 'top') $menu->fk_menu=0;
|
||||
else $menu->fk_menu=-1;
|
||||
$menu->fk_mainmenu=$mainmenu;
|
||||
$menu->fk_leftmenu=$leftmenu;
|
||||
}
|
||||
|
||||
$result=$menu->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -342,7 +370,7 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td><input type="text" size="20" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
|
||||
print '<td><input type="text" size="40" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
|
||||
}
|
||||
print '<td>'.$langs->trans('DetailMenuIdParent');
|
||||
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
|
||||
@ -425,12 +453,15 @@ elseif ($action == 'edit')
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>';
|
||||
|
||||
// MenuId Parent
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent');
|
||||
print '</td>';
|
||||
$valtouse=$menu->fk_menu;
|
||||
if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu;
|
||||
if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu;
|
||||
print '<td><input type="text" name="fk_menu" value="'.$valtouse.'" size="10"></td>';
|
||||
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
|
||||
print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" size="40"></td>';
|
||||
print '<td>'.$langs->trans('DetailMenuIdParent');
|
||||
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
|
||||
print '</td></tr>';
|
||||
|
||||
// Niveau
|
||||
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
|
||||
|
||||
@ -361,7 +361,7 @@ if ($conf->use_javascript_ajax)
|
||||
|
||||
if (count($remainingdata))
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';
|
||||
|
||||
@ -138,6 +138,7 @@ $list = array (
|
||||
'OAUTH_GOOGLE_NAME',
|
||||
'OAUTH_GOOGLE_ID',
|
||||
'OAUTH_GOOGLE_SECRET',
|
||||
'OAUTH_GOOGLE_DESC',
|
||||
),
|
||||
array(
|
||||
'OAUTH_HUBIC_NAME',
|
||||
@ -323,7 +324,11 @@ foreach ($list as $key)
|
||||
print '<tr class="liste_titre">';
|
||||
// Api Name
|
||||
$label = $langs->trans($key[0]);
|
||||
print '<td colspan="2">'.$label.'</td></tr>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td>';
|
||||
if (! empty($key[3])) print $langs->trans($key[3]);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($supported)
|
||||
{
|
||||
|
||||
@ -317,13 +317,13 @@ $found++;
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td colspan="2">'.$langs->trans("NoModueToManageStockIncrease").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockIncrease").'</td>';
|
||||
print "</tr>\n";
|
||||
}*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Optio to force stock to be enough before adding a line into document
|
||||
// Option to force stock to be enough before adding a line into document
|
||||
if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
@ -104,7 +104,7 @@ if (file_exists($xmlfile))
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr ' . $bc[false] . '><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr ' . $bc[false] . '><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -136,7 +136,7 @@ if (file_exists($xmlfile))
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr ' . $bc[false] . '><td colspan="5">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
@ -53,6 +53,8 @@ if ($file && ! $what)
|
||||
exit;
|
||||
}
|
||||
|
||||
$errormsg='';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -120,16 +122,37 @@ if ($what == 'mysql')
|
||||
{
|
||||
|
||||
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
|
||||
if ($cmddump)
|
||||
if (! empty($dolibarr_main_restrict_os_commands))
|
||||
{
|
||||
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
|
||||
$ok=0;
|
||||
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that on of this command is inside ".$cmddump);
|
||||
foreach($arrayofallowedcommand as $allowedcommand)
|
||||
{
|
||||
if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump))
|
||||
{
|
||||
$ok=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (! $ok)
|
||||
{
|
||||
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $errormsg && $cmddump)
|
||||
{
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
|
||||
$errormsg=$utils->error;
|
||||
$_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone'];
|
||||
$_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun'];
|
||||
if (! $errormsg)
|
||||
{
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
$errormsg=$utils->error;
|
||||
$_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone'];
|
||||
$_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun'];
|
||||
}
|
||||
}
|
||||
|
||||
// MYSQL NO BIN
|
||||
@ -146,16 +169,19 @@ if ($what == 'mysqlnobin')
|
||||
if ($what == 'postgresql')
|
||||
{
|
||||
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
|
||||
if ($cmddump)
|
||||
|
||||
if (! $errormsg && $cmddump)
|
||||
{
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
|
||||
$errormsg=$utils->error;
|
||||
$_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone'];
|
||||
$_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun'];
|
||||
if (! $errormsg)
|
||||
{
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
$errormsg=$utils->error;
|
||||
$_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone'];
|
||||
$_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun'];
|
||||
}
|
||||
|
||||
$what=''; // Clear to show message to run command
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ $conf_fkaccount_cb = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))?$_SESSIO
|
||||
|
||||
|
||||
// View parameters
|
||||
$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?500:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes
|
||||
$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?1000:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes
|
||||
$conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes
|
||||
|
||||
// Add hidden option to force decrease of stock whatever is user setup
|
||||
|
||||
@ -617,13 +617,14 @@ else if ($id || $ref)
|
||||
* @param Object $object Object we want to see categories it can be classified into
|
||||
* @param int $typeid Type of category (0, 1, 2, 3)
|
||||
* @param int $socid Id thirdparty
|
||||
* @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
|
||||
* @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
|
||||
* @return int 0
|
||||
*/
|
||||
function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
|
||||
{
|
||||
global $user,$langs,$form,$bc;
|
||||
|
||||
$title='NotDefined';
|
||||
if ($typeid == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoriesShort");
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoriesShort");
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort");
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
@ -43,13 +43,13 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
class Categorie extends CommonObject
|
||||
{
|
||||
// Categories types
|
||||
const TYPE_PRODUCT = 0;
|
||||
const TYPE_SUPPLIER = 1;
|
||||
const TYPE_CUSTOMER = 2;
|
||||
const TYPE_MEMBER = 3;
|
||||
const TYPE_CONTACT = 4;
|
||||
const TYPE_USER = 4; // categorie contact and user are same !
|
||||
const TYPE_ACCOUNT = 5; // bank account
|
||||
const TYPE_PRODUCT = 0; // TODO Replace with value 'product'
|
||||
const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier'
|
||||
const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer'
|
||||
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||
const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account'
|
||||
|
||||
/**
|
||||
* @var array ID mapping from type string
|
||||
@ -63,7 +63,7 @@ class Categorie extends CommonObject
|
||||
'member' => 3,
|
||||
'contact' => 4,
|
||||
'user' => 4,
|
||||
'account' => 5,
|
||||
'account' => 5,
|
||||
);
|
||||
/**
|
||||
* @var array Foreign keys mapping from type string
|
||||
@ -149,7 +149,7 @@ class Categorie extends CommonObject
|
||||
*/
|
||||
var $type;
|
||||
|
||||
var $cats=array(); // Tableau en memoire des categories
|
||||
var $cats=array(); // Categories table in memory
|
||||
var $motherof=array();
|
||||
|
||||
/**
|
||||
@ -232,9 +232,9 @@ class Categorie extends CommonObject
|
||||
* Add category into database
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @return int -1 : erreur SQL
|
||||
* -2 : nouvel ID inconnu
|
||||
* -3 : categorie invalide
|
||||
* @return int -1 : SQL error
|
||||
* -2 : new ID unknown
|
||||
* -3 : Invalid category
|
||||
* -4 : category already exists
|
||||
*/
|
||||
function create($user)
|
||||
@ -304,7 +304,7 @@ class Categorie extends CommonObject
|
||||
$action='create';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
// TODO the hook duplicates the trigger !!
|
||||
$hookmanager->initHooks(array('HookModuleNamedao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -398,7 +398,7 @@ class Categorie extends CommonObject
|
||||
$action='update';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
// TODO the hook duplicates the trigger !!
|
||||
$hookmanager->initHooks(array('HookCategorydao'));
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -867,8 +867,8 @@ class Categorie extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstruit l'arborescence des categories sous la forme d'un tableau
|
||||
* Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec:
|
||||
* Rebuilding the category tree as an array
|
||||
* Return an array of table('id','id_mere',...) trie selon arbre et avec:
|
||||
* id = id de la categorie
|
||||
* id_mere = id de la categorie mere
|
||||
* id_children = tableau des id enfant
|
||||
@ -1717,6 +1717,6 @@ class Categorie extends CommonObject
|
||||
'categorie_societe'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("NoSubCat")."</td></tr>";
|
||||
print "<tr ".$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoSubCat")."</td></tr>";
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
@ -371,7 +371,7 @@ if ($object->type == Categorie::TYPE_PRODUCT)
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[false].'><td colspan="2">'.$langs->trans("ThisCategoryHasNoProduct")."</td></tr>";
|
||||
print "<tr ".$bc[false].'><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoProduct")."</td></tr>";
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
@ -422,7 +422,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER)
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[false]."><td>".$langs->trans("ThisCategoryHasNoSupplier")."</td></tr>";
|
||||
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoSupplier").'</td></tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
@ -475,7 +475,7 @@ if($object->type == Categorie::TYPE_CUSTOMER)
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[false]."><td>".$langs->trans("ThisCategoryHasNoCustomer")."</td></tr>";
|
||||
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoCustomer").'</td></tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
@ -529,7 +529,7 @@ if ($object->type == Categorie::TYPE_MEMBER)
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("ThisCategoryHasNoMember")."</td></tr>";
|
||||
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoMember").'</td></tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
@ -582,7 +582,7 @@ if($object->type == Categorie::TYPE_CONTACT)
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[false]."><td>".$langs->trans("ThisCategoryHasNoContact")."</td></tr>";
|
||||
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoContact").'</td></tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
@ -636,7 +636,7 @@ if ($object->type == Categorie::TYPE_ACCOUNT)
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("ThisCategoryHasNoAccount")."</td></tr>";
|
||||
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoAccount").'</td></tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
@ -1445,7 +1445,7 @@ if ($id > 0)
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
|
||||
print img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -1454,7 +1454,7 @@ if ($id > 0)
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
|
||||
print img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -1463,7 +1463,7 @@ if ($id > 0)
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
|
||||
print img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
|
||||
print '</form>'."\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -932,6 +932,7 @@ class ActionComm extends CommonObject
|
||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||
$response->label = $langs->trans("ActionsToDo");
|
||||
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
||||
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||
$response->img = img_object($langs->trans("Actions"),"action");
|
||||
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
|
||||
@ -208,7 +208,7 @@ class ICal
|
||||
|
||||
//print 'type='.$type.' key='.$key.' value='.$value.'<br>'."\n";
|
||||
|
||||
if ($key == false)
|
||||
if (empty($key))
|
||||
{
|
||||
$key = $this->last_key;
|
||||
switch ($type)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
@ -78,7 +78,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
|
||||
}
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
//$year=GETPOST("year");
|
||||
$resourceid=GETPOST("resourceid","int");
|
||||
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||
@ -292,6 +292,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions");
|
||||
|
||||
$param='';
|
||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($filtert) $param.="&filtert=".$filtert;
|
||||
@ -349,7 +350,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
||||
$head = calendars_prepare_head($paramnoaction);
|
||||
|
||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
|
||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup,'', $resourceid);
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -424,7 +425,7 @@ else // If javascript off
|
||||
$link.='</a>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($s, $link.' '.$nav, '');
|
||||
print load_fiche_titre($s, $link.' '.$nav, '', 0, 0, 'tablelistofcalendars');
|
||||
|
||||
|
||||
// Load events from database into $eventarray
|
||||
@ -442,12 +443,15 @@ $sql.= ' a.fk_soc, a.fk_contact,';
|
||||
$sql.= ' ca.code as type_code, ca.libelle as type_label';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
// We must filter on resource table
|
||||
if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r";
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||
@ -933,7 +937,7 @@ if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($even
|
||||
|
||||
|
||||
|
||||
$maxnbofchar=18;
|
||||
$maxnbofchar=0;
|
||||
$cachethirdparties=array();
|
||||
$cachecontacts=array();
|
||||
$cacheusers=array();
|
||||
@ -1238,20 +1242,20 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
}
|
||||
else
|
||||
{
|
||||
$numother++;
|
||||
$color=($event->icalcolor?$event->icalcolor:-1);
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
|
||||
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
|
||||
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
|
||||
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
|
||||
$numother++;
|
||||
$color=($event->icalcolor?$event->icalcolor:-1);
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
|
||||
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
|
||||
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
|
||||
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
|
||||
}
|
||||
if ($color == -1) // Color was not forced. Set color according to color index.
|
||||
{
|
||||
@ -1268,7 +1272,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color
|
||||
}
|
||||
//print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>';
|
||||
// Define color
|
||||
// Define color
|
||||
$color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||
@ -1312,7 +1316,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
||||
//else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
|
||||
print ' -moz-border-radius:4px;" width="100%"><tr>';
|
||||
print '<td class="'.($nowrapontd?'nowrap ':'').'cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
|
||||
print '<td class="tdoverflow centpercent '.($nowrapontd?'nowrap ':'').'cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
|
||||
if ($event->type_code == 'BIRTHDAY') // It's a birthday
|
||||
{
|
||||
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
|
||||
@ -1393,8 +1397,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname,$maxnbofchar).')';
|
||||
|
||||
// If action related to company / contact
|
||||
$linerelatedto='';$length=16;
|
||||
if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2);
|
||||
$linerelatedto='';
|
||||
if (! empty($event->societe->id) && $event->societe->id > 0)
|
||||
{
|
||||
if (! isset($cachethirdparties[$event->societe->id]) || ! is_object($cachethirdparties[$event->societe->id]))
|
||||
@ -1404,7 +1407,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$cachethirdparties[$event->societe->id]=$thirdparty;
|
||||
}
|
||||
else $thirdparty=$cachethirdparties[$event->societe->id];
|
||||
if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',$length);
|
||||
if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',0);
|
||||
}
|
||||
if (! empty($event->contact->id) && $event->contact->id > 0)
|
||||
{
|
||||
@ -1416,7 +1419,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
}
|
||||
else $contact=$cachecontacts[$event->contact->id];
|
||||
if ($linerelatedto) $linerelatedto.=' / ';
|
||||
if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',$length);
|
||||
if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',0);
|
||||
}
|
||||
if ($linerelatedto) print '<br>'.$linerelatedto;
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ $langs->load("agenda");
|
||||
$langs->load("commercial");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$resourceid=GETPOST("resourceid","int");
|
||||
$year=GETPOST("year",'int');
|
||||
$month=GETPOST("month",'int');
|
||||
$day=GETPOST("day",'int');
|
||||
@ -154,8 +155,10 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
$listofextcals=array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
||||
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($filtert) $param.="&filtert=".$filtert;
|
||||
@ -178,12 +181,15 @@ $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
// We must filter on resource table
|
||||
if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r";
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= " WHERE c.id = a.fk_action";
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND c.code IN ('".$db->escape($actioncode)."')";
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||
@ -242,7 +248,7 @@ if ($resql)
|
||||
$head = calendars_prepare_head($param);
|
||||
|
||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup);
|
||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup,'',$resourceid);
|
||||
dol_fiche_end();
|
||||
|
||||
// Add link to show birthdays
|
||||
@ -288,6 +294,7 @@ if ($resql)
|
||||
$nav='';
|
||||
if ($optioncss != '') $nav.= '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">';
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">';
|
||||
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
|
||||
@ -76,7 +76,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
|
||||
|
||||
//$action=GETPOST('action','alpha');
|
||||
$action='show_pertype';
|
||||
//$year=GETPOST("year");
|
||||
$resourceid=GETPOST("resourceid","int");
|
||||
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||
@ -202,6 +202,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions");
|
||||
|
||||
$param='';
|
||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($filtert) $param.="&filtert=".$filtert;
|
||||
@ -252,6 +253,7 @@ $nav.='<input type="hidden" name="action" value="' . $action . '">';
|
||||
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
|
||||
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
||||
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
||||
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
@ -279,7 +281,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
||||
$head = calendars_prepare_head($paramnoaction);
|
||||
|
||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
|
||||
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid);
|
||||
dol_fiche_end();
|
||||
|
||||
$showextcals=$listofextcals;
|
||||
@ -356,12 +358,15 @@ $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
||||
$sql.= ' ca.code, ca.color';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
// We must filter on resource table
|
||||
if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r";
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||
|
||||
@ -76,7 +76,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
|
||||
|
||||
//$action=GETPOST('action','alpha');
|
||||
$action='show_peruser'; //We use 'show_week' mode
|
||||
//$year=GETPOST("year");
|
||||
$resourceid=GETPOST("resourceid","int");
|
||||
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||
@ -202,6 +202,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions");
|
||||
|
||||
$param='';
|
||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($filtert) $param.="&filtert=".$filtert;
|
||||
@ -255,6 +256,7 @@ $nav.='<input type="hidden" name="action" value="' . $action . '">';
|
||||
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
|
||||
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
||||
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
||||
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
@ -287,7 +289,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
||||
$head = calendars_prepare_head($paramnoaction);
|
||||
|
||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
|
||||
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid);
|
||||
dol_fiche_end();
|
||||
|
||||
$showextcals=$listofextcals;
|
||||
@ -364,12 +366,15 @@ $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
||||
$sql.= ' ca.code, ca.color';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
// We must filter on resource table
|
||||
if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r";
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||
|
||||
@ -253,7 +253,7 @@ if ($action == 'create')
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input type="text" size="30" name="label" id="label" value="'.($object->label?$object->label:$langs->trans('RequiredField')).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Name').'</td><td><input type="text" size="30" name="name" id="name" value="'.($object->name?$object->name:$langs->trans('RequiredField')).'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="40" rows="3" wrap="soft">';
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||
print $object->address;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
@ -353,7 +353,7 @@ elseif ($action == 'edit')
|
||||
print '<tr><td>'.$langs->trans('AddressLabel').'</td><td colspan="3"><input type="text" size="40" name="label" value="'.$object->label.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" size="40" name="name" value="'.$object->name.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="40" rows="3" wrap="soft">';
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||
print $object->address;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
|
||||
@ -517,7 +517,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
@ -571,7 +571,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
|
||||
@ -259,7 +259,8 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Fabrication du mail
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css);
|
||||
$trackid=''; // TODO Define a trackid for mass emailing too. We can use source type for this.
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid);
|
||||
|
||||
if ($mail->error)
|
||||
{
|
||||
@ -1115,7 +1116,8 @@ else
|
||||
// Subject
|
||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$object->sujet.'"></td></tr>';
|
||||
|
||||
dol_init_file_process($upload_dir);
|
||||
$trackid=''; // TODO To avoid conflicts with 2 mass emailing, we shoul set a trackid here, even if we use another one into email header.
|
||||
dol_init_file_process($upload_dir, $trackid);
|
||||
|
||||
// Joined files
|
||||
$addfileaction='addfile';
|
||||
|
||||
@ -122,9 +122,10 @@ if (GETPOST('clearlist'))
|
||||
// Loading Class
|
||||
$obj = new MailingTargets($db);
|
||||
$obj->clear_target($id);
|
||||
|
||||
/* Avoid this to allow reposition
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
*/
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
@ -400,7 +401,7 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
$cleartext='';
|
||||
if ($allowaddtarget) {
|
||||
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">';
|
||||
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition">'.$langs->trans("TargetsReset").'</a>';
|
||||
}
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
|
||||
|
||||
@ -558,7 +559,7 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
if ($object->statut < 2)
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="8">';
|
||||
print '<tr '.$bc[false].'><td colspan="8" class="opacitymedium">';
|
||||
print $langs->trans("NoTargetYet");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($result);
|
||||
|
||||
@ -438,7 +438,8 @@ class Propal extends CommonObject
|
||||
$product_type=$product->type;
|
||||
|
||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) {
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
@ -2570,7 +2571,7 @@ class Propal extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay = $delay_warning/60/60/24;
|
||||
$response->label = $label;
|
||||
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut;
|
||||
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
|
||||
$response->img = img_object($langs->trans("Propals"),"propal");
|
||||
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
@ -2610,7 +2611,8 @@ class Propal extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Charge tableau des produits prodids
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
$prodids = array();
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
|
||||
@ -354,7 +354,8 @@ if ($result)
|
||||
}
|
||||
|
||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
|
||||
@ -283,12 +283,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre" height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NbOfProposals").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="right">'.$langs->trans("NbOfProposals").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
|
||||
@ -472,7 +472,15 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'classifyunbilled' && $user->rights->commande->creer)
|
||||
{
|
||||
$ret=$object->classifyUnBilled();
|
||||
|
||||
if ($ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Positionne ref commande client
|
||||
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
|
||||
$object->set_ref_client($user, GETPOST('ref_client'));
|
||||
@ -2147,7 +2155,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($action != 'editconditions' && $object->brouillon)
|
||||
if ($action != 'editconditions')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
@ -2165,7 +2173,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && $object->brouillon)
|
||||
if ($action != 'editmode')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
@ -2552,7 +2560,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifybilled">' . $langs->trans("ClassifyBilled") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
|
||||
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifyunbilled">' . $langs->trans("ClassifyUnBilled") . '</a></div>';
|
||||
}
|
||||
}
|
||||
// Clone
|
||||
if ($user->rights->commande->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
||||
|
||||
@ -449,6 +449,8 @@ class Commande extends CommonOrder
|
||||
// If stock is decremented on validate order, we must reincrement it
|
||||
if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||
{
|
||||
$result = 0;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
|
||||
@ -460,22 +462,9 @@ class Commande extends CommonOrder
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We increment stock of product (and sub-products)
|
||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
|
||||
if ($result < 0) { $error++; }
|
||||
if ($result < 0) { $error++; $this->error=$mouvP->error; break; }
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$this->statut=self::STATUS_DRAFT;
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$mouvP->error;
|
||||
$this->db->rollback();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@ -1278,7 +1267,8 @@ class Commande extends CommonOrder
|
||||
|
||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
|
||||
{
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
@ -1863,9 +1853,9 @@ class Commande extends CommonOrder
|
||||
|
||||
/**
|
||||
* Load array this->expeditions of lines of shipments with nb of products sent for each order line
|
||||
* Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order
|
||||
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
|
||||
*
|
||||
* @param int $filtre_statut Filter on status
|
||||
* @param int $filtre_statut Filter on shipment status
|
||||
* @return int <0 if KO, Nb of lines found if OK
|
||||
*/
|
||||
function loadExpeditions($filtre_statut=-1)
|
||||
@ -1934,21 +1924,6 @@ class Commande extends CommonOrder
|
||||
else dol_print_error($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a array with sendings by line
|
||||
*
|
||||
* @param int $filtre_statut Filtre sur statut
|
||||
* @return int 0 si OK, <0 si KO
|
||||
*
|
||||
* TODO deprecate, move to Shipping class
|
||||
*/
|
||||
function livraison_array($filtre_statut=self::STATUS_CANCELED)
|
||||
{
|
||||
$delivery = new Livraison($this->db);
|
||||
$deliveryArray = $delivery->livraison_array($filtre_statut);
|
||||
return $deliveryArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a array with the pending stock by product
|
||||
*
|
||||
@ -2501,7 +2476,57 @@ class Commande extends CommonOrder
|
||||
return $this->classifyBilled($user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Classify the order as not invoiced
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function classifyUnBilled()
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 0';
|
||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||
|
||||
dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->facturee=0; // deprecated
|
||||
$this->billed=0;
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::classifyUnBilled ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update a line in database
|
||||
*
|
||||
@ -2607,7 +2632,8 @@ class Commande extends CommonOrder
|
||||
|
||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
|
||||
{
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
unset($_POST['productid']);
|
||||
@ -2974,7 +3000,7 @@ class Commande extends CommonOrder
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->commande->client->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("OrdersToProcess");
|
||||
$response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3';
|
||||
$response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders';
|
||||
$response->img=img_object($langs->trans("Orders"),"order");
|
||||
|
||||
$generic_commande = new Commande($this->db);
|
||||
@ -3221,7 +3247,8 @@ class Commande extends CommonOrder
|
||||
|
||||
dol_syslog(get_class($this)."::initAsSpecimen");
|
||||
|
||||
// Charge tableau des produits prodids
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
$prodids = array();
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
|
||||
@ -381,7 +381,8 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($socid > 0) $param.='&socid='.$socid;
|
||||
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
|
||||
if ($orderday) $param.='&orderday='.$orderday;
|
||||
|
||||
@ -105,6 +105,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '<br>';
|
||||
|
||||
$cssclass="titlefield";
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -72,7 +72,7 @@ $date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if (is_array($selected) == false)
|
||||
if (! is_array($selected))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors');
|
||||
|
||||
@ -89,8 +89,7 @@ if ($_POST["action"] == 'add')
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); }
|
||||
$account->account_number = $accountancy_code_number;
|
||||
$account->account_number = GETPOST('account_number');
|
||||
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||
|
||||
$account->solde = $_POST["solde"];
|
||||
@ -172,8 +171,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); }
|
||||
$account->account_number = $accountancy_code_number;
|
||||
$account->account_number = GETPOST('account_number');
|
||||
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||
|
||||
$account->currency_code = trim($_POST["account_currency_code"]);
|
||||
@ -287,7 +285,7 @@ if ($action == 'create')
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>';
|
||||
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(GETPOST("ref")?GETPOST("ref",'alpha'):$account->ref).'" maxlength="12"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||
@ -393,10 +391,10 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.($_POST["account_min_allowed"]?$_POST["account_min_allowed"]:$account->min_allowed).'"></td></tr>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOST("account_min_allowed")?GETPOST("account_min_allowed"):$account->min_allowed).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->min_desired).'"></td></tr>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOST("account_min_desired")?GETPOST("account_min_desired"):$account->min_desired).'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
@ -407,7 +405,7 @@ if ($action == 'create')
|
||||
|
||||
// If bank account
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.(GETPOST('bank')?GETPOST('bank','alpha'):$account->bank).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
@ -431,7 +429,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
print '<td>'.$langs->trans($val).'</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.(GETPOST($name)?GETPOST($name,'alpha'):$content).'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
@ -440,23 +438,23 @@ if ($action == 'create')
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOST('iban')?GETPOST('iban','alpha'):$account->iban).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOST('bic')?GETPOST('bic','alpha'):$account->bic).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print (GETPOST('domiciliation')?GETPOST('domiciliation'):$account->domiciliation);
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.(GETPOST('proprio')?GETPOST('proprio','alpha'):$account->proprio).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print (GETPOST('owner_address')?GETPOST('owner_address','alpha'):$account->owner_address);
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1102,6 +1102,7 @@ class Account extends CommonObject
|
||||
$sql.= " AND b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
||||
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
||||
$sql.= " AND clos = 0";
|
||||
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -45,16 +45,9 @@ $statut=GETPOST('statut');
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas';
|
||||
llxHeader('',$langs->trans('AccountsArea'),$help_url);
|
||||
$title=$langs->trans('BankAccounts');
|
||||
|
||||
$link='';
|
||||
if ($statut == '') $link='<a href="'.$_SERVER["PHP_SELF"].'?statut=all">'.$langs->trans("IncludeClosedAccount").'</a>';
|
||||
if ($statut == 'all') $link='<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("OnlyOpenedAccount").'</a>';
|
||||
print load_fiche_titre($langs->trans("AccountsArea"),$link, 'title_bank.png');
|
||||
|
||||
|
||||
// On charge tableau des comptes financiers (ouverts par defaut)
|
||||
// Load array of financial accounts (opened by default)
|
||||
$accounts = array();
|
||||
|
||||
$sql = "SELECT rowid, courant, rappro";
|
||||
@ -66,17 +59,30 @@ $sql.= $db->order('label', 'ASC');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$accounts[$objp->rowid] = $objp->courant;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$accounts[$objp->rowid] = $objp->courant;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$nbtotalofrecords = $num;
|
||||
|
||||
|
||||
$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas';
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
$link='';
|
||||
if ($statut == '') $link='<a href="'.$_SERVER["PHP_SELF"].'?statut=all">'.$langs->trans("IncludeClosedAccount").'</a>';
|
||||
if ($statut == 'all') $link='<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("OnlyOpenedAccount").'</a>';
|
||||
|
||||
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$link,$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Comptes courants (courant = 1)
|
||||
@ -105,7 +111,7 @@ foreach ($accounts as $key=>$type)
|
||||
$solde = $acc->solde(1);
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td width="30%">'.$acc->getNomUrl(1).'</td>';
|
||||
print '<td class="titlefield">'.$acc->getNomUrl(1).'</td>';
|
||||
print '<td>'.$acc->bank.'</td>';
|
||||
print '<td>'.$acc->number.'</td>';
|
||||
print '<td align="center">';
|
||||
@ -116,7 +122,7 @@ foreach ($accounts as $key=>$type)
|
||||
setEventMessages($acc->error, $acc->errors, 'errors');
|
||||
} else {
|
||||
print $result->nbtodo;
|
||||
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
||||
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
||||
}
|
||||
}
|
||||
else print $langs->trans("FeatureDisabled");
|
||||
@ -130,7 +136,7 @@ foreach ($accounts as $key=>$type)
|
||||
$total[$acc->currency_code] += $solde;
|
||||
}
|
||||
}
|
||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
@ -182,7 +188,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! $found)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr '.$bc[false].'><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
@ -249,7 +255,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! $found)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
|
||||
@ -312,8 +312,11 @@ if ($result)
|
||||
}
|
||||
else if ($links[$key]['type']=='company') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$links[$key]['url_id'].'">';
|
||||
print img_object($langs->trans('ShowCompany'),'company').' ';
|
||||
print $links[$key]['label'];
|
||||
//print img_object($langs->trans('ShowCompany'),'company').' ';
|
||||
$societe=new Societe($db);
|
||||
$societe->fetch($links[$key]['url_id']);
|
||||
//print $links[$key]['label'];
|
||||
print $societe->getNomUrl(1);
|
||||
print '</a>';
|
||||
}
|
||||
else if ($links[$key]['type']=='sc') {
|
||||
|
||||
@ -53,20 +53,6 @@ $search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPO
|
||||
$search_thirdparty=GETPOST("thirdparty",'alpha');
|
||||
$search_req_nb=GETPOST("req_nb",'alpha');
|
||||
|
||||
$param='';
|
||||
if (!empty($description)) $param.='&description='.$description;
|
||||
if (!empty($type)) $param.='&type='.$type;
|
||||
if (!empty($debit)) $param.='&debit='.$debit;
|
||||
if (!empty($credit)) $param.='&credit='.$credit;
|
||||
if (!empty($account)) $param.='&account='.$account;
|
||||
if (!empty($bid)) $param.='&bid='.$bid;
|
||||
if (dol_strlen($search_dt_start) > 0)
|
||||
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||
if (dol_strlen($search_dt_end) > 0)
|
||||
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||
if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -78,6 +64,27 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='b.dateo';
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (!empty($description)) $param.='&description='.$description;
|
||||
if (!empty($type)) $param.='&type='.$type;
|
||||
if (!empty($debit)) $param.='&debit='.$debit;
|
||||
if (!empty($credit)) $param.='&credit='.$credit;
|
||||
if (!empty($account)) $param.='&account='.$account;
|
||||
if (!empty($bid)) $param.='&bid='.$bid;
|
||||
if (dol_strlen($search_dt_start) > 0)
|
||||
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||
if (dol_strlen($search_dt_end) > 0)
|
||||
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||
if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$description="";
|
||||
@ -88,8 +95,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$bid="";
|
||||
$search_req_nb='';
|
||||
$search_thirdparty='';
|
||||
$thirdparty='';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -108,7 +117,8 @@ else $viewline = 50;
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,";
|
||||
$sql.= " b.fk_account, b.fk_type,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
|
||||
$sql.= " bu.label as labelurl, bu.url_id";
|
||||
$sql.= " bu.url_id,";
|
||||
$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
|
||||
$sql.= " FROM ";
|
||||
if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||
@ -155,7 +165,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog('compta/bank/search.php::', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
@ -190,10 +199,10 @@ if ($resql)
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' ';
|
||||
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('DateStart') . ' ';
|
||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||
$moreforfilter .= ' - ';
|
||||
$moreforfilter .= $langs->trans('EndDate') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||
$moreforfilter .= $langs->trans('DateEnd') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
if ($moreforfilter)
|
||||
@ -209,9 +218,9 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Value'),$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Numero"));
|
||||
print_liste_field_titre($langs->trans("Description"));
|
||||
print_liste_field_titre($langs->trans("ThirdParty"));
|
||||
print_liste_field_titre($langs->trans("Numero"),$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"),$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
@ -225,7 +234,8 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
||||
// Numero
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="description" size="10" value="'.dol_escape_htmltag($description).'">';
|
||||
print '</td>';
|
||||
@ -287,7 +297,7 @@ if ($resql)
|
||||
print "</td>\n";
|
||||
|
||||
// Num
|
||||
print '<td class="nowrap">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
|
||||
// Description
|
||||
print "<td>";
|
||||
@ -306,7 +316,12 @@ if ($resql)
|
||||
if ($objp->url_id)
|
||||
{
|
||||
$companystatic->id=$objp->url_id;
|
||||
$companystatic->name=$objp->labelurl;
|
||||
$companystatic->name=$objp->nom;
|
||||
$companystatic->name_alias=$objp->name_alias;
|
||||
$companystatic->client=$objp->client;
|
||||
$companystatic->fournisseur=$objp->fournisseur;
|
||||
$companystatic->code_client=$objp->code_client;
|
||||
$companystatic->code_fournisseur=$objp->code_fournisseur;
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
@ -363,8 +378,9 @@ else
|
||||
// If no data to display after a search
|
||||
if ($_POST["action"] == "search" && ! $num)
|
||||
{
|
||||
print $langs->trans("NoRecordFound");
|
||||
print '<div class="opacitymedium">'.$langs->trans("NoRecordFound").'</div>';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -72,6 +72,7 @@ $title=$langs->trans("SpecialExpensesArea");
|
||||
if ($mode == 'sconly') $title=$langs->trans("SocialContributionsPayments");
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($mode == 'sconly') $param='&mode=sconly';
|
||||
if ($sortfield) $param.='&sortfield='.$sortfield;
|
||||
|
||||
@ -187,7 +187,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ $childids[]=$user->id;
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid,"; // Ou
|
||||
$sql = "SELECT s.nom, d.fk_user, s.rowid as socid,"; // Ou
|
||||
$sql.= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment
|
||||
$sql.= " d.fk_statut,";
|
||||
$sql.= " u.lastname, u.firstname"; // Qui
|
||||
@ -91,7 +91,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_
|
||||
$sql.= " WHERE d.fk_user = u.rowid";
|
||||
$sql.= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND (sc.fk_user = " .$user->id." OR d.fk_soc IS NULL) ";
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
if ($search_ref) $sql.=" AND d.rowid=".$search_ref;
|
||||
@ -188,7 +188,7 @@ if ($resql)
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dd),'day').'</td>';
|
||||
// User
|
||||
print '<td>';
|
||||
$userstatic->id = $obj->rowid;
|
||||
$userstatic->id = $obj->fk_user;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
print $userstatic->getNomUrl(1);
|
||||
|
||||
@ -423,21 +423,22 @@ if (empty($reshook))
|
||||
|
||||
// Check parameters
|
||||
|
||||
// Check for mandatory prof id
|
||||
for($i = 1; $i < 6; $i ++)
|
||||
// Check for mandatory prof id (but only if country is than than ours)
|
||||
if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id)
|
||||
{
|
||||
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
|
||||
$idprof = 'idprof' . $i;
|
||||
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
|
||||
{
|
||||
if (! $error)
|
||||
$langs->load("errors");
|
||||
$error ++;
|
||||
|
||||
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors');
|
||||
}
|
||||
for ($i = 1; $i <= 6; $i++)
|
||||
{
|
||||
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
|
||||
$idprof = 'idprof' . $i;
|
||||
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
|
||||
{
|
||||
if (! $error) $langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
@ -1789,57 +1790,13 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* Generate document
|
||||
*/
|
||||
if ($action == 'builddoc') // En get ou en post
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
|
||||
// Save last template used to generate document
|
||||
if (GETPOST('model'))
|
||||
$object->setDocModel($user, GETPOST('model', 'alpha'));
|
||||
if (GETPOST('fk_bank')) { // this field may come from an external module
|
||||
$object->fk_bank = GETPOST('fk_bank');
|
||||
} else {
|
||||
$object->fk_bank = $object->fk_account;
|
||||
}
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file') {
|
||||
if ($object->fetch($id)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
} elseif ($action == 'update_extras') {
|
||||
if ($action == 'update_extras') {
|
||||
// Fill array 'array_options' with data from add form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||
@ -3353,7 +3310,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
print '<tr ' . $bc[false] . '><td colspan="' . $nbcols . '">' . $langs->trans("None") . '</td><td></td><td></td></tr>';
|
||||
print '<tr ' . $bc[false] . '><td colspan="' . $nbcols . '" class="opacitymedium">' . $langs->trans("None") . '</td><td></td><td></td></tr>';
|
||||
}
|
||||
// }
|
||||
$db->free($result);
|
||||
|
||||
@ -509,7 +509,7 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog("FactureRec::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Check parameters
|
||||
@ -604,6 +604,111 @@ class FactureRec extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a line to invoice
|
||||
*
|
||||
* @param int $rowid Id of line to update
|
||||
* @param string $desc Description de la ligne
|
||||
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param double $qty Quantite
|
||||
* @param double $txtva Taux de tva force, sinon -1
|
||||
* @param int $fk_product Id du produit/service predefini
|
||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @param int $fk_remise_except Id remise
|
||||
* @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note)
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int $rang Position of line
|
||||
* @param int $special_code Special code
|
||||
* @param string $label Label of the line
|
||||
* @param string $fk_unit Unit
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($this->brouillon)
|
||||
{
|
||||
// Clean parameters
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
if (! $qty) $qty=1;
|
||||
if (! $info_bits) $info_bits=0;
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
||||
$product_type=$type;
|
||||
if ($fk_product)
|
||||
{
|
||||
$product=new Product($this->db);
|
||||
$result=$product->fetch($fk_product);
|
||||
$product_type=$product->type;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET ";
|
||||
$sql.= "fk_facture = '".$facid."'";
|
||||
$sql.= ", label=".(! empty($label)?"'".$this->db->escape($label)."'":"null");
|
||||
$sql.= ", description='".$this->db->escape($desc)."'";
|
||||
$sql.= ", price=".price2num($pu_ht);
|
||||
$sql.= ", qty=".price2num($qty);
|
||||
$sql.= ", tva_tx=".price2num($txtva);
|
||||
$sql.= ", fk_product=".(! empty($fk_product)?"'".$fk_product."'":"null");
|
||||
$sql.= ", product_type=".$product_type;
|
||||
$sql.= ", remise_percent='".price2num($remise_percent)."'";
|
||||
$sql.= ", subprice='".price2num($pu_ht)."'";
|
||||
$sql.= ", total_ht='".price2num($total_ht)."'";
|
||||
$sql.= ", total_tva='".price2num($total_tva)."'";
|
||||
$sql.= ", total_ttc='".price2num($total_ttc)."'";
|
||||
$sql.= ", rang=".$rang;
|
||||
$sql.= ", special_code=".$special_code;
|
||||
$sql.= ", fk_unit=".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null");
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->id=$facid;
|
||||
$this->update_price();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the next date of
|
||||
*
|
||||
@ -760,8 +865,9 @@ class FactureRec extends CommonInvoice
|
||||
$arraynow=dol_getdate($now);
|
||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||
|
||||
$prodids = array();
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
$prodids = array();
|
||||
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
@ -962,7 +1068,7 @@ class FactureRec extends CommonInvoice
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->date_when = $date;
|
||||
if ($increment_nb_gen_done>0) $_facrec->nb_gen_done++;
|
||||
if ($increment_nb_gen_done>0) $this->nb_gen_done++;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
||||
@ -263,7 +263,7 @@ class Facture extends CommonInvoice
|
||||
$result=$soc->fetch($this->socid);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error="Failed to fetch company";
|
||||
$this->error="Failed to fetch company: ".$soc->error;
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
@ -358,7 +358,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL');
|
||||
$sql.= ", ".($this->remise_percent>0?$this->remise_percent:'NULL');
|
||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||
$sql.= ", '".$this->db->idate($this->date_pointoftax)."'";
|
||||
$sql.= ", ".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null');
|
||||
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
|
||||
@ -2314,7 +2314,8 @@ class Facture extends CommonInvoice
|
||||
$product_type=$product->type;
|
||||
|
||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) {
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
@ -2358,27 +2359,32 @@ class Facture extends CommonInvoice
|
||||
$this->line->fk_facture=$this->id;
|
||||
$this->line->label=$label; // deprecated
|
||||
$this->line->desc=$desc;
|
||||
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||
|
||||
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
|
||||
$this->line->tva_tx=$txtva;
|
||||
$this->line->localtax1_tx=$txlocaltax1;
|
||||
$this->line->localtax2_tx=$txlocaltax2;
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
|
||||
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); // For credit note and if qty is negative, total is negative
|
||||
|
||||
$this->line->fk_product=$fk_product;
|
||||
$this->line->product_type=$product_type;
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
$this->line->date_start=$date_start;
|
||||
$this->line->date_end=$date_end;
|
||||
$this->line->ventil=$ventil;
|
||||
$this->line->rang=$rangtouse;
|
||||
$this->line->info_bits=$info_bits;
|
||||
$this->line->fk_remise_except=$fk_remise_except;
|
||||
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva= $total_tva;
|
||||
$this->line->total_localtax1=$total_localtax1;
|
||||
$this->line->total_localtax2=$total_localtax2;
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
|
||||
$this->line->special_code=$special_code;
|
||||
$this->line->fk_parent_line=$fk_parent_line;
|
||||
$this->line->origin=$origin;
|
||||
@ -2547,7 +2553,8 @@ class Facture extends CommonInvoice
|
||||
$product_type=$product->type;
|
||||
|
||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) {
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
@ -3464,7 +3471,7 @@ class Facture extends CommonInvoice
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->facture->client->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("CustomerBillsUnpaid");
|
||||
$response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1';
|
||||
$response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=customers_bills';
|
||||
$response->img=img_object($langs->trans("Bills"),"bill");
|
||||
|
||||
$generic_facture = new Facture($this->db);
|
||||
@ -3530,6 +3537,8 @@ class Facture extends CommonInvoice
|
||||
$arraynow=dol_getdate($now);
|
||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
$prodids = array();
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
|
||||
@ -552,9 +552,9 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
@ -615,8 +615,168 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel'))
|
||||
{
|
||||
if (! $object->fetch($id) > 0) dol_print_error($db);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Clean parameters
|
||||
$date_start = '';
|
||||
$date_end = '';
|
||||
//$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
//$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
$description = dol_htmlcleanlastbr(GETPOST('product_desc') ? GETPOST('product_desc') : GETPOST('desc'));
|
||||
$pu_ht = GETPOST('price_ht');
|
||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$qty = GETPOST('qty');
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$info_bits |= 0x01;
|
||||
|
||||
// Define vat_rate
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
|
||||
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
|
||||
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||
// Unset extrafield
|
||||
if (is_array($extralabelsline)) {
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Define special_code for special lines
|
||||
$special_code=GETPOST('special_code');
|
||||
if (! GETPOST('qty')) $special_code=3;
|
||||
|
||||
/*$line = new FactureLigne($db);
|
||||
$line->fetch(GETPOST('lineid'));
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
|
||||
if (GETPOST('progress') < $percent)
|
||||
{
|
||||
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
$error++;
|
||||
$result = -1;
|
||||
}*/
|
||||
|
||||
// Check minimum price
|
||||
$productid = GETPOST('productid', 'int');
|
||||
if (! empty($productid))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($productid);
|
||||
|
||||
$type = $product->type;
|
||||
|
||||
$price_min = $product->price_min;
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
|
||||
$price_min = $product->multiprices_min [$object->thirdparty->price_level];
|
||||
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||
|
||||
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$type = GETPOST('type');
|
||||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
|
||||
// Check parameters
|
||||
if (GETPOST('type') < 0) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
if ($qty < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
// Update line
|
||||
if (! $error) {
|
||||
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty,
|
||||
$vat_rate, GETPOST('productid'), GETPOST('remise_percent'), 'HT', $info_bits, 0, 0, $type,
|
||||
0, $special_code, $label, GETPOST('units'));
|
||||
|
||||
if ($result >= 0) {
|
||||
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}*/
|
||||
|
||||
$object->fetch($object->id); // Reload lines
|
||||
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
unset($_POST['productid']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
unset($_POST['product_label']);
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
unset($_POST['np_marginRate']);
|
||||
unset($_POST['np_markRate']);
|
||||
|
||||
unset($_POST['dp_desc']);
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['units']);
|
||||
|
||||
unset($_POST['date_starthour']);
|
||||
unset($_POST['date_startmin']);
|
||||
unset($_POST['date_startsec']);
|
||||
unset($_POST['date_startday']);
|
||||
unset($_POST['date_startmonth']);
|
||||
unset($_POST['date_startyear']);
|
||||
unset($_POST['date_endhour']);
|
||||
unset($_POST['date_endmin']);
|
||||
unset($_POST['date_endsec']);
|
||||
unset($_POST['date_endday']);
|
||||
unset($_POST['date_endmonth']);
|
||||
unset($_POST['date_endyear']);
|
||||
|
||||
unset($_POST['situations']);
|
||||
unset($_POST['progress']);
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_societe='';
|
||||
@ -1269,7 +1429,7 @@ else
|
||||
// Nb of generation already done
|
||||
print '<tr><td width="20%">'.$langs->trans("NbOfGenerationDone").'</td>';
|
||||
print '<td>';
|
||||
print $object->nb_gen_done?$object->nb_gen_done:'';
|
||||
print $object->nb_gen_done?$object->nb_gen_done:'0';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1302,7 +1462,7 @@ else
|
||||
// Show object lines
|
||||
if (! empty($object->lines))
|
||||
{
|
||||
$disableedit=1;
|
||||
//$disableedit=1;
|
||||
//$disablemove=1;
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
||||
}
|
||||
@ -1338,14 +1498,21 @@ else
|
||||
//{
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if (empty($object->frequency) || $object->date_when <= $today)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($object->frequency) || $object->date_when <= $today)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1431,6 +1598,7 @@ else
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param='&socid='.$socid;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($day) $param.='&day='.$day;
|
||||
if ($month) $param.='&month='.$month;
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/facture/list.php
|
||||
* \ingroup facture
|
||||
* \brief Page to create/see an invoice
|
||||
* \brief List of customer invoices
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
@ -50,7 +51,6 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/c
|
||||
$langs->load('bills');
|
||||
$langs->load('companies');
|
||||
$langs->load('products');
|
||||
$langs->load('main');
|
||||
|
||||
$sall=trim(GETPOST('sall'));
|
||||
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
||||
@ -78,8 +78,19 @@ $search_zip=GETPOST('search_zip','alpha');
|
||||
$search_state=trim(GETPOST("search_state"));
|
||||
$search_country=GETPOST("search_country",'int');
|
||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||
$search_user = GETPOST('search_user','int');
|
||||
$search_sale = GETPOST('search_sale','int');
|
||||
$day = GETPOST('day','int');
|
||||
$month = GETPOST('month','int');
|
||||
$year = GETPOST('year','int');
|
||||
$day_lim = GETPOST('day_lim','int');
|
||||
$month_lim = GETPOST('month_lim','int');
|
||||
$year_lim = GETPOST('year_lim','int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$option = GETPOST('option');
|
||||
if ($option == 'late') $filter = 'paye:0';
|
||||
$filtre = GETPOST('filtre');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -96,17 +107,6 @@ $pagenext = $page + 1;
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$contextpage='invoicelist';
|
||||
|
||||
$search_user = GETPOST('search_user','int');
|
||||
$search_sale = GETPOST('search_sale','int');
|
||||
$day = GETPOST('day','int');
|
||||
$month = GETPOST('month','int');
|
||||
$year = GETPOST('year','int');
|
||||
$day_lim = GETPOST('day_lim','int');
|
||||
$month_lim = GETPOST('month_lim','int');
|
||||
$year_lim = GETPOST('year_lim','int');
|
||||
$filtre = GETPOST('filtre');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
// Security check
|
||||
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||
@ -140,14 +140,14 @@ $checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
||||
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
|
||||
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
||||
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
|
||||
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
|
||||
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
|
||||
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
|
||||
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
||||
@ -189,6 +189,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
|
||||
$search_product_category='';
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_project='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$search_montant_vat='';
|
||||
@ -624,8 +625,6 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
@ -633,6 +632,8 @@ $bankaccountstatic=new Account($db);
|
||||
$facturestatic=new Facture($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
||||
@ -687,6 +688,7 @@ if ($filtre)
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
|
||||
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
|
||||
if ($search_project) $sql .= natural_search('p.ref', $search_project);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_town) $sql.= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
|
||||
@ -756,7 +758,8 @@ if (! $sall)
|
||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||
$sql.= ' f.paye, f.fk_statut,';
|
||||
$sql.= ' f.datec, f.tms,';
|
||||
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client';
|
||||
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code';
|
||||
$sql.= ' ,state.code_departement, state.nom';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -792,24 +795,25 @@ if ($resql)
|
||||
}
|
||||
|
||||
$param='&socid='.$socid;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($day) $param.='&day='.$day;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year=' .$year;
|
||||
if ($day_lim) $param.='&day_lim='.$day_lim;
|
||||
if ($month_lim) $param.='&month_lim='.$month_lim;
|
||||
if ($year_lim) $param.='&year_lim=' .$year_lim;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer;
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
|
||||
if ($search_user > 0) $param.='&search_user=' .$search_user;
|
||||
if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category;
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
||||
if ($search_paymentmode > 0) $param.='search_paymentmode='.$search_paymentmode;
|
||||
if ($day) $param.='&day='.urlencode($day);
|
||||
if ($month) $param.='&month='.urlencode($month);
|
||||
if ($year) $param.='&year=' .urlencode($year);
|
||||
if ($day_lim) $param.='&day_lim='.urlencode($day_lim);
|
||||
if ($month_lim) $param.='&month_lim='.urlencode($month_lim);
|
||||
if ($year_lim) $param.='&year_lim=' .urlencode($year_lim);
|
||||
if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
|
||||
if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer);
|
||||
if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
|
||||
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
|
||||
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
|
||||
if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category);
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat);
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($option) $param.="&option=".$option;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
@ -1059,12 +1063,12 @@ if ($resql)
|
||||
// Thirpdarty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
}
|
||||
// Town
|
||||
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
||||
// Zip
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
@ -1189,17 +1193,17 @@ if ($resql)
|
||||
$var=!$var;
|
||||
|
||||
$datelimit=$db->jdate($obj->datelimite);
|
||||
|
||||
$facturestatic->id=$obj->facid;
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->type=$obj->type;
|
||||
$facturestatic->statut=$obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
if (! empty($arrayfields['f.facnumber']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$facturestatic->id=$obj->facid;
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->type=$obj->type;
|
||||
$facturestatic->statut=$obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
||||
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
|
||||
$paiement = $facturestatic->getSommePaiement();
|
||||
$remaintopay = $obj->total_ttc - $paiement;
|
||||
@ -1475,7 +1479,7 @@ if ($resql)
|
||||
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
|
||||
$title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
|
||||
|
||||
print $formfile->showdocuments('massfilesarea','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
print $formfile->showdocuments('massfilesarea_facture','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -483,20 +483,27 @@ if ($object->id > 0)
|
||||
// Add a withdraw request
|
||||
if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0)
|
||||
{
|
||||
if ($user->rights->prelevement->bons->creer)
|
||||
{
|
||||
print '<form method="POST" action="">';
|
||||
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="' . $resteapayer . '" size="10" />';
|
||||
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
if ($resteapayer > 0)
|
||||
{
|
||||
if ($user->rights->prelevement->bons->creer)
|
||||
{
|
||||
print '<form method="POST" action="">';
|
||||
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="' . $resteapayer . '" size="10" />';
|
||||
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -262,12 +262,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre" height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NumberOfBills").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="right">'.$langs->trans("NumberOfBills").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
@ -543,7 +543,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="4">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
@ -614,7 +614,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
@ -824,7 +824,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '</tr>';
|
||||
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$total += $obj->total;
|
||||
$total += $obj->total_ht;
|
||||
$totalam += $obj->am;
|
||||
$var=!$var;
|
||||
$i++;
|
||||
@ -877,7 +877,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement";
|
||||
$sql.= " ORDER BY ff.date_lim_reglement ASC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@ -440,7 +440,7 @@ if ($action == 'new')
|
||||
|
||||
if ($i == 0)
|
||||
{
|
||||
print '<b>'.$langs->trans("NoWaitingChecks").'</b><br>';
|
||||
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -121,6 +121,7 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -214,7 +215,7 @@ if ($resql)
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td colspan="7">'.$langs->trans("None")."</td>";
|
||||
print '<td colspan="7" class="opacitymedium">'.$langs->trans("None")."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
463
htdocs/compta/paiement/class/cpaiement.class.php
Normal file
463
htdocs/compta/paiement/class/cpaiement.class.php
Normal file
@ -0,0 +1,463 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compat/paiement/class/cpaiement.class.php
|
||||
* \ingroup facture
|
||||
* \brief This file is to manage CRUD function of type of payments
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class Cpaiement
|
||||
*/
|
||||
class Cpaiement
|
||||
{
|
||||
/**
|
||||
* @var string Id to identify managed objects
|
||||
*/
|
||||
public $element = 'cpaiement';
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'c_paiement';
|
||||
|
||||
/**
|
||||
* @var CpaiementLine[] Lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
public $code;
|
||||
public $libelle;
|
||||
public $type;
|
||||
public $active;
|
||||
public $accountancy_code;
|
||||
public $module;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
}
|
||||
if (isset($this->libelle)) {
|
||||
$this->libelle = trim($this->libelle);
|
||||
}
|
||||
if (isset($this->type)) {
|
||||
$this->type = trim($this->type);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
if (isset($this->accountancy_code)) {
|
||||
$this->accountancy_code = trim($this->accountancy_code);
|
||||
}
|
||||
if (isset($this->module)) {
|
||||
$this->module = trim($this->module);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||
|
||||
$sql.= 'id,';
|
||||
$sql.= 'code,';
|
||||
$sql.= 'libelle,';
|
||||
$sql.= 'type,';
|
||||
$sql.= 'active,';
|
||||
$sql.= 'accountancy_code,';
|
||||
$sql.= 'module';
|
||||
|
||||
|
||||
$sql .= ') VALUES (';
|
||||
|
||||
$sql .= ' '.(! isset($this->id)?'NULL':$this->id).',';
|
||||
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
|
||||
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
|
||||
$sql .= ' '.(! isset($this->type)?'NULL':$this->type).',';
|
||||
$sql .= ' '.(! isset($this->active)?'NULL':$this->active).',';
|
||||
$sql .= ' '.(! isset($this->accountancy_code)?'NULL':"'".$this->db->escape($this->accountancy_code)."'").',';
|
||||
$sql .= ' '.(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'");
|
||||
|
||||
|
||||
$sql .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action to call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||
//if ($result < 0) $error++;
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.id,';
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.libelle,";
|
||||
$sql .= " t.type,";
|
||||
$sql .= " t.active,";
|
||||
$sql .= " t.accountancy_code,";
|
||||
$sql .= " t.module";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
if (null !== $ref) {
|
||||
$sql .= ' WHERE t.code = ' . '\'' . $ref . '\'';
|
||||
} else {
|
||||
$sql .= ' WHERE t.id = ' . $id;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
if ($numrows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->id;
|
||||
|
||||
$this->code = $obj->code;
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->type = $obj->type;
|
||||
$this->active = $obj->active;
|
||||
$this->accountancy_code = $obj->accountancy_code;
|
||||
$this->module = $obj->module;
|
||||
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($numrows) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.id,';
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.libelle,";
|
||||
$sql .= " t.type,";
|
||||
$sql .= " t.active,";
|
||||
$sql .= " t.accountancy_code,";
|
||||
$sql .= " t.module";
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new CpaiementLine();
|
||||
|
||||
$line->id = $obj->id;
|
||||
|
||||
$line->code = $obj->code;
|
||||
$line->libelle = $obj->libelle;
|
||||
$line->type = $obj->type;
|
||||
$line->active = $obj->active;
|
||||
$line->accountancy_code = $obj->accountancy_code;
|
||||
$line->module = $obj->module;
|
||||
|
||||
|
||||
|
||||
$this->lines[$line->id] = $line;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
}
|
||||
if (isset($this->libelle)) {
|
||||
$this->libelle = trim($this->libelle);
|
||||
}
|
||||
if (isset($this->type)) {
|
||||
$this->type = trim($this->type);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
if (isset($this->accountancy_code)) {
|
||||
$this->accountancy_code = trim($this->accountancy_code);
|
||||
}
|
||||
if (isset($this->module)) {
|
||||
$this->module = trim($this->module);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||
$sql .= ' id = '.(isset($this->id)?$this->id:"null").',';
|
||||
$sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").',';
|
||||
$sql .= ' libelle = '.(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").',';
|
||||
$sql .= ' type = '.(isset($this->type)?$this->type:"null").',';
|
||||
$sql .= ' active = '.(isset($this->active)?$this->active:"null").',';
|
||||
$sql .= ' accountancy_code = '.(isset($this->accountancy_code)?"'".$this->db->escape($this->accountancy_code)."'":"null").',';
|
||||
$sql .= ' module = '.(isset($this->module)?"'".$this->db->escape($this->module)."'":"null");
|
||||
$sql .= ' WHERE id=' . $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= ' WHERE id=' . $this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id = 0;
|
||||
|
||||
$this->code = '';
|
||||
$this->libelle = '';
|
||||
$this->type = '';
|
||||
$this->active = '';
|
||||
$this->accountancy_code = '';
|
||||
$this->module = '';
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -62,8 +62,9 @@ class Paiement extends CommonObject
|
||||
var $bank_line; // Id de la ligne d'ecriture bancaire
|
||||
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
||||
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
||||
var $fk_paiement; // Type of paiment
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@ -50,7 +50,7 @@ $paymentstatic=new Paiement($db);
|
||||
$accountstatic=new Account($db);
|
||||
$companystatic=new Societe($db);
|
||||
|
||||
$search_ref=GETPOST("search_ref","int");
|
||||
$search_ref=GETPOST("search_ref","alpha");
|
||||
$search_account=GETPOST("search_account","int");
|
||||
$search_paymenttype=GETPOST("search_paymenttype");
|
||||
$search_amount=GETPOST("search_amount",'alpha'); // alpha because we must be able to search on "< x"
|
||||
@ -203,6 +203,7 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
$param.=(GETPOST("orphelins")?"&orphelins=1":"");
|
||||
$param.=($search_ref?"&search_ref=".urlencode($search_ref):"");
|
||||
|
||||
@ -235,7 +235,7 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else print '<tr '.$bc[0].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
|
||||
else print '<tr '.$bc[0].'><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
print "</table>";
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ if ($resql)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("NoInvoiceToWithdraw").'</td></tr>';
|
||||
print '<tr '.$bc[false].'><td colspan="2" class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ if ($total_ttc == 0)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ if ($result) {
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -439,7 +439,7 @@ if ($result) {
|
||||
else {
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
} else {
|
||||
@ -517,7 +517,7 @@ if ($result) {
|
||||
else {
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
} else {
|
||||
@ -606,7 +606,7 @@ if (! empty($conf->salaries->enabled))
|
||||
{
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
@ -629,7 +629,7 @@ if (! empty($conf->expensereport->enabled))
|
||||
{
|
||||
$langs->load('trips');
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT p.rowid, p.ref, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||
$sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
||||
@ -688,7 +688,7 @@ if (! empty($conf->expensereport->enabled))
|
||||
{
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
@ -757,7 +757,7 @@ if (! empty($conf->don->enabled))
|
||||
{
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,8 @@ if ($result)
|
||||
$var=true;
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($typeid) $param.='&typeid='.$typeid;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
|
||||
@ -360,9 +360,11 @@ if ($id > 0)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/index.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldtitle">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||
print $form->showrefnav($object,'id');
|
||||
print $form->showrefnav($object,'id',$linkback);
|
||||
print "</td></tr>";
|
||||
|
||||
// Label
|
||||
@ -403,7 +405,7 @@ if ($id > 0)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0; $total = 0;
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<table class="nobordernopadding paymenttable" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
|
||||
@ -69,7 +69,7 @@ else
|
||||
$typeid=$_REQUEST['typeid'];
|
||||
}
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_label="";
|
||||
@ -138,7 +138,8 @@ if ($resql)
|
||||
$var=true;
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($typeid) $param.='&typeid='.$typeid;
|
||||
|
||||
@ -210,6 +211,8 @@ if ($resql)
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -243,8 +246,12 @@ if ($resql)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td align="right" width="100">'.price($obj->amount).'</td>';
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalttc'] += $obj->amount;
|
||||
|
||||
// Due date
|
||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||
|
||||
@ -256,6 +263,22 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalttcfield']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
@ -322,7 +322,7 @@ if (is_array($coll_list)) {
|
||||
//print load_fiche_titre($vatsup);
|
||||
|
||||
//print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<tr class=\"liste_titre liste_titre_topborder\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Supplier")."</td>";
|
||||
print "<td>".$langs->trans("VATIntra")."</td>";
|
||||
|
||||
@ -479,7 +479,7 @@ else
|
||||
|
||||
//print table headers for this quadri - expenses now
|
||||
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre liste_titre_topborder">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
if ($modetax == 0)
|
||||
|
||||
@ -134,7 +134,8 @@ if ($result)
|
||||
$var=true;
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($typeid) $param.='&typeid='.$typeid;
|
||||
|
||||
|
||||
@ -211,7 +212,7 @@ if ($result)
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
|
||||
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("Total").'</td>';
|
||||
print "<td align=\"right\"><b>".price($total)."</b></td>";
|
||||
print "<td> </td></tr>";
|
||||
|
||||
|
||||
@ -220,6 +220,25 @@ $dolibarr_main_authentication='dolibarr';
|
||||
//
|
||||
$dolibarr_main_force_https='0';
|
||||
|
||||
// dolibarr_main_prod
|
||||
// When this parameter is defined, all errors messages are not reported.
|
||||
// This feature exists for production usage to avoid to give any information to hackers.
|
||||
// Default value: 0
|
||||
// Possible values: 0 or 1
|
||||
// Examples:
|
||||
// $dolibarr_main_prod='0';
|
||||
//
|
||||
$dolibarr_main_prod='0';
|
||||
|
||||
// $dolibarr_main_restrict_os_commands
|
||||
// To restrict commands you can execute by the backup feature, enter allowed command here.
|
||||
// Note: If you can, defining permission on OS linux (using SELinux for example) may be a better choice.
|
||||
// Default value: 'mysqldump, mysql, pg_dump, pgrestore'
|
||||
// Examples:
|
||||
// $dolibarr_main_restrict_os_commands='mysqldump, /usr/local/bin/otherdumptool';
|
||||
//
|
||||
$dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore';
|
||||
|
||||
// dolibarr_nocsrfcheck
|
||||
// This parameter can be used to disable CSRF protection.
|
||||
// This might be required if you access Dolibarr behind a proxy that make
|
||||
@ -231,15 +250,11 @@ $dolibarr_main_force_https='0';
|
||||
//
|
||||
$dolibarr_nocsrfcheck='0';
|
||||
|
||||
// dolibarr_main_prod
|
||||
// When this parameter is defined, all errors messages are not reported.
|
||||
// This feature exists for production usage to avoid to give any information to hackers.
|
||||
// Default value: 0
|
||||
// Possible values: 0 or 1
|
||||
// dolibarr_mailing_limit_sendbyweb
|
||||
// Can set a limit for mailing send by web. Can be used for a restricted mode.
|
||||
// Default value: 0 (use database value if exist)
|
||||
// Examples:
|
||||
// $dolibarr_main_prod='0';
|
||||
//
|
||||
$dolibarr_main_prod='0';
|
||||
// $dolibarr_mailing_limit_sendbyweb='0';
|
||||
|
||||
|
||||
|
||||
@ -251,8 +266,6 @@ $dolibarr_main_prod='0';
|
||||
// This parameter contains prefix of Dolibarr database. 'llx_' if not defined.
|
||||
// Examples:
|
||||
// $dolibarr_main_db_prefix='llx_';
|
||||
//
|
||||
$dolibarr_main_db_prefix='';
|
||||
|
||||
// dolibarr_main_limit_users
|
||||
// Can set a limit on the number of users it will be possible to create
|
||||
@ -261,12 +274,6 @@ $dolibarr_main_db_prefix='';
|
||||
// Examples:
|
||||
// $dolibarr_main_limit_users='0';
|
||||
|
||||
// dolibarr_mailing_limit_sendbyweb
|
||||
// Can set a limit for mailing send by web. Can be used for a restricted mode.
|
||||
// Default value: 0 (use database value if exist)
|
||||
// Examples:
|
||||
// $dolibarr_mailing_limit_sendbyweb='0';
|
||||
|
||||
// dolibarr_strict_mode
|
||||
// Set this to 1 to enable the PHP strict mode. For dev environment only.
|
||||
// Default value: 0 (use database value if exist)
|
||||
|
||||
@ -369,6 +369,7 @@ if ($result)
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
$param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||
$param.='&type='.urlencode($type).'&view='.urlencode($view);
|
||||
|
||||
@ -2098,6 +2098,8 @@ class Contrat extends CommonObject
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
$prodids = array();
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
@ -2116,8 +2118,6 @@ class Contrat extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Initialise parametres
|
||||
$this->id=0;
|
||||
$this->specimen=1;
|
||||
@ -2220,18 +2220,18 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
class ContratLigne extends CommonObjectLine
|
||||
{
|
||||
|
||||
public $element='contratdet';
|
||||
public $table_element='contratdet';
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
var $tms;
|
||||
|
||||
var $fk_contrat;
|
||||
var $fk_product;
|
||||
var $statut; // 0 inactive, 4 active, 5 closed
|
||||
var $type; // 0 for product, 1 for service
|
||||
var $label;
|
||||
|
||||
public $element='contratdet';
|
||||
public $table_element='contratdet';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @deprecated Use $label instead
|
||||
@ -2240,6 +2240,10 @@ class ContratLigne extends CommonObjectLine
|
||||
public $libelle;
|
||||
|
||||
var $description;
|
||||
|
||||
var $product_ref;
|
||||
var $product_label;
|
||||
|
||||
var $date_commande;
|
||||
var $date_ouverture_prevue; // date start planned
|
||||
var $date_ouverture; // date start real
|
||||
@ -2379,16 +2383,17 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowContractOfService").': '.$this->label;
|
||||
|
||||
if (empty($label)) $label=$this->description;
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='contract';
|
||||
|
||||
$picto='service';
|
||||
if ($this->type == 0) $picto='product';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.$this->label.$linkend;
|
||||
if ($withpicto != 2) $result.=$link.($this->product_ref?$this->product_ref.' ':'').($this->label?$this->label:$this->description).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -2417,6 +2422,7 @@ class ContratLigne extends CommonObjectLine
|
||||
$sql.= " p.ref as product_ref,";
|
||||
$sql.= " p.label as product_label,";
|
||||
$sql.= " p.description as product_desc,";
|
||||
$sql.= " p.type as product_type,";
|
||||
$sql.= " t.description,";
|
||||
$sql.= " t.date_commande,";
|
||||
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
|
||||
@ -2467,6 +2473,7 @@ class ContratLigne extends CommonObjectLine
|
||||
$this->product_ref = $obj->product_ref;
|
||||
$this->product_label = $obj->product_label;
|
||||
$this->product_description = $obj->product_description;
|
||||
$this->product_type = $obj->product_type;
|
||||
$this->label = $obj->label; // deprecated. We do not use this field. Only ref and label of product, and description of contract line
|
||||
$this->description = $obj->description;
|
||||
$this->date_commande = $this->db->jdate($obj->date_commande);
|
||||
|
||||
@ -170,6 +170,7 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
$param.='&search_contract='.$search_contract;
|
||||
$param.='&search_name='.$search_name;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
@ -267,14 +267,14 @@ if ($resql)
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
$productstatic->entity=$obj->pentity;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
print $productstatic->getNomUrl(1,'',24);
|
||||
print $obj->label?' - '.dol_trunc($obj->label,16):'';
|
||||
if (! empty($obj->description) && ! empty($conf->global->PRODUCT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($obj->type == 0) print img_object($obj->description,'product').dol_trunc($obj->description,20);
|
||||
if ($obj->type == 1) print img_object($obj->description,'service').dol_trunc($obj->description,20);
|
||||
if ($obj->type == 0) print img_object($obj->description,'product').' '.dol_trunc($obj->description,24);
|
||||
if ($obj->type == 1) print img_object($obj->description,'service').' '.dol_trunc($obj->description,24);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -291,7 +291,7 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' ');
|
||||
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)))
|
||||
print img_picto($langs->trans("Late"),"warning");
|
||||
print ' '.img_picto($langs->trans("Late"),"warning");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -51,15 +51,15 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
// Save last template used to generate document
|
||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||
|
||||
// Special case for invoices
|
||||
if (property_exists($object, 'fk_bank'))
|
||||
{
|
||||
// Special case to force bank account
|
||||
//if (property_exists($object, 'fk_bank'))
|
||||
//{
|
||||
if (GETPOST('fk_bank')) { // this field may come from an external module
|
||||
$object->fk_bank = GETPOST('fk_bank');
|
||||
} else {
|
||||
} else if (! empty($object->fk_account)) {
|
||||
$object->fk_bank = $object->fk_account;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2014-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -44,7 +44,8 @@ if ($action == 'print_file' and $user->rights->printing->read)
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
|
||||
if (! empty($conf->global->{$printer->active})) {
|
||||
if (! empty($conf->global->{$printer->active}))
|
||||
{
|
||||
$subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':'');
|
||||
$module = GETPOST('printer', 'alpha');
|
||||
if ($module =='commande_fournisseur') {
|
||||
@ -56,10 +57,11 @@ if ($action == 'print_file' and $user->rights->printing->read)
|
||||
//print '<pre>'.print_r($printer->errors, true).'</pre>';
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
if ($ret==0) {
|
||||
if ($ret==0)
|
||||
{
|
||||
//print '<pre>'.print_r($printer->errors, true).'</pre>';
|
||||
setEventMessages($printer->error, $printer->errors);
|
||||
setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->trans("ViaModule").' '.$printer->name, null);
|
||||
setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null);
|
||||
$printed++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,8 +22,6 @@
|
||||
*/
|
||||
|
||||
|
||||
// TODO Include this include file into all element pages allowing email sending
|
||||
|
||||
// $id must be defined
|
||||
// $actiontypecode must be defined
|
||||
// $paramname must be defined
|
||||
@ -34,13 +32,15 @@
|
||||
*/
|
||||
if (GETPOST('addfile'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp';
|
||||
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
|
||||
|
||||
dol_add_file_process($upload_dir_tmp,0,0);
|
||||
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid);
|
||||
$action='presend';
|
||||
}
|
||||
|
||||
@ -49,33 +49,39 @@ if (GETPOST('addfile'))
|
||||
*/
|
||||
if (! empty($_POST['removedfile']) && empty($_POST['removAll']))
|
||||
{
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp';
|
||||
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
|
||||
|
||||
// TODO Delete only files that was uploaded from email form
|
||||
dol_remove_file_process(GETPOST('removedfile','alpha'),0);
|
||||
// TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir"
|
||||
// GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array.
|
||||
dol_remove_file_process(GETPOST('removedfile','alpha'), 0, 1, $trackid); // We do not delete because if file is the official PDF of doc, we don't want to remove it physically
|
||||
$action='presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove all files in email form
|
||||
*/
|
||||
|
||||
if(! empty($_POST['removAll']))
|
||||
if (GETPOST('removAll'))
|
||||
{
|
||||
$listofpaths=array();
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]);
|
||||
if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]);
|
||||
if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]);
|
||||
$keytoavoidconflict = empty($trackid)?'':'-'.$trackid;
|
||||
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$formmail->trackid = $trackid;
|
||||
|
||||
foreach($listofpaths as $key => $value)
|
||||
{
|
||||
$pathtodelete = $value;
|
||||
@ -94,7 +100,9 @@ if(! empty($_POST['removAll']))
|
||||
*/
|
||||
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected'])
|
||||
{
|
||||
if($conf->dolimail->enabled) $langs->load("dolimail@dolimail");
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail");
|
||||
$langs->load('mails');
|
||||
|
||||
$subject='';$actionmsg='';$actionmsg2='';
|
||||
@ -195,7 +203,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
if ($mode == 'emailfromproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
|
||||
if ($mode == 'emailfromorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO));
|
||||
if ($mode == 'emailfrominvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO));
|
||||
|
||||
if ($mode == 'emailfromsupplierproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO));
|
||||
if ($mode == 'emailfromsupplierorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO));
|
||||
if ($mode == 'emailfromsupplierinvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO));
|
||||
|
||||
$deliveryreceipt = $_POST['deliveryreceipt'];
|
||||
|
||||
if ($action == 'send' || $action == 'relance')
|
||||
@ -215,13 +226,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$formmail->trackid = $trackid; // $trackid must be defined
|
||||
|
||||
$attachedfiles=$formmail->get_attached_files();
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
// Feature to push mail sent into Sent folder
|
||||
if (! empty($conf->dolimail->enabled))
|
||||
@ -270,7 +281,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$mesgs[]='<div class="error">'.$mailfile->error.'</div>';
|
||||
setEventMessage($mailfile->error, 'errors');
|
||||
$action='presend';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -351,13 +363,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$action = 'presend';
|
||||
}
|
||||
}
|
||||
/* }
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
$mesgs[]='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
|
||||
dol_syslog('Recipient email is empty');
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user