Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into new_add_customer_multicurrency_payment
Conflicts: htdocs/install/mysql/migration/3.9.0-4.0.0.sql
This commit is contained in:
commit
86c8998742
@ -12,7 +12,7 @@ Upgrading to any other version or any other database system is abolutely require
|
||||
make a Dolibarr upgrade.
|
||||
|
||||
|
||||
***** ChangeLog for 3.9 compared to 3.8.* *****
|
||||
***** ChangeLog for 3.9.0 compared to 3.8.* *****
|
||||
For users:
|
||||
NEW: A new and more modern look for "eldy" theme.
|
||||
NEW: Introduce a new theme called "Material Design".
|
||||
|
||||
@ -22,5 +22,6 @@ Type=Application
|
||||
Categories=Office
|
||||
StartupNotify=true
|
||||
InitialPreference=5
|
||||
Keywords=erp,crm,billing,customer,supplier,stock,agenda,project,order,shipment
|
||||
#NoDisplay=true
|
||||
#OnlyShowIn=GNOME
|
||||
|
||||
@ -26,7 +26,7 @@ $force_install_nophpinfo='1';
|
||||
$force_install_lockinstall='444';
|
||||
|
||||
// Value to overwrite path to use shared libraries/fonts instead of embedded one.
|
||||
// If we enable/disable libraries declaration during install, we must also check they are
|
||||
// If during install, we enable/disable declaration to use non embedded libraries, we must also check they are
|
||||
// - not removed from package (see rm in rules file),
|
||||
// - declared into dependencies (see Depends in control file)
|
||||
//$force_dolibarr_lib_TCPDF_PATH='';
|
||||
|
||||
@ -34,7 +34,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
||||
|
||||
|
||||
if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
||||
// Load conf file if it is already defined
|
||||
--- a/htdocs/support/inc.php
|
||||
+++ b/htdocs/support/inc.php
|
||||
@@ -69,8 +69,8 @@ $conffiletoshowshort = "conf.php";
|
||||
@ -47,4 +47,4 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
||||
|
||||
|
||||
if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
||||
// Load conf file if it is already defined
|
||||
|
||||
@ -354,15 +354,18 @@ if ($nboftargetok) {
|
||||
chdir("$SOURCE");
|
||||
|
||||
# Test that the ChangeLog is ok
|
||||
$ret=`grep "ChangeLog for $MAJOR.$MINOR\.$BUILD" "$SOURCE/ChangeLog" 2>&1`;
|
||||
$TMPBUILDTOCHECKCHANGELOG=$BUILD;
|
||||
$TMPBUILDTOCHECKCHANGELOG =~ s/\-rc//;
|
||||
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)
|
||||
{
|
||||
print "Error: The ChangeLogFile was not updated. Run the following command first:\n";
|
||||
if (! $BUILD)
|
||||
print "Error: The ChangeLogFile was not updated. Run the following command before building package for $MAJOR.$MINOR.$BUILD:\n";
|
||||
if (! $BUILD || $BUILD eq '0-rc') # For a major version
|
||||
{
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
}
|
||||
else
|
||||
else # For a maintenance release
|
||||
{
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
}
|
||||
@ -523,25 +526,27 @@ if ($nboftargetok) {
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.pl`; # Avoid errors into rpmlint
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
|
||||
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`; # Source of this flash is not available
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extensions/TableTools/swf`; # Source of this flash is not available
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`; # Source of this flash is not available
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/select2/release.sh`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/doc`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared/PDF`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/PHPExcel/Shared/PDF`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/PHPExcel/Shared/PCLZip`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
|
||||
@ -549,6 +554,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
|
||||
}
|
||||
@ -837,17 +843,28 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`;
|
||||
# Removed duplicate license files
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/scayt/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/wsc/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/scayt/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/wsc/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source/plugins/scayt/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source/plugins/wsc/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/plugins/scayt/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/plugins/wsc/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/php-iban/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/flot/LICENSE.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.34/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/freefont-20120503/COPYING`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/datatables/extensions/ColReorder/License.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/datatables/extensions/ColVis/License.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/datatables/extensions/FixedColumns/License.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/datatables/extensions/Responsive/License.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/datatables/license.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/select2/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mike42/escpos-php/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mobiledetect/mobiledetectlib/LICENSE.txt`;
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.34/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-20120503/COPYING`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_2.0/COPYING`;
|
||||
# Removed files we don't need
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source`;
|
||||
|
||||
# Rename upstream changelog to match debian rules
|
||||
$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
|
||||
@ -909,8 +926,11 @@ if ($nboftargetok) {
|
||||
$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/modMyModule.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_api_class.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_card.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_class.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_page.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_list.php`;
|
||||
$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_script.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`;
|
||||
$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; ";
|
||||
$ret=`$cmd`;
|
||||
@ -1130,12 +1150,16 @@ if ($nboftargetok) {
|
||||
|
||||
if ($target eq 'SF') {
|
||||
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
|
||||
print "Publish file ".$file." to $NEWPUBLISH/".$filestoscan{$file}."\n";
|
||||
print "Publish file ".$file." to $NEWPUBLISH/".$filestoscan{$file}."/".$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$destFolder="$NEWPUBLISH";
|
||||
print "Publish file ".$file." to $NEWPUBLISH\n";
|
||||
$dirnameonly=$file;
|
||||
$dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/;
|
||||
$filenameonly=$file;
|
||||
$filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/;
|
||||
$destFolder="$NEWPUBLISH/$dirnameonly";
|
||||
print "Publish file ".$file." to $NEWPUBLISH/".$dirnameonly."\n";
|
||||
}
|
||||
|
||||
# mkdir
|
||||
@ -1156,7 +1180,7 @@ if ($nboftargetok) {
|
||||
print "$command\n";
|
||||
my $ret=`$command 2>&1`;
|
||||
|
||||
$command="rsync -s $OPTIONUPDATEDIST -e 'ssh' \"$file\" \"".$destFolder."\"";
|
||||
$command="rsync -s -e 'ssh' \"$file\" \"".$destFolder."\"";
|
||||
print "$command\n";
|
||||
my $ret=`$command 2>&1`;
|
||||
print "$ret\n";
|
||||
|
||||
@ -25,7 +25,7 @@ diff -up htdocs/install/inc.php.patch htdocs/install/inc.php
|
||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
||||
|
||||
|
||||
if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
||||
// Load conf file if it is already defined
|
||||
diff -up htdocs/support/inc.php.patch htdocs/support/inc.php
|
||||
--- htdocs/support/inc.php.patch 2011-09-03 02:34:39.606952000 +0200
|
||||
+++ htdocs/support/inc.php 2011-09-03 02:33:59.814952000 +0200
|
||||
@ -39,4 +39,4 @@ diff -up htdocs/support/inc.php.patch htdocs/support/inc.php
|
||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
||||
|
||||
|
||||
if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
||||
// Load conf file if it is already defined
|
||||
|
||||
@ -183,6 +183,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/fourn
|
||||
%_datadir/dolibarr/htdocs/ftp
|
||||
%_datadir/dolibarr/htdocs/holiday
|
||||
%_datadir/dolibarr/htdocs/hrm
|
||||
%_datadir/dolibarr/htdocs/imports
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
@ -200,6 +201,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
%_datadir/dolibarr/htdocs/resource
|
||||
%_datadir/dolibarr/htdocs/societe
|
||||
%_datadir/dolibarr/htdocs/supplier_proposal
|
||||
%_datadir/dolibarr/htdocs/support
|
||||
%_datadir/dolibarr/htdocs/theme
|
||||
%_datadir/dolibarr/htdocs/user
|
||||
|
||||
@ -263,6 +263,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/fourn
|
||||
%_datadir/dolibarr/htdocs/ftp
|
||||
%_datadir/dolibarr/htdocs/holiday
|
||||
%_datadir/dolibarr/htdocs/hrm
|
||||
%_datadir/dolibarr/htdocs/imports
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
@ -280,6 +281,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
%_datadir/dolibarr/htdocs/resource
|
||||
%_datadir/dolibarr/htdocs/societe
|
||||
%_datadir/dolibarr/htdocs/supplier_proposal
|
||||
%_datadir/dolibarr/htdocs/support
|
||||
%_datadir/dolibarr/htdocs/theme
|
||||
%_datadir/dolibarr/htdocs/user
|
||||
|
||||
@ -180,6 +180,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/fourn
|
||||
%_datadir/dolibarr/htdocs/ftp
|
||||
%_datadir/dolibarr/htdocs/holiday
|
||||
%_datadir/dolibarr/htdocs/hrm
|
||||
%_datadir/dolibarr/htdocs/imports
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
@ -197,6 +198,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
%_datadir/dolibarr/htdocs/resource
|
||||
%_datadir/dolibarr/htdocs/societe
|
||||
%_datadir/dolibarr/htdocs/supplier_proposal
|
||||
%_datadir/dolibarr/htdocs/support
|
||||
%_datadir/dolibarr/htdocs/theme
|
||||
%_datadir/dolibarr/htdocs/user
|
||||
|
||||
@ -191,6 +191,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/fourn
|
||||
%_datadir/dolibarr/htdocs/ftp
|
||||
%_datadir/dolibarr/htdocs/holiday
|
||||
%_datadir/dolibarr/htdocs/hrm
|
||||
%_datadir/dolibarr/htdocs/imports
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
@ -208,6 +209,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
%_datadir/dolibarr/htdocs/resource
|
||||
%_datadir/dolibarr/htdocs/societe
|
||||
%_datadir/dolibarr/htdocs/supplier_proposal
|
||||
%_datadir/dolibarr/htdocs/support
|
||||
%_datadir/dolibarr/htdocs/theme
|
||||
%_datadir/dolibarr/htdocs/user
|
||||
|
||||
@ -237,7 +237,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
|
||||
dol_syslog($script_file, LOG_DEBUG);
|
||||
@ -257,9 +257,9 @@ if ($resql)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies');
|
||||
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -359,7 +359,7 @@ if ($resql)
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
@ -20,13 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \ingroup Accounting Expert
|
||||
<<<<<<< HEAD
|
||||
* \brief To define accounting account on product / service
|
||||
=======
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
>>>>>>> refs/remotes/origin/3.9
|
||||
* \brief To define accounting account on product / service
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -296,7 +292,7 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
|
||||
print '<td class=liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td align="center" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
|
||||
281
htdocs/accountancy/bookkeeping/balance.php
Normal file
281
htdocs/accountancy/bookkeeping/balance.php
Normal file
@ -0,0 +1,281 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 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
|
||||
* 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/accountancy/bookkeeping/balance.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Balance of book keeping
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
|
||||
$page = GETPOST("page");
|
||||
$sortorder = GETPOST("sortorder");
|
||||
$sortfield = GETPOST("sortfield");
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
|
||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
}
|
||||
$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
|
||||
if ($search_accountancy_code_end == - 1) {
|
||||
$search_accountancy_code_end = '';
|
||||
}
|
||||
|
||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
|
||||
$action = 'export_csv';
|
||||
}
|
||||
|
||||
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
|
||||
$offset = $limit * $page;
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
$formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
}
|
||||
|
||||
if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
}
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "t.rowid";
|
||||
|
||||
$options = '';
|
||||
$filter = array ();
|
||||
if (! empty($search_date_start)) {
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
||||
}
|
||||
if (! empty($search_date_end)) {
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int');
|
||||
}
|
||||
if (! empty($search_accountancy_code_start)) {
|
||||
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
||||
$options .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
||||
}
|
||||
if (! empty($search_accountancy_code_end)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$options .= '&search_accountancy_code_end=' . $search_accountancy_code_end;
|
||||
}
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = 'bookkepping';
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
||||
$sep = ";";
|
||||
// Model Cegid Expert Export
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
print $date . $sep;
|
||||
print $line->code_journal . $sep;
|
||||
print length_accountg($line->numero_compte) . $sep;
|
||||
print ' ' . $sep;
|
||||
print $line->sens . $sep;
|
||||
print price($line->montant) . $sep;
|
||||
print dol_trunc($line->label_compte, 32) . $sep;
|
||||
print $line->doc_ref . $sep;
|
||||
|
||||
/*print $line->piece_num . $sep;
|
||||
print length_accounta($line->code_tiers) . $sep;
|
||||
print . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;*/
|
||||
|
||||
print "\n";
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
||||
|
||||
// Std export
|
||||
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
print $date . $sep;
|
||||
print $line->doc_ref . $sep;
|
||||
print length_accounta($line->numero_compte) . $sep;
|
||||
print length_accountg($line->code_tiers) . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;
|
||||
|
||||
/*print $line->piece_num . $sep;
|
||||
print $line->label_compte . $sep;
|
||||
print price($line->montant) . $sep;
|
||||
print $line->sens . $sep;*/
|
||||
print $line->code_journal . $sep;
|
||||
print "\n";
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
|
||||
|
||||
// Coala export
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
print $date . $sep;
|
||||
print $line->code_journal . $sep;
|
||||
print length_accounta($line->numero_compte) . $sep;
|
||||
print $line->piece_num . $sep;
|
||||
print $line->doc_ref . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;
|
||||
print 'E' . $sep;
|
||||
print length_accountg($line->code_tiers) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
$title_page = $langs->trans("AccountBalance") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
/*
|
||||
* List
|
||||
*/
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<div class="tabsAction">' . "\n";
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('DateStart') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print $langs->trans('DateEnd') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
print '<br>';
|
||||
print $langs->trans('To');
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$var = True;
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit - $line->debit) . '</td>';
|
||||
print '<td align="center">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_credit);
|
||||
print '</td>';
|
||||
print '<td align="right">' . price($total_credit - $total_debit) . '</td>';
|
||||
print '<td align="right"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
}
|
||||
$db->close();
|
||||
@ -208,8 +208,8 @@ print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, "", $sortfield, $sortorder);
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '</td>';
|
||||
print '<th class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?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-*2016 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
|
||||
@ -642,6 +642,86 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= " t.numero_compte,";
|
||||
$sql .= " SUM(t.debit) as debit,";
|
||||
$sql .= " SUM(t.credit) as credit";
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
foreach ( $filter as $key => $value ) {
|
||||
if ($key == 't.doc_date') {
|
||||
$sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\'';
|
||||
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.code_tiers>=' || $key == 't.code_tiers<=') {
|
||||
$sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\'';
|
||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||
$sqlwhere[] = $key . '=' . $value;
|
||||
} elseif ($key == 't.code_tiers' || $key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||
} else {
|
||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
}
|
||||
|
||||
$sql .= ' GROUP BY t.numero_compte';
|
||||
|
||||
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 BookKeepingLine();
|
||||
|
||||
$line->numero_compte = $obj->numero_compte;
|
||||
$line->debit = $obj->debit;
|
||||
$line->credit = $obj->credit;
|
||||
$this->lines[] = $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
|
||||
*
|
||||
|
||||
@ -94,6 +94,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid =
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " WHERE f.fk_statut > 0 ";
|
||||
$sql .= " AND fd.fk_code_ventilation > 0 ";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -32,19 +32,20 @@ $langs->load("members");
|
||||
|
||||
$filter=$_GET["filter"];
|
||||
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
|
||||
$search_ref=GETPOST('search_ref');
|
||||
$search_lastname=GETPOST('search_lastname');
|
||||
$search_login=GETPOST('search_login');
|
||||
$search_note=GETPOST('search_note');
|
||||
$search_ref=GETPOST('search_ref','alpha');
|
||||
$search_lastname=GETPOST('search_lastname','alpha');
|
||||
$search_login=GETPOST('search_login','alpha');
|
||||
$search_note=GETPOST('search_note','alpha');
|
||||
$search_account=GETPOST('search_account','int');
|
||||
$search_amount=GETPOST('search_amount','int');
|
||||
$search_amount=GETPOST('search_amount','alpha');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) { $sortorder="DESC"; }
|
||||
@ -101,28 +102,21 @@ if ($search_ref)
|
||||
if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")";
|
||||
else $sql.=" AND 1 = 2"; // Always wrong
|
||||
}
|
||||
if ($search_lastname)
|
||||
{
|
||||
$sql.= " AND (d.firstname LIKE '%".$db->escape($search_lastname)."%' OR d.lastname LIKE '%".$db->escape($search_lastname)."%' OR d.societe LIKE '%".$db->escape($search_lastname)."%')";
|
||||
}
|
||||
if ($search_login)
|
||||
{
|
||||
$sql.= " AND d.login LIKE '%".$db->escape($search_login)."%'";
|
||||
}
|
||||
if ($search_note)
|
||||
{
|
||||
$sql.= " AND c.note LIKE '%".$db->escape($search_note)."%'";
|
||||
}
|
||||
if ($search_account > 0)
|
||||
{
|
||||
$sql.= " AND b.fk_account = ".$search_account;
|
||||
}
|
||||
if ($search_amount)
|
||||
{
|
||||
$sql.=" AND c.cotisation = ".$db->escape($search_amount);
|
||||
}
|
||||
if ($search_lastname) $sql.= natural_search(array('d.firstname','d.lastname','d.societe'), $search_lastname);
|
||||
if ($search_login) $sql.= natural_search('c.cotisation', $search_login);
|
||||
if ($search_note) $sql.= natural_search('c.note', $search_note);
|
||||
if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account;
|
||||
if ($search_amount) $sql.= natural_search('c.cotisation', $search_amount, 1);
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -133,24 +127,29 @@ if ($result)
|
||||
$title=$langs->trans("ListOfSubscriptions");
|
||||
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
||||
|
||||
$param="";
|
||||
$param='';
|
||||
$param.="&statut=$statut&date_select=$date_select";
|
||||
|
||||
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
|
||||
if ($search_login) $param.="&search_login=".$search_login;
|
||||
if ($search_acount) $param.="&search_account=".$search_account;
|
||||
if ($search_amount) $param.="&search_amount=".$search_amount;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
||||
}
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].($param?'?'.$param:'').'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -164,7 +163,8 @@ if ($result)
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.cotisation",$param,"",'colspan="2" align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.cotisation",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ if ($result)
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre" colspan="2" align="right">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
@ -270,7 +270,9 @@ if ($result)
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
|
||||
|
||||
// Price
|
||||
print '<td align="right" colspan="2">'.price($objp->cotisation).'</td>';
|
||||
print '<td align="right">'.price($objp->cotisation).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
@ -290,7 +292,8 @@ if ($result)
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right" colspan="2">'.price($total)."</td>\n";
|
||||
print '<td align="right">'.price($total)."</td>\n";
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -50,14 +50,15 @@ $catid = GETPOST("catid",'int');
|
||||
$sall=GETPOST("sall");
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) { $sortorder=($filter=='outofdate'?"ASC":"DESC"); }
|
||||
if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
|
||||
if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
@ -143,6 +144,7 @@ if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->id
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records with no order and no limits
|
||||
$nbtotalofrecords = 0;
|
||||
@ -152,9 +154,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
if ($resql) $nbtotalofrecords = $db->num_rows($resql);
|
||||
else dol_print_error($db);
|
||||
}
|
||||
// Add order and limit
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
// Add limit
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
dol_syslog("get list", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
@ -185,7 +186,8 @@ if ($resql)
|
||||
$titre.=" (".$membertype->libelle.")";
|
||||
}
|
||||
|
||||
$param="";
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($statut != "") $param.="&statut=".$statut;
|
||||
if ($search_nom) $param.="&search_nom=".$search_nom;
|
||||
if ($search_login) $param.="&search_login=".$search_login;
|
||||
@ -193,12 +195,17 @@ if ($resql)
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($type > 0) $param.="&type=".$type;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].($param?'?'.$param:'').'">';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
@ -227,6 +234,10 @@ if ($resql)
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
{
|
||||
print '<td width="5" align="center"> </td>';
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
@ -245,6 +256,8 @@ if ($resql)
|
||||
|
||||
// Line for filters fields
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.$search_ref.'" size="4"></td>';
|
||||
@ -303,6 +316,11 @@ if ($resql)
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
{
|
||||
print '<td align="center">'.($i+1).'</td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
print "<td>";
|
||||
@ -396,10 +414,7 @@ if ($resql)
|
||||
print "</table>\n";
|
||||
print '</form>';
|
||||
|
||||
if ($num > $conf->liste_limit)
|
||||
{
|
||||
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'');
|
||||
}
|
||||
if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>ù
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es>ù
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
*
|
||||
* 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
|
||||
@ -38,21 +38,34 @@ if (!$user->admin)
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Shipment note
|
||||
if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||
{
|
||||
// This option should always be set to on when module is on.
|
||||
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity);
|
||||
}
|
||||
/*
|
||||
if ($action == 'activate_sending')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity);
|
||||
header("Location: confexped.php");
|
||||
exit;
|
||||
}
|
||||
else if ($action == 'disable_sending')
|
||||
if ($action == 'disable_sending')
|
||||
{
|
||||
dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION",$conf->entity);
|
||||
header("Location: confexped.php");
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
// Delivery note
|
||||
else if ($action == 'activate_delivery')
|
||||
if ($action == 'activate_delivery')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity); // We must also enable this
|
||||
dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1",'chaine',0,'',$conf->entity);
|
||||
@ -68,8 +81,9 @@ else if ($action == 'disable_delivery')
|
||||
|
||||
|
||||
/*
|
||||
* Affiche page
|
||||
* View
|
||||
*/
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/";
|
||||
$form=new Form($db);
|
||||
|
||||
@ -102,16 +116,15 @@ print '<td>'.$langs->trans("SendingsAbility").'</td>';
|
||||
print '<td align="center" width="20">';
|
||||
print '</td>';
|
||||
print '<td align="center" width="100">';
|
||||
|
||||
if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||
print $langs->trans("Required");
|
||||
/*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||
{
|
||||
print '<a href="confexped.php?action=activate_sending">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="confexped.php?action=disable_sending">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
|
||||
}*/
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 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
|
||||
@ -164,7 +165,7 @@ if ($action == 'edit')
|
||||
foreach($delays as $delay)
|
||||
{
|
||||
$var=!$var;
|
||||
$value=(! empty($conf->global->$delay['code'])?$conf->global->$delay['code']:0);
|
||||
$value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0);
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td width="20px">'.img_object('',$delay['img']).'</td>';
|
||||
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>';
|
||||
@ -211,7 +212,7 @@ else
|
||||
foreach($delays as $delay)
|
||||
{
|
||||
$var=!$var;
|
||||
$value=(! empty($conf->global->$delay['code'])?$conf->global->$delay['code']:0);
|
||||
$value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0);
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td width="20px">'.img_object('',$delay['img']).'</td>';
|
||||
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
|
||||
@ -261,24 +262,24 @@ $text=''; $options='height="60px"';
|
||||
print '<table>';
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print img_picto_common($text,'weather/weather-clear.png',$options);
|
||||
print img_weather($text,'weather-clear.png',$options);
|
||||
print '</td><td>= '.$level0.'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
print img_picto_common($text,'weather/weather-few-clouds.png',$options);
|
||||
print img_weather($text,'weather-few-clouds.png',$options);
|
||||
print '</td><td><= '.$level1.'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
print img_picto_common($text,'weather/weather-clouds.png',$options);
|
||||
print img_weather($text,'weather-clouds.png',$options);
|
||||
print '</td><td><= '.$level2.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print img_picto_common($text,'weather/weather-many-clouds.png',$options);
|
||||
print img_weather($text,'weather-many-clouds.png',$options);
|
||||
print '</td><td><= '.$level3.'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
print img_picto_common($text,'weather/weather-storm.png',$options);
|
||||
print img_weather($text,'weather-storm.png',$options);
|
||||
print '</td><td>> '.$level3.'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 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
|
||||
@ -1162,7 +1163,7 @@ if ($id)
|
||||
{
|
||||
$showfield=1;
|
||||
$align="left";
|
||||
$valuetoshow=$obj->$fieldlist[$field];
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
if ($value == 'type_template')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
@ -1199,77 +1200,77 @@ if ($id)
|
||||
else if ($fieldlist[$field]=='libelle_facture') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
$valuetoshow=nl2br($valuetoshow);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') {
|
||||
$langs->load("propal");
|
||||
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
|
||||
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
|
||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
|
||||
$key=$langs->trans("Civility".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
||||
$langs->load('agenda');
|
||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
|
||||
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
|
||||
$langs->load("orders");
|
||||
$key=$langs->trans($obj->code);
|
||||
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]};
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
|
||||
$langs->load("sendings");
|
||||
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
|
||||
{
|
||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
|
||||
{
|
||||
$langs->load('trips');
|
||||
$key = $langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
||||
$showfield=0;
|
||||
@ -1279,16 +1280,16 @@ if ($id)
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow=$langs->trans($obj->$fieldlist[$field]);
|
||||
$valuetoshow=$langs->trans($obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->$fieldlist[$field]);
|
||||
$valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format'))
|
||||
{
|
||||
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
|
||||
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$fieldlist[$field]);
|
||||
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
|
||||
else if ($fieldlist[$field]=='localtax1_type') {
|
||||
@ -1504,7 +1505,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
{
|
||||
if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
|
||||
{
|
||||
$country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
|
||||
$country_id = (! empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
|
||||
print '</td>';
|
||||
@ -1518,7 +1519,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region_id')
|
||||
{
|
||||
$region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0);
|
||||
$region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
|
||||
print '</td>';
|
||||
@ -1533,21 +1534,21 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
elseif ($fieldlist[$field] == 'type_template')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('type_template', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de l'element (pour les type de contact)
|
||||
elseif ($fieldlist[$field] == 'element')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('element', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
// La source de l'element (pour les type de contact)
|
||||
elseif ($fieldlist[$field] == 'source')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('source', $sourceList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
||||
@ -1558,18 +1559,18 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''),1);
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
|
||||
$align="left";
|
||||
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right
|
||||
print '<td align="'.$align.'">';
|
||||
print '<input type="text" class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" size="3" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
|
||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>';
|
||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('content')))
|
||||
{
|
||||
@ -1580,18 +1581,18 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
else print '<td>';
|
||||
if ($context != 'hide')
|
||||
{
|
||||
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea>';
|
||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), '', 140, 'dolibarr_mailings', 'In', 0, false, true, ROWS_5, '90%');
|
||||
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, true, ROWS_5, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat" value="'.price((! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')).'" size="8" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" size="8" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field]=='unit') {
|
||||
print '<td>';
|
||||
@ -1601,14 +1602,14 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
'point' => $langs->trans('SizeUnitpoint'),
|
||||
'inch' => $langs->trans('SizeUnitinch')
|
||||
);
|
||||
print $form->selectarray('unit', $units, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), 0, 0, 0);
|
||||
print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0);
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de taxe locale
|
||||
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
|
||||
@ -1634,7 +1635,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='tracking') $size='size="92" ';
|
||||
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ if ($action == 'add_currency')
|
||||
|
||||
if ($currency->create($user) > 0)
|
||||
{
|
||||
if ($currency->addRate($rate)) setEventMessages($langs->trans('SuccessAddRate'), array());
|
||||
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
||||
else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
|
||||
}
|
||||
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), array());
|
||||
@ -112,7 +112,7 @@ elseif ($action == 'update_currency')
|
||||
|
||||
if ($currency->fetch($fk_multicurrency) > 0)
|
||||
{
|
||||
if ($currency->delete() > 0) setEventMessages($langs->trans('SuccessDeleteCurrency'), array());
|
||||
if ($currency->delete() > 0) setEventMessages($langs->trans('RecordDeleted'), array());
|
||||
else setEventMessages($langs->trans('ErrorDeleteCurrencyFail'), array(), 'errors');
|
||||
}
|
||||
}
|
||||
@ -131,10 +131,13 @@ if ($resql)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$page_name = "multicurrency";
|
||||
|
||||
$page_name = "MultiCurrency";
|
||||
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
@ -147,7 +150,7 @@ $head = multicurrencyAdminPrepareHead();
|
||||
dol_fiche_head(
|
||||
$head,
|
||||
'settings',
|
||||
$langs->trans("Module500000Name"),
|
||||
$langs->trans("ModuleSetup"),
|
||||
0,
|
||||
"multicurrency"
|
||||
);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2016 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
|
||||
@ -43,7 +44,7 @@ if (!$user->admin)
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
// Supported OAUTH (a provider is supported when a file xxx_oauth2callback.php is available into htdocs/core/modules/oauth)
|
||||
// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth)
|
||||
$supportedoauth2array=array('OAUTH_GOOGLE_NAME'=>'google');
|
||||
|
||||
// API access parameters OAUTH
|
||||
@ -346,14 +347,14 @@ foreach ($list as $key)
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].' class="value">';
|
||||
print '<td><label for="'.$key[1].'">'.$langs->trans($key[1]).'</label></td>';
|
||||
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.$conf->global->$key[1].'">';
|
||||
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.$conf->global->{$key[1]}.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Api Secret
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].' class="value">';
|
||||
print '<td><label for="'.$key[2].'">'.$langs->trans($key[2]).'</label></td>';
|
||||
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.$conf->global->$key[2].'">';
|
||||
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.$conf->global->{$key[2]}.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
@ -368,4 +369,4 @@ print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
220
htdocs/admin/supplier_payment.php
Normal file
220
htdocs/admin/supplier_payment.php
Normal file
@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/payment.php
|
||||
* \ingroup facture
|
||||
* \brief Page to setup invoices payments
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("errors");
|
||||
$langs->load('other');
|
||||
$langs->load('bills');
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstsupplierpayment=GETPOST('maskconstsupplierpayment','alpha');
|
||||
$masksupplierpayment=GETPOST('masksupplierpayment','alpha');
|
||||
if ($maskconstsupplierpayment) $res = dolibarr_set_const($db,$maskconstsupplierpayment,$masksupplierpayment,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setmod')
|
||||
{
|
||||
dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("",$langs->trans("SupplierPaymentSetup"),'EN:Supplier_Payment_Configuration|FR:Configuration_module_paiement_fournisseur');
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("SupplierPaymentSetup"),$linkback,'title_setup');
|
||||
|
||||
print "<br />";
|
||||
|
||||
$head = supplierorder_admin_prepare_head();
|
||||
dol_fiche_head($head, 'supplierpayment', $langs->trans("SupplierPayment"), 0, 'invoice');
|
||||
|
||||
/*
|
||||
* Numbering module
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("SupplierPaymentsNumberingModule"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_payment/");
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||
{
|
||||
$filebis = $file;
|
||||
$classname = preg_replace('/\.php$/','',$file);
|
||||
// For compatibility
|
||||
if (! is_file($dir.$filebis))
|
||||
{
|
||||
$filebis = $file."/".$file.".modules.php";
|
||||
$classname = "mod_supplier_payment_".$file;
|
||||
}
|
||||
// Check if there is a filter on country
|
||||
preg_match('/\-(.*)_(.*)$/',$classname,$reg);
|
||||
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||
|
||||
$classname = preg_replace('/\-.*$/','',$classname);
|
||||
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
|
||||
{
|
||||
// Charging the numbering class
|
||||
require_once $dir.$filebis;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td width="100">';
|
||||
echo preg_replace('/\-.*$/','',preg_replace('/mod_supplier_payment_/','',preg_replace('/\.php$/','',$file)));
|
||||
print "</td><td>\n";
|
||||
|
||||
print $module->info();
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td align="center">';
|
||||
//print "> ".$conf->global->SUPPLIER_PAYMENT_ADDON." - ".$file;
|
||||
if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || $conf->global->SUPPLIER_PAYMENT_ADDON.'.php' == $file)
|
||||
{
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
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 '</td>';
|
||||
|
||||
$payment=new PaiementFourn($db);
|
||||
$payment->initAsSpecimen();
|
||||
|
||||
// Example
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc,$payment);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
|
||||
if ($conf->global->PAYMENT_ADDON.'.php' == $file) // If module is the one used, we show existing errors
|
||||
{
|
||||
if (! empty($module->error)) dol_htmloutput_mesg($module->error,'','error',1);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -69,21 +69,16 @@ print "<br>";
|
||||
// List of workflow we can enable
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print ' <td>'.$langs->trans("Description").'</td>';
|
||||
print ' <td align="center">'.$langs->trans("Status").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$workflowcodes=array(
|
||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
||||
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||
);
|
||||
|
||||
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
|
||||
@ -94,16 +89,30 @@ if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['
|
||||
}
|
||||
}
|
||||
|
||||
// TODO We must sort on position here
|
||||
|
||||
$nbqualified=0;
|
||||
$oldfamily='';
|
||||
|
||||
foreach($workflowcodes as $key => $params)
|
||||
{
|
||||
$picto=$params['picto'];
|
||||
$enabled=$params['enabled'];
|
||||
$family=$params['family'];
|
||||
if (! verifCond($enabled)) continue;
|
||||
|
||||
$nbqualified++;
|
||||
$var = !$var;
|
||||
|
||||
if ($oldfamily != $family)
|
||||
{
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print ' <td>'.$langs->trans("Description").'</td>';
|
||||
print ' <td align="center">'.$langs->trans("Status").'</td>';
|
||||
print "</tr>\n";
|
||||
$oldfamily = $family;
|
||||
}
|
||||
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
print "<td>".img_object('', $picto).$langs->trans('desc'.$key);
|
||||
if (! empty($params['warning']))
|
||||
|
||||
@ -305,28 +305,28 @@ $param.="&maxprint=".$maxprint;
|
||||
// Show navigation bar
|
||||
if (empty($action) || $action=='show_month')
|
||||
{
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month.$param."\">".img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a>\n";
|
||||
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y");
|
||||
$nav.=" </span>\n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month.$param."\">".img_next($langs->trans("Next"))."</a>\n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month.$param."\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>\n";
|
||||
$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a>)";
|
||||
$picto='calendar';
|
||||
}
|
||||
if ($action=='show_week')
|
||||
{
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a>\n";
|
||||
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week;
|
||||
$nav.=" </span>\n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>\n";
|
||||
$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||
$picto='calendarweek';
|
||||
}
|
||||
if ($action=='show_day')
|
||||
{
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a>\n";
|
||||
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort");
|
||||
$nav.=" </span>\n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>\n";
|
||||
$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||
$picto='calendarday';
|
||||
}
|
||||
|
||||
@ -72,11 +72,11 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder)
|
||||
{
|
||||
@ -142,20 +142,8 @@ $form=new Form($db);
|
||||
$userstatic=new User($db);
|
||||
|
||||
$nav='';
|
||||
$nav.='<form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
if ($optioncss != '') $nav.= '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">';
|
||||
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">';
|
||||
if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
|
||||
if ($type) $nav.='<input type="hidden" name="type" value="'.$type.'">';
|
||||
if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
|
||||
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
$nav.='</form>';
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
@ -166,6 +154,7 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
$listofextcals=array();
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
@ -220,6 +209,14 @@ if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AN
|
||||
if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'";
|
||||
if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
@ -279,13 +276,30 @@ if ($resql)
|
||||
$s = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, 0, '', 0, $nav);
|
||||
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?'.$param.'">'."\n";
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
$nav='';
|
||||
if ($optioncss != '') $nav.= '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">';
|
||||
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">';
|
||||
if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
|
||||
if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
print $nav;
|
||||
|
||||
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit);
|
||||
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||
|
||||
@ -242,10 +242,10 @@ $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
|
||||
|
||||
$tmpday = $first_day;
|
||||
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a>\n";
|
||||
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week;
|
||||
$nav.=" </span>\n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>\n";
|
||||
$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||
$picto='calendarweek';
|
||||
|
||||
|
||||
@ -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-2014 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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -37,11 +37,11 @@ $action=GETPOST('action','alpha');
|
||||
$month=GETPOST('month');
|
||||
$year=GETPOST('year');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="a.datep";
|
||||
@ -84,6 +84,14 @@ $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
//$sql.= " AND percent = 100";
|
||||
$sql.= " GROUP BY year, month, df";
|
||||
$sql.= " ORDER BY year DESC, month DESC, df DESC";
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
//print $sql;
|
||||
@ -93,7 +101,18 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -143,6 +162,9 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
|
||||
@ -66,6 +67,7 @@ $form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$companystatic=new Societe($db);
|
||||
if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
|
||||
if (! empty($conf->supplier_proposal->enabled)) $supplierproposalstatic=new SupplierProposal($db);
|
||||
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
|
||||
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
|
||||
|
||||
@ -208,6 +210,86 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Draft supplier proposals
|
||||
*/
|
||||
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$langs->load("supplier_proposal");
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_statut = 0";
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity IN (".getEntity('propal', 1).")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("SupplierProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||
$supplierproposalstatic->id=$obj->rowid;
|
||||
$supplierproposalstatic->ref=$obj->ref;
|
||||
$supplierproposalstatic->total_ht = $obj->total_ht;
|
||||
$supplierproposalstatic->total_tva = $obj->total_tva;
|
||||
$supplierproposalstatic->total_ttc = $obj->total_ttc;
|
||||
print $supplierproposalstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print $companystatic->getNomUrl(1,'customer',16);
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
|
||||
$i++;
|
||||
$total += $obj->total_ht;
|
||||
}
|
||||
if ($total>0)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draft orders
|
||||
*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.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
|
||||
@ -222,6 +222,8 @@ if (empty($reshook))
|
||||
$tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'');
|
||||
|
||||
// Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions)
|
||||
$substitutionarray=array(
|
||||
'__ID__' => $obj->source_id,
|
||||
@ -234,6 +236,7 @@ if (empty($reshook))
|
||||
'__OTHER3__' => $other3,
|
||||
'__OTHER4__' => $other4,
|
||||
'__OTHER5__' => $other5,
|
||||
'__SIGNATURE__' => $signature, // Signature is empty when ran from command line or taken from user in parameter)
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
|
||||
);
|
||||
@ -818,7 +821,9 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
|
||||
if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')';
|
||||
print'</td></tr>';
|
||||
|
||||
// Nb of distinct emails
|
||||
print '<tr><td>';
|
||||
@ -1093,10 +1098,10 @@ else
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print "\n";
|
||||
print '<form name="edit_mailing" action="card.php" method="post" enctype="multipart/form-data">'."\n";
|
||||
@ -1108,7 +1113,7 @@ else
|
||||
print load_fiche_titre($langs->trans("EMail"),'','');
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Subject
|
||||
@ -1175,7 +1180,7 @@ else
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'" name="save">';
|
||||
print ' ';
|
||||
|
||||
@ -38,11 +38,12 @@ $langs->load("mails");
|
||||
if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
@ -95,6 +96,7 @@ if ($action == 'add')
|
||||
|
||||
// Add targets into database
|
||||
$obj = new $classname($db);
|
||||
dol_syslog("Call add_to_target on class ".$classname);
|
||||
$result=$obj->add_to_target($id,$filtersarray);
|
||||
}
|
||||
}
|
||||
@ -194,7 +196,9 @@ if ($object->fetch($id) >= 0)
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
|
||||
if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')';
|
||||
print '</td></tr>';
|
||||
|
||||
// Nb of distinct emails
|
||||
print '<tr><td width="25%">';
|
||||
@ -366,11 +370,21 @@ if ($object->fetch($id) >= 0)
|
||||
if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'";
|
||||
if (!empty($search_dest_status)) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
|
||||
$sql .= $db->order($sortfield,$sortorder);
|
||||
$sql .= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
//$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
|
||||
$sql .= $db->plimit($limit+1, $offset);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param = "&id=".$object->id;
|
||||
@ -388,7 +402,7 @@ if ($object->fetch($id) >= 0)
|
||||
$cleartext='<br></div><div>'.$langs->trans("ToClearAllRecipientsClickHere").': '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">';
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$object->nbemail,'');
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$nbtotalofrecords,'',0,'','',$limit);
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -398,7 +412,8 @@ if ($object->fetch($id) >= 0)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
print '<input type="hidden" name="limit" value="'.$limit.'">';
|
||||
|
||||
|
||||
if ($page) $param.= "&page=".$page;
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -541,7 +556,12 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="8">'.$langs->trans("NoTargetYet").'</td></tr>';
|
||||
if ($object->statut < 2)
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="8">';
|
||||
print $langs->trans("NoTargetYet");
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ class Mailing extends CommonObject
|
||||
$this->statut_dest[-1] = 'MailingStatusError';
|
||||
$this->statut_dest[1] = 'MailingStatusSent';
|
||||
$this->statut_dest[2] = 'MailingStatusRead';
|
||||
$this->statut_dest[3] = 'MailingStatusNotContact';
|
||||
$this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore
|
||||
|
||||
}
|
||||
|
||||
@ -477,6 +477,38 @@ class Mailing extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count number of target with status
|
||||
*
|
||||
* @param string $mode Mode ('alreadysent' = Sent success or error)
|
||||
* @return int Nb of target with status
|
||||
*/
|
||||
function countNbOfTargets($mode)
|
||||
{
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.= " WHERE fk_mailing = ".$this->id;
|
||||
if ($mode == 'alreadysent') $sql.= " AND statut <> 0";
|
||||
else
|
||||
{
|
||||
$this->error='BadValueForParameterMode';
|
||||
return -2;
|
||||
}
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) return $obj->nb;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut d'un mailing (brouillon, validee, ...
|
||||
|
||||
@ -288,7 +288,7 @@ if (empty($reshook))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
// Si on a selectionne une propal a copier, on realise la copie
|
||||
// If we select proposal to clone during creation (when option PROPAL_CLONE_ON_CREATE_PAGE is on)
|
||||
if (GETPOST('createmode') == 'copy' && GETPOST('copie_propal'))
|
||||
{
|
||||
if ($object->fetch(GETPOST('copie_propal')) > 0) {
|
||||
@ -316,7 +316,8 @@ if (empty($reshook))
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
$id = $object->create_from($user);
|
||||
// the create is done below and further more the existing create_from function is quite hilarating
|
||||
//$id = $object->create_from($user);
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), null, 'errors');
|
||||
}
|
||||
|
||||
@ -1064,6 +1064,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function create_from($user)
|
||||
{
|
||||
// i love this function because $this->products is not used in create function...
|
||||
$this->products=$this->lines;
|
||||
|
||||
return $this->create($user);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 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) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
@ -67,6 +67,18 @@ $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='p.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
|
||||
// Nombre de ligne pour choix de produit/service predefinis
|
||||
$NBLINES=4;
|
||||
|
||||
@ -144,19 +156,6 @@ $companystatic=new Societe($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (! $sortfield) $sortfield='p.datep';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' s.rowid, s.nom as name, s.town, s.client, s.code_client,';
|
||||
@ -227,8 +226,6 @@ if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user;
|
||||
}
|
||||
|
||||
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC';
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
@ -255,6 +252,7 @@ if ($result)
|
||||
}
|
||||
|
||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||
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;
|
||||
@ -267,17 +265,17 @@ if ($result)
|
||||
if ($search_town) $param.='&search_town='.$search_town;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png');
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
if ($sall)
|
||||
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
//sort($fieldstosearchall);
|
||||
|
||||
@ -30,6 +30,8 @@ $langs->load("companies");
|
||||
$langs->load("orders");
|
||||
$langs->load("bills");
|
||||
|
||||
$id=GETPOST("id",'int');
|
||||
|
||||
$socid = GETPOST('id','int');
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
@ -53,8 +55,8 @@ if (GETPOST('cancel') && ! empty($backtopage))
|
||||
if (GETPOST("action") == 'setremise')
|
||||
{
|
||||
$object = new Societe($db);
|
||||
$object->fetch($_GET["id"]);
|
||||
$result=$object->set_remise_client($_POST["remise"],$_POST["note"],$user);
|
||||
$object->fetch($id);
|
||||
$result=$object->set_remise_client(price2num(GETPOST("remise")),GETPOST("note"),$user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -1178,7 +1178,16 @@ if (empty($reshook))
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setValueFrom('fk_soc', $socid);
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
exit();
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
@ -1926,8 +1935,19 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr><td>' . $langs->trans('Company') . '</td>';
|
||||
print '<td colspan="3">' . $soc->getNomUrl(1) . '</td>';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr><td>' . $langs->trans('Company') . '</td>';
|
||||
print '</td><td colspan="5">';
|
||||
if (! empty($conf->global->COMMANDE_CHANGE_THIRDPARTY) && $action != 'editthirdparty' && $object->brouillon && $user->rights->commande->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editthirdparty&id=' . $object->id . '">' . img_edit($langs->trans('SetLinkToThirdParty'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
if ($action == 'editthirdparty') {
|
||||
$form->form_thirdparty($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, 'socid','client>0');
|
||||
} else {
|
||||
print ' ' . $soc->getNomUrl(1, 'compta');
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
|
||||
@ -3418,14 +3418,14 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Is the customer order delayed?
|
||||
*
|
||||
* @return bool
|
||||
* @return bool true if late, false if not
|
||||
*/
|
||||
public function hasDelay()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (!($this->statut > Commande::STATUS_DRAFT) && ($this->statut < Commande::STATUS_CLOSED)) {
|
||||
return false;
|
||||
if (! ($this->statut > Commande::STATUS_DRAFT && $this->statut < Commande::STATUS_CLOSED)) {
|
||||
return false; // Never late if not inside this status range
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -64,10 +64,10 @@ $id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'commande', $id,'');
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -90,6 +90,19 @@ $fieldstosearchall = array(
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
||||
|
||||
$arrayfields=array(
|
||||
);
|
||||
// Extra fields
|
||||
/*
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -257,6 +270,7 @@ if ($resql)
|
||||
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($socid > 0) $param.='&socid='.$socid;
|
||||
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
|
||||
if ($ordermonth) $param.='&ordermonth='.$ordermonth;
|
||||
@ -272,7 +286,6 @@ if ($resql)
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png');
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -283,7 +296,9 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
if ($sall)
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
|
||||
@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
@ -147,6 +148,7 @@ $memberstatic=new Adherent($db);
|
||||
$paymentstatic=new Paiement($db);
|
||||
$paymentsupplierstatic=new PaiementFourn($db);
|
||||
$paymentvatstatic=new TVA($db);
|
||||
$remisestatic = new RemiseCheque($db);
|
||||
|
||||
$acct = new Account($db);
|
||||
$acct->fetch($id);
|
||||
@ -155,7 +157,9 @@ $now=dol_now();
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type";
|
||||
$sql.= ", b.fk_bordereau";
|
||||
$sql.= ", bc.number";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bordereau_cheque as bc ON bc.rowid=b.fk_bordereau';
|
||||
$sql.= " WHERE rappro=0 AND fk_account=".$acct->id;
|
||||
$sql.= " ORDER BY dateo ASC";
|
||||
$sql.= " LIMIT 1000"; // Limit to avoid page overload
|
||||
@ -292,7 +296,13 @@ if ($resql)
|
||||
// Type + Number
|
||||
$label=($langs->trans("PaymentType".$objp->type)!="PaymentType".$objp->type)?$langs->trans("PaymentType".$objp->type):$objp->type; // $objp->type is a code
|
||||
if ($label=='SOLD') $label='';
|
||||
print '<td class="nowrap">'.$label.($objp->num_chq?' '.$objp->num_chq:'').($objp->fk_bordereau>0?' ('.$objp->fk_bordereau.')':'').'</td>';
|
||||
$link='';
|
||||
if ($objp->fk_bordereau>0) {
|
||||
$remisestatic->id = $objp->fk_bordereau;
|
||||
$remisestatic->ref = $objp->number;
|
||||
$link = ' '.$remisestatic->getNomUrl(1);
|
||||
}
|
||||
print '<td class="nowrap">'.$label.($objp->num_chq?' '.$objp->num_chq:'').$link.'</td>';
|
||||
|
||||
// Description
|
||||
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">';
|
||||
|
||||
@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
@ -91,7 +92,7 @@ $paymentsupplierstatic=new PaiementFourn($db);
|
||||
$paymentvatstatic=new TVA($db);
|
||||
$bankstatic=new Account($db);
|
||||
$banklinestatic=new AccountLine($db);
|
||||
|
||||
$remisestatic = new RemiseCheque($db);
|
||||
|
||||
// Load account
|
||||
$object = new Account($db);
|
||||
@ -328,9 +329,11 @@ else
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
||||
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||
$sql.= " b.fk_bordereau,";
|
||||
$sql.= " bc.number,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bordereau_cheque as bc ON bc.rowid=b.fk_bordereau';
|
||||
$sql.= " WHERE b.num_releve='".$db->escape($num)."'";
|
||||
if (!isset($num)) $sql.= " OR b.num_releve is null";
|
||||
$sql.= " AND b.fk_account = ".$object->id;
|
||||
@ -374,7 +377,13 @@ else
|
||||
} else {
|
||||
$type_label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type;
|
||||
}
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').($objp->fk_bordereau>0?' ('.$objp->fk_bordereau.')':'').'</td>';
|
||||
$link='';
|
||||
if ($objp->fk_bordereau>0) {
|
||||
$remisestatic->id = $objp->fk_bordereau;
|
||||
$remisestatic->ref = $objp->number;
|
||||
$link = ' '.$remisestatic->getNomUrl(1);
|
||||
}
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').$link.'</td>';
|
||||
|
||||
// Description
|
||||
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
||||
|
||||
@ -42,14 +42,16 @@ $langs->load("margins");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'banque');
|
||||
|
||||
$description=GETPOST("description");
|
||||
$debit=GETPOST("debit");
|
||||
$credit=GETPOST("credit");
|
||||
$type=GETPOST("type");
|
||||
$account=GETPOST("account");
|
||||
$description=GETPOST("description",'alpha');
|
||||
$debit=GETPOST("debit",'alpha');
|
||||
$credit=GETPOST("credit",'alpha');
|
||||
$type=GETPOST("type",'alpha');
|
||||
$account=GETPOST("account",'alpha');
|
||||
$bid=GETPOST("bid","int");
|
||||
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||
$search_thirdparty=GETPOST("thirdparty",'alpha');
|
||||
$search_req_nb=GETPOST("req_nb",'alpha');
|
||||
|
||||
$param='';
|
||||
if (!empty($description)) $param.='&description='.$description;
|
||||
@ -63,14 +65,14 @@ if (dol_strlen($search_dt_start) > 0)
|
||||
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');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='b.dateo';
|
||||
|
||||
@ -82,6 +84,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$credit="";
|
||||
$account="";
|
||||
$bid="";
|
||||
$search_req_nb='';
|
||||
$search_thirdparty='';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -111,15 +115,15 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
||||
if (GETPOST("req_nb"))
|
||||
if ($search_req_nb)
|
||||
{
|
||||
$sql.= " AND b.num_chq LIKE '%".$db->escape(GETPOST("req_nb"))."%'";
|
||||
$param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
$sql.= " AND b.num_chq LIKE '%".$db->escape($search_req_nb)."%'";
|
||||
$param.='&req_nb='.urlencode($search_req_nb);
|
||||
}
|
||||
if (GETPOST("thirdparty"))
|
||||
if ($search_thirdparty)
|
||||
{
|
||||
$sql.=" AND s.nom LIKE '%".$db->escape(GETPOST("thirdparty"))."%'";
|
||||
$param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
$sql.=" AND s.nom LIKE '%".$db->escape($search_thirdparty)."%'";
|
||||
$param.='&thirdparty='.urlencode($search_thirdparty);
|
||||
}
|
||||
if ($bid)
|
||||
{
|
||||
@ -137,22 +141,19 @@ if (dol_strlen($search_dt_end)>0) {
|
||||
$sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'";
|
||||
}
|
||||
// Search criteria amount
|
||||
$si=0;
|
||||
$debit = price2num(str_replace('-','',$debit));
|
||||
$credit = price2num(str_replace('-','',$credit));
|
||||
if (is_numeric($debit)) {
|
||||
$si++;
|
||||
$sqlw[$si] .= " b.amount = -" . $debit;
|
||||
}
|
||||
if (is_numeric($credit)) {
|
||||
$si++;
|
||||
$sqlw[$si] .= " b.amount = " . $credit;
|
||||
}
|
||||
// Other search criteria
|
||||
for ($i = 1 ; $i <= $si; $i++) {
|
||||
$sql .= " AND " . $sqlw[$i];
|
||||
}
|
||||
if ($debit) $sql.= natural_search('- b.amount', $debit, 1);
|
||||
if ($credit) $sql.= natural_search('b.amount', $credit, 1);
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
@ -164,25 +165,30 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
if (! empty($_REQUEST['bid'])) print '<input type="hidden" name="bid" value="'.$_REQUEST["bid"].'">';
|
||||
|
||||
// Title
|
||||
$bankcateg=new BankCateg($db);
|
||||
if (GETPOST("bid"))
|
||||
{
|
||||
$result=$bankcateg->fetch(GETPOST("bid"));
|
||||
print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,'', 'title_bank.png');
|
||||
print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, '', '', $limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', 'title_bank.png');
|
||||
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, '', '', $limit);
|
||||
}
|
||||
|
||||
print '<form method="post" action="search.php" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
if (! empty($_REQUEST['bid'])) print '<input type="hidden" name="bid" value="'.$_REQUEST["bid"].'">';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' ';
|
||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||
@ -209,6 +215,7 @@ if ($resql)
|
||||
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);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -218,17 +225,18 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 8);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.GETPOST("req_nb").'" size="2"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.$search_req_nb.'" size="2"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="description" size="10" value="'.$description.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.GETPOST("thirdparty").'" size="10"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.$search_thirdparty.'" size="10"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="text" class="flat" name="debit" size="4" value="'.$debit.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="text" class="flat" name="credit" size="4" value="'.$credit.'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
@ -325,6 +333,9 @@ if ($resql)
|
||||
$bankaccountstatic->label=$objp->bankref;
|
||||
print $bankaccountstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
$i++;
|
||||
@ -336,6 +347,7 @@ if ($resql)
|
||||
print '<td align="right">' . price($total_debit * - 1) . '</td>';
|
||||
print '<td align="right">' . price($total_credit) . '</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -2346,7 +2346,7 @@ if ($action == 'create')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print '<td colspan="2" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -2361,7 +2361,7 @@ if ($action == 'create')
|
||||
|
||||
// Template to use by default
|
||||
print '<tr><td>' . $langs->trans('Model') . '</td>';
|
||||
print '<td>';
|
||||
print '<td colspan="2">';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
$liste = ModelePDFFactures::liste_modeles($db);
|
||||
print $form->selectarray('model', $liste, $conf->global->FACTURE_ADDON_PDF);
|
||||
@ -2372,7 +2372,7 @@ if ($action == 'create')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print '<td colspan="2" class="maxwidthonsmartphone">';
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -3074,7 +3074,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
$nbrows ++;
|
||||
if ($selleruserevenustamp)
|
||||
$nbrows ++;
|
||||
|
||||
if (! empty($conf->multicurrency->enabled)) $nbrows+=5;
|
||||
if (! empty($conf->incoterm->enabled)) $nbrows+=1;
|
||||
|
||||
print '<td rowspan="' . $nbrows . '" colspan="2" valign="top">';
|
||||
|
||||
if ($object->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
|
||||
@ -3443,14 +3445,14 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
// Multicurrency code
|
||||
print '<tr>';
|
||||
print '<td width="25%">';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('Currency','multicurrency_code');
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editmulticurrencycode') {
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
|
||||
} else {
|
||||
@ -3460,14 +3462,14 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Multicurrency rate
|
||||
print '<tr>';
|
||||
print '<td width="25%">';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('Rate','multicurrency_tx');
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx');
|
||||
} else {
|
||||
@ -3507,7 +3509,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
print ' ';
|
||||
|
||||
print $prevsits[0]->situation_counter;
|
||||
for ($i = 1; $i < count($prevsits); $i++) {
|
||||
$cprevsits = count($prevsits);
|
||||
|
||||
for ($i = 1; $i < $cprevsits; $i++) {
|
||||
print ' + ';
|
||||
print $prevsits[$i]->situation_counter;
|
||||
}
|
||||
@ -3528,7 +3532,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
||||
|
||||
// Previous situation(s) deduction(s)
|
||||
for ($i = 0; $i < count($prevsits); $i++) {
|
||||
for ($i = 0; $i < $cprevsits; $i++) {
|
||||
print '<tr><td>';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?facid=' . $prevsits[$i]->id . '">';
|
||||
print $langs->trans('SituationDeduction');
|
||||
@ -3841,6 +3845,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// deprecated. Useless because now we can use templates
|
||||
if (! empty($conf->global->FACTURE_SHOW_SEND_REMINDER)) // For backward compatibility
|
||||
{
|
||||
if (($object->statut == 1 || $object->statut == 2) && $resteapayer > 0) {
|
||||
@ -3896,7 +3901,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Classify paid
|
||||
if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0))
|
||||
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id))
|
||||
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id))
|
||||
)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a></div>';
|
||||
@ -3926,10 +3931,10 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=clone&object=invoice">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
// Clone as predefined
|
||||
// Clone as predefined / Create template
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $user->rights->facture->creer)
|
||||
{
|
||||
if (! $objectidnext)
|
||||
if (! $objectidnext && count($object->lines) > 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||
}
|
||||
@ -3944,7 +3949,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
//Create next situation invoice
|
||||
// Create next situation invoice
|
||||
if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
|
||||
if ($object->is_last_in_cycle() && $object->situation_final != 1) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=create&type=5&origin=facture&originid=' . $object->id . '&socid=' . $object->socid . '" >' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -83,7 +84,20 @@ class FactureRec extends Facture
|
||||
// Clean parameters
|
||||
$this->titre=trim($this->titre);
|
||||
$this->usenewprice=empty($this->usenewprice)?0:$this->usenewprice;
|
||||
|
||||
|
||||
// No frequency defined then no next date to execution
|
||||
if (empty($this->frequency))
|
||||
{
|
||||
$this->frequency=0;
|
||||
$this->date_when=NULL;
|
||||
}
|
||||
|
||||
|
||||
$this->frequency=abs($this->frequency);
|
||||
$this->nb_gen_done=0;
|
||||
$this->nb_gen_max=empty($this->nb_gen_max)?0:$this->nb_gen_max;
|
||||
$this->auto_validate=empty($this->auto_validate)?0:$this->auto_validate;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Charge facture modele
|
||||
@ -105,9 +119,17 @@ class FactureRec extends Facture
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_account";
|
||||
$sql.= ", fk_cond_reglement";
|
||||
$sql.= ", fk_mode_reglement";
|
||||
$sql.= ", usenewprice";
|
||||
$sql.= ", frequency";
|
||||
$sql.= ", unit_frequency";
|
||||
$sql.= ", date_when";
|
||||
$sql.= ", date_last_gen";
|
||||
$sql.= ", nb_gen_done";
|
||||
$sql.= ", nb_gen_max";
|
||||
$sql.= ", auto_validate";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->titre."'";
|
||||
$sql.= ", ".$facsrc->socid;
|
||||
@ -119,9 +141,17 @@ class FactureRec extends Facture
|
||||
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||
$sql.= ", '".$user->id."'";
|
||||
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");
|
||||
$sql.= ", ".(! empty($facsrc->fk_account)?"'".$facsrc->fk_account."'":"null");
|
||||
$sql.= ", '".$facsrc->cond_reglement_id."'";
|
||||
$sql.= ", '".$facsrc->mode_reglement_id."'";
|
||||
$sql.= ", ".$this->usenewprice;
|
||||
$sql.= ", ".$this->frequency;
|
||||
$sql.= ", '".$this->db->escape($this->unit_frequency)."'";
|
||||
$sql.= ", ".(!empty($this->date_when)?"'".$this->db->idate($this->date_when)."'":'NULL');
|
||||
$sql.= ", ".(!empty($this->date_last_gen)?"'".$this->db->idate($this->date_last_gen)."'":'NULL');
|
||||
$sql.= ", ".$this->nb_gen_done;
|
||||
$sql.= ", ".$this->nb_gen_max;
|
||||
$sql.= ", ".$this->auto_validate;
|
||||
$sql.= ")";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
@ -197,7 +227,9 @@ class FactureRec extends Facture
|
||||
$sql = 'SELECT f.titre,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
|
||||
$sql.= ', f.date_lim_reglement as dlr';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet';
|
||||
$sql.= ', f.fk_account';
|
||||
$sql.= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
||||
$sql.= ', el.fk_source';
|
||||
@ -248,6 +280,7 @@ class FactureRec extends Facture
|
||||
$this->cond_reglement = $obj->cond_reglement_libelle;
|
||||
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->fk_facture_source = $obj->fk_facture_source;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
@ -255,6 +288,14 @@ class FactureRec extends Facture
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->rang = $obj->rang;
|
||||
$this->special_code = $obj->special_code;
|
||||
$this->frequency = $obj->frequency;
|
||||
$this->unit_frequency = $obj->unit_frequency;
|
||||
$this->date_when = $obj->date_when;
|
||||
$this->date_last_gen = $obj->date_last_gen;
|
||||
$this->nb_gen_done = $obj->nb_gen_done;
|
||||
$this->nb_gen_max = $obj->nb_gen_max;
|
||||
$this->usenewprice = $obj->usenewprice;
|
||||
$this->auto_validate = $obj->auto_validate;
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
@ -468,7 +509,7 @@ class FactureRec extends Facture
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
||||
|
||||
$product_type=$type;
|
||||
if ($fk_product)
|
||||
{
|
||||
@ -529,6 +570,63 @@ class FactureRec extends Facture
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the next date of
|
||||
*
|
||||
* @return timestamp false if KO, timestamp if OK
|
||||
*/
|
||||
function getNextDate()
|
||||
{
|
||||
if (empty($this->date_when)) return false;
|
||||
return dol_time_plus_duree(strtotime($this->date_when), $this->frequency, $this->unit_frequency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create all recurrents invoices
|
||||
*
|
||||
* @return int number of created invoices
|
||||
*/
|
||||
function createRecurringInvoices()
|
||||
{
|
||||
global $db,$user;
|
||||
|
||||
$nb_create=0;
|
||||
|
||||
$today = date('Y-m-d 23:59:59');
|
||||
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_rec';
|
||||
$sql.= ' WHERE date_when IS NOT NULL AND frequency > 0';
|
||||
$sql.= ' AND date_when <= "'.$db->escape($today).'"';
|
||||
$sql.= ' AND nb_gen_done < nb_gen_max';
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($line = $db->fetch_object($resql))
|
||||
{
|
||||
$facturerec = new FactureRec($db);
|
||||
$facturerec->fetch($line->rowid);
|
||||
|
||||
$facture = new Facture($db);
|
||||
$result = $facture->createFromRec($user, $facturerec);
|
||||
|
||||
// >0 create and validate if auto_validate
|
||||
// =0 create but not validate if auto_validate
|
||||
// <0 broken
|
||||
if ($result >= 0)
|
||||
{
|
||||
$next_date = $facturerec->getNextDate();
|
||||
$facturerec->setNextDate($next_date,1);
|
||||
|
||||
$nb_create++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $nb_create;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
@ -601,4 +699,143 @@ class FactureRec extends Facture
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update frequency and unit
|
||||
*
|
||||
* @param int $frequency value of frequency
|
||||
* @param string $unit unit of frequency (d, m, y)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setFrequencyAndUnit($frequency,$unit)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!empty($frequency) && empty($unit))
|
||||
{
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined",LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null');
|
||||
if (!empty($unit))
|
||||
{
|
||||
$sql.= ', unit_frequency = "'.$this->db->escape($unit).'"';
|
||||
}
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->frequency = $frequency;
|
||||
if (!empty($unit)) $this->unit_frequency = $unit;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the next date of execution
|
||||
*
|
||||
* @param datetime $date date of execution
|
||||
* @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setNextDate($date, $increment_nb_gen_done=0)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::setNextDate was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET date_when = "'.$this->db->idate($date).'"';
|
||||
if ($increment_nb_gen_done>0) $sql.= ', nb_gen_done = nb_gen_done + 1';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setNextDate", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->date_when = $date;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the maximum period
|
||||
*
|
||||
* @param int $nb number of maximum period
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setMaxPeriod($nb)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::setMaxPeriod was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (empty($nb)) $nb=0;
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET nb_gen_max = '.$nb;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setMaxPeriod", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->nb_gen_max = $nb;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the auto validate invoice
|
||||
*
|
||||
* @param int $validate 0 to create in draft, 1 to create and validate invoice
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setAutoValidate($validate)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::setAutoValidate was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET auto_validate = '.$validate;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setAutoValidate", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->auto_validate = $validate;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,6 +278,8 @@ class Facture extends CommonInvoice
|
||||
$result=$_facrec->fetch($this->fac_rec);
|
||||
|
||||
$this->fk_project = $_facrec->fk_project;
|
||||
$this->fk_account = $_facrec->fk_account;
|
||||
$this->note_private = $_facrec->note_private;
|
||||
$this->cond_reglement_id = $_facrec->cond_reglement_id;
|
||||
$this->mode_reglement_id = $_facrec->mode_reglement_id;
|
||||
$this->remise_absolue = $_facrec->remise_absolue;
|
||||
@ -917,6 +919,60 @@ class Facture extends CommonInvoice
|
||||
else return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new invoice in database from facturerec
|
||||
*
|
||||
* @param User $user Object user that ask creation
|
||||
* @param FactureRec $facturerec Object facturerec source
|
||||
* @return int <0 if KO, 0 if not validate, >0 if OK
|
||||
*/
|
||||
function createFromRec($user, $facturerec)
|
||||
{
|
||||
|
||||
// Clean parameters
|
||||
$this->type = self::TYPE_STANDARD;
|
||||
$this->brouillon = 1;
|
||||
|
||||
// Charge facture source
|
||||
$facture=new Facture($facturerec->db);
|
||||
|
||||
$facture->socid = $facturerec->socid;
|
||||
$facture->date = dol_mktime(12, 0, 0, date('m'), date('d'), date('Y'));
|
||||
$facture->note_public = $facturerec->note_public;
|
||||
$facture->note_private = $facturerec->note_private;
|
||||
$facture->fk_project = $facturerec->fk_project;
|
||||
$facture->fk_account = $facturerec->fk_account;
|
||||
$facture->cond_reglement_id = $facturerec->cond_reglement_id;
|
||||
$facture->mode_reglement_id = $facturerec->mode_reglement_id;
|
||||
|
||||
$new_date_lim_reglement = $facture->calculate_date_lim_reglement();
|
||||
$facture->date_lim_reglement = $new_date_lim_reglement;
|
||||
|
||||
$facture->remise_absolue = $facturerec->remise_absolue;
|
||||
$facture->remise_percent = $facturerec->remise_percent;
|
||||
|
||||
$facture->lines = $facturerec->lines; // Tableau des lignes de factures
|
||||
|
||||
// Loop on each line of new invoice
|
||||
foreach($facture->lines as $i => $line)
|
||||
{
|
||||
$facture->lines[$i]->fk_prev_id = $facturerec->lines[$i]->rowid;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::createFromRec socid=".$this->socid." nboflines=".count($facture->lines));
|
||||
|
||||
$facid = $facture->create($user);
|
||||
if ($facid <= 0) return -1;
|
||||
|
||||
if ($facturerec->auto_validate)
|
||||
{
|
||||
$result = $facture->validate($user);
|
||||
if ($result<=0) return 0;
|
||||
}
|
||||
|
||||
return $facid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
|
||||
@ -58,7 +58,14 @@ if ($sortfield == "")
|
||||
$sortfield="f.datef";
|
||||
|
||||
$object = new FactureRec($db);
|
||||
|
||||
if ($id > 0 && $action != 'create' && $action != 'add')
|
||||
{
|
||||
$ret = $object->fetch($id);
|
||||
if (!$ret)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -75,16 +82,50 @@ if ($action == 'add')
|
||||
$error++;
|
||||
}
|
||||
|
||||
$frequency=GETPOST('frequency', 'int');
|
||||
$reyear=GETPOST('reyear');
|
||||
$remonth=GETPOST('remonth');
|
||||
$reday=GETPOST('reday');
|
||||
$rehour=GETPOST('rehour');
|
||||
$remin=GETPOST('remin');
|
||||
$nb_gen_max=GETPOST('nb_gen_max', 'int');
|
||||
if (empty($nb_gen_max)) $nb_gen_max =0;
|
||||
|
||||
if (GETPOST('frequency'))
|
||||
{
|
||||
if (empty($reyear) || empty($remonth) || empty($reday))
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Date")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
if ($nb_gen_max == '')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("MaxPeriodNumber")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->titre = GETPOST('titre', 'alpha');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->usenewprice = GETPOST('usenewprice');
|
||||
|
||||
|
||||
$object->frequency = $frequency;
|
||||
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
||||
$object->nb_gen_max = $nb_gen_max;
|
||||
$object->auto_validate = GETPOST('auto_validate', 'int');
|
||||
|
||||
$date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
|
||||
$object->date_when = $date_next_execution;
|
||||
|
||||
if ($object->create($user, $id) > 0)
|
||||
{
|
||||
$id = $object->id;
|
||||
$action = '';
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -97,12 +138,59 @@ if ($action == 'add')
|
||||
// Delete
|
||||
if ($action == 'delete' && $user->rights->facture->supprimer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->delete();
|
||||
$id = 0 ;
|
||||
header("Location: " . $_SERVER['PHP_SELF'] );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Update field
|
||||
// Set condition
|
||||
if ($action == 'setconditions' && $user->rights->facture->creer)
|
||||
{
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
|
||||
}
|
||||
// Set mode
|
||||
elseif ($action == 'setmode' && $user->rights->facture->creer)
|
||||
{
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
}
|
||||
// Set project
|
||||
elseif ($action == 'classin' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
// Set bank account
|
||||
elseif ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||
{
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
// Set frequency and unit frequency
|
||||
elseif ($action == 'setfrequency' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
|
||||
}
|
||||
// Set next date of execution
|
||||
elseif ($action == 'setdate_when' && $user->rights->facture->creer)
|
||||
{
|
||||
$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
|
||||
if (!empty($date)) $object->setNextDate($date);
|
||||
}
|
||||
// Set max period
|
||||
elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setMaxPeriod(GETPOST('nb_gen_max', 'int'));
|
||||
}
|
||||
// Set auto validate
|
||||
elseif ($action == 'setauto_validate' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setAutoValidate(GETPOST('auto_validate', 'int'));
|
||||
}
|
||||
// Set note
|
||||
$permissionnote=$user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -133,7 +221,8 @@ if ($action == 'create')
|
||||
dol_fiche_head();
|
||||
|
||||
$rowspan=4;
|
||||
if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++;
|
||||
if (! empty($conf->projet->enabled)) $rowspan++;
|
||||
if ($object->fk_account > 0) $rowspan++;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -152,7 +241,7 @@ if ($action == 'create')
|
||||
|
||||
// Note
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
print '<textarea class="flat" name="note_private" wrap="soft" cols="60" rows="'.ROWS_4.'"></textarea>';
|
||||
print '<textarea class="flat centpercent" name="note_private" wrap="soft" rows="'.ROWS_4.'"></textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Author
|
||||
@ -169,21 +258,61 @@ if ($action == 'create')
|
||||
print "</td></tr>";
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $object->fk_project > 0)
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
if ($object->fk_project > 0)
|
||||
{
|
||||
$project = new Project($db);
|
||||
$project->fetch($object->fk_project);
|
||||
print $project->title;
|
||||
print $project->getNomUrl(1);
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Bank account
|
||||
if ($object->fk_account > 0)
|
||||
{
|
||||
print "<tr><td>".$langs->trans('BankAccount')."</td><td>";
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
// Autogeneration
|
||||
$title = $langs->trans("Recurrence");
|
||||
print load_fiche_titre($title, '', 'calendar');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Frequency
|
||||
print "<tr><td>".$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
|
||||
print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='5' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m'));
|
||||
print "</td></tr>";
|
||||
|
||||
// First date of execution for cron
|
||||
print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
|
||||
$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
|
||||
print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1);
|
||||
print "</td></tr>";
|
||||
|
||||
// Number max of generation
|
||||
print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
|
||||
print "<input type='text' name='nb_gen_max' value='' size='5' />";
|
||||
print "</td></tr>";
|
||||
|
||||
// Auto validate the invoice
|
||||
print "<tr><td>".$langs->trans("InvoiceAutoValidate")."</td><td>";
|
||||
print $form->selectyesno('auto_validate', 0, 1);
|
||||
print "</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
@ -191,7 +320,7 @@ if ($action == 'create')
|
||||
else if (empty($conf->product->enabled))
|
||||
$title = $langs->trans("Services");
|
||||
|
||||
print load_fiche_titre($title);
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
/*
|
||||
* Invoice lines
|
||||
@ -394,178 +523,346 @@ else
|
||||
/*
|
||||
* View mode
|
||||
*/
|
||||
if ($id > 0)
|
||||
if ($object->id > 0)
|
||||
{
|
||||
if ($object->fetch($id) > 0)
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author);
|
||||
|
||||
$head=array();
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$head[$h][2] = 'card';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("RepeatableInvoice"),0,'bill'); // Add a div
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/fiche-rec.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">' . $langs->trans('Ref') . '</td>';
|
||||
print '<td colspan="5">';
|
||||
$morehtmlref = '';
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, $object->id);
|
||||
if ($result > 0) {
|
||||
$morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
|
||||
}
|
||||
if ($result < 0) {
|
||||
dol_print_error('', $discount->error);
|
||||
}*/
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'customer').'</td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("Author").'</td><td colspan="3">'.$author->getFullName($langs)."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td colspan="3"><b>'.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountVAT").'</td><td colspan="3">'.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Payment term
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author);
|
||||
|
||||
$head=array();
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$head[$h][2] = 'card';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("PredefinedInvoices"),0,'bill'); // Add a div
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="4">'.$object->titre.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'customer').'</td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("Author").'</td><td colspan="3">'.$author->getFullName($langs)."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td colspan="3"><b>'.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountVAT").'</td><td colspan="3">'.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Payment term
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">';
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id,'none');
|
||||
print "</td></tr>";
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans("PaymentMode").'</td><td colspan="3">';
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id,'none');
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Comment").'</td><td colspan="3">'.nl2br($object->note_private)."</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
$title = $langs->trans("Products");
|
||||
else if (empty($conf->product->enabled))
|
||||
$title = $langs->trans("Services");
|
||||
|
||||
print load_fiche_titre($title);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Price").'</td>';
|
||||
print '<td align="center">'.$langs->trans("ReductionShort").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td align="left">'.$langs->trans("Unit").'</td>';
|
||||
if ($action == 'editconditions') {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
|
||||
}
|
||||
print '</tr>';
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
$num = count($object->lines);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
$product_static=new Product($db);
|
||||
|
||||
// Show product and description
|
||||
$type=(isset($object->lines[$i]->product_type)?$object->lines[$i]->product_type:$object->lines[$i]->fk_product_type);
|
||||
// Try to enhance type detection using date_start and date_end for free lines when type
|
||||
// was not saved.
|
||||
if (! empty($objp->date_start)) $type=1;
|
||||
if (! empty($objp->date_end)) $type=1;
|
||||
|
||||
// Show line
|
||||
print "<tr ".$bc[$var].">";
|
||||
if ($object->lines[$i]->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
print '<a name="'.$object->lines[$i]->id.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
// Show product and description
|
||||
$product_static->type=$object->lines[$i]->fk_product_type;
|
||||
$product_static->id=$object->lines[$i]->fk_product;
|
||||
$product_static->ref=$object->lines[$i]->product_ref;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.(! empty($object->lines[$i]->label)?$object->lines[$i]->label:$object->lines[$i]->product_label);
|
||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($object->lines[$i]->desc));
|
||||
print $form->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end);
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
print (! empty($object->lines[$i]->desc) && $object->lines[$i]->desc!=$fac->lines[$i]->product_label)?'<br>'.dol_htmlentitiesbr($object->lines[$i]->desc):'';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
if (! empty($object->lines[$i]->label)) {
|
||||
|
||||
$text.= ' <strong>'.$object->lines[$i]->label.'</strong>';
|
||||
print $form->textwithtooltip($text,dol_htmlentitiesbr($object->lines[$i]->desc),3,'','',$i);
|
||||
|
||||
} else {
|
||||
|
||||
print $text.' '.nl2br($object->lines[$i]->desc);
|
||||
}
|
||||
|
||||
// Show range
|
||||
print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end);
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">'.price($object->lines[$i]->price).'</td>';
|
||||
print '<td align="center">'.$object->lines[$i]->remise_percent.' %</td>';
|
||||
print '<td align="center">'.$object->lines[$i]->qty.'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print "<td align=\"left\">".$object->lines[$i]->getLabelOfUnit()."</td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->creer)
|
||||
{
|
||||
echo '<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>';
|
||||
}
|
||||
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
// Payment mode
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editmode')
|
||||
{
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer);
|
||||
print '</td><td colspan="5">';
|
||||
print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$langs->load('projects');
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Project');
|
||||
print '</td>';
|
||||
if ($action != 'classify') {
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=classify&facid=' . $object->id . '">';
|
||||
print img_edit($langs->trans('SetProject'), 1);
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'classify') {
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1);
|
||||
} else {
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Bank Account
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editbankaccount')
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
* Recurrence
|
||||
*/
|
||||
$title = $langs->trans("Recurrence");
|
||||
print load_fiche_titre($title, '', 'calendar');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// if "frequency" is empty or = 0, the reccurence is disabled
|
||||
print '<tr><td width="20%">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Frequency');
|
||||
print '</td>';
|
||||
if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
if ($action == 'editfrequency')
|
||||
{
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"] . '?facid=' . $object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setfrequency">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency?$object->unit_frequency:'m'));
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->frequency > 0)
|
||||
{
|
||||
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NotARecurringInvoiceTemplate");
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//if (! empty($object->frequency)) // If no frequency defined, it is not a recurring template invoice
|
||||
//{
|
||||
// Date when
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'dayhour');
|
||||
print '</td><td colspan="5">';
|
||||
print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'dayhour');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Max period / Rest period
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
|
||||
print '</td><td colspan="5">';
|
||||
print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr><td>'.$langs->trans("RestPeriodNumber").'</td>';
|
||||
print '<td>';
|
||||
print ($object->nb_gen_max-$object->nb_gen_done);
|
||||
print '</td>';
|
||||
|
||||
// Auto validate
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer);
|
||||
print '</td><td colspan="5">';
|
||||
$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
|
||||
print $form->editfieldval($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer, $select);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
|
||||
print '<table class="noborder noshadow" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("VAT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td align="center">'.$langs->trans("ReductionShort").'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td align="left">'.$langs->trans("Unit").'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$num = count($object->lines);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
$product_static=new Product($db);
|
||||
|
||||
// Show product and description
|
||||
$type=(isset($object->lines[$i]->product_type)?$object->lines[$i]->product_type:$object->lines[$i]->fk_product_type);
|
||||
// Try to enhance type detection using date_start and date_end for free lines when type
|
||||
// was not saved.
|
||||
if (! empty($objp->date_start)) $type=1;
|
||||
if (! empty($objp->date_end)) $type=1;
|
||||
|
||||
// Show line
|
||||
print "<tr ".$bc[$var].">";
|
||||
if ($object->lines[$i]->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
print '<a name="'.$object->lines[$i]->id.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
// Show product and description
|
||||
$product_static->type=$object->lines[$i]->fk_product_type;
|
||||
$product_static->id=$object->lines[$i]->fk_product;
|
||||
$product_static->ref=$object->lines[$i]->product_ref;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.(! empty($object->lines[$i]->label)?$object->lines[$i]->label:$object->lines[$i]->product_label);
|
||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($object->lines[$i]->desc));
|
||||
print $form->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end);
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
print (! empty($object->lines[$i]->desc) && $object->lines[$i]->desc!=$fac->lines[$i]->product_label)?'<br>'.dol_htmlentitiesbr($object->lines[$i]->desc):'';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
if (! empty($object->lines[$i]->label)) {
|
||||
|
||||
$text.= ' <strong>'.$object->lines[$i]->label.'</strong>';
|
||||
print $form->textwithtooltip($text,dol_htmlentitiesbr($object->lines[$i]->desc),3,'','',$i);
|
||||
|
||||
} else {
|
||||
|
||||
print $text.' '.nl2br($object->lines[$i]->desc);
|
||||
}
|
||||
|
||||
// Show range
|
||||
print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end);
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">'.vatrate($object->lines[$i]->tva_tx, 1).'</td>';
|
||||
print '<td align="right">'.price($object->lines[$i]->price).'</td>';
|
||||
print '<td align="center">'.$object->lines[$i]->qty.'</td>';
|
||||
print '<td align="center">'.$object->lines[$i]->remise_percent.' %</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print "<td align=\"left\">".$object->lines[$i]->getLabelOfUnit()."</td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/**
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->creer)
|
||||
{
|
||||
echo '<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>';
|
||||
}
|
||||
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -695,6 +695,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
$param='&socid='.$socid;
|
||||
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;
|
||||
@ -712,8 +713,7 @@ if ($resql)
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png');
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
|
||||
@ -38,12 +38,13 @@ $langs->load("bills");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'banque', '','');
|
||||
|
||||
$search_ref = GETPOST('search_ref','int');
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_account = GETPOST('search_account','int');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
@ -101,6 +102,7 @@ else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
@ -109,29 +111,36 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
//print "$sql";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$params='';
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', '', '', $limit);
|
||||
|
||||
print '<table class="liste">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$params,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$params,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
@ -151,6 +160,7 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_amount" value="'.$search_amount.'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
@ -192,7 +202,11 @@ if ($resql)
|
||||
// Statut
|
||||
print '<td align="right">';
|
||||
print $checkdepositstatic->LibStatut($objp->statut,5);
|
||||
print "</td></tr>\n";
|
||||
print '</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -200,7 +214,7 @@ if ($resql)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td colspan="6">'.$langs->trans("None")."</td>";
|
||||
print '<td colspan="7">'.$langs->trans("None")."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
@ -57,9 +57,9 @@ $search_amount=GETPOST("search_amount",'alpha'); // alpha because we must be
|
||||
$search_company=GETPOST("search_company",'alpha');
|
||||
$search_payment_num=GETPOST('search_payment_num','alpha');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
@ -184,6 +184,7 @@ else
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
@ -192,12 +193,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
//print "$sql";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
@ -211,9 +210,16 @@ if ($resql)
|
||||
$paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):"");
|
||||
if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss);
|
||||
|
||||
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png');
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$paramlist,"",$sortfield,$sortorder);
|
||||
|
||||
@ -113,8 +113,8 @@ llxHeader();
|
||||
$tva = new Tva($db);
|
||||
|
||||
|
||||
$textprevyear="<a href=\"index.php?year=" . ($year_current-1) . "\">".img_previous()."</a>";
|
||||
$textnextyear=" <a href=\"index.php?year=" . ($year_current+1) . "\">".img_next()."</a>";
|
||||
$textprevyear="<a href=\"index.php?year=" . ($year_current-1) . "\">".img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a>";
|
||||
$textnextyear=" <a href=\"index.php?year=" . ($year_current+1) . "\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>";
|
||||
|
||||
print load_fiche_titre($langs->trans("VAT"),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear");
|
||||
|
||||
|
||||
@ -67,16 +67,15 @@ $optioncss = GETPOST('optioncss','alpha');
|
||||
$type=GETPOST("type");
|
||||
$view=GETPOST("view");
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$userid=GETPOST('userid','int');
|
||||
$begin=GETPOST('begin');
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="p.lastname";
|
||||
if ($page < 0) { $page = 0; }
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
$langs->load("companies");
|
||||
@ -333,6 +332,16 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
// Add order
|
||||
if($view == "recent")
|
||||
{
|
||||
$sql.= $db->order("p.datec","DESC");
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
}
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
@ -341,16 +350,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
// Add order and limit
|
||||
// Add limit
|
||||
if($view == "recent")
|
||||
{
|
||||
$sql.= $db->order("p.datec","DESC");
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
@ -361,11 +368,14 @@ if ($result)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email);
|
||||
$param='';
|
||||
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);
|
||||
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
|
||||
if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname);
|
||||
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
||||
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
||||
if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip);
|
||||
if ($search_town != '') $param.='&search_town='.urlencode($search_town);
|
||||
if ($search_job != '') $param.='&search_job='.urlencode($search_job);
|
||||
@ -385,8 +395,6 @@ if ($result)
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_companies.png');
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -395,6 +403,8 @@ if ($result)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
@ -739,10 +749,10 @@ if ($result)
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit, 1);
|
||||
|
||||
print '</form>';
|
||||
|
||||
if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
|
||||
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
|
||||
@ -36,13 +36,6 @@ $langs->load("products");
|
||||
$langs->load("companies");
|
||||
$langs->load("compta");
|
||||
|
||||
$sortfield=GETPOST('sortfield','alpha');
|
||||
$sortorder=GETPOST('sortorder','alpha');
|
||||
$page=GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$search_name=GETPOST('search_name');
|
||||
$search_contract=GETPOST('search_contract');
|
||||
$search_ref_supplier=GETPOST('search_ref_supplier','alpha');
|
||||
@ -55,8 +48,16 @@ $search_product_category=GETPOST('search_product_category','int');
|
||||
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
if (! $sortfield) $sortfield="c.rowid";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='c.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
// Security check
|
||||
$id=GETPOST('id','int');
|
||||
@ -152,7 +153,15 @@ if ($result)
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -160,8 +169,14 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png');
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
$param.='&search_contract='.$search_contract;
|
||||
$param.='&search_name='.$search_name;
|
||||
$param.='&search_ref_supplier='.$search_ref_supplier;
|
||||
$param.='&search_sale=' .$search_sale;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -169,7 +184,9 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
if ($sall)
|
||||
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
@ -218,13 +235,7 @@ if ($resql)
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
$param='&search_contract='.$search_contract;
|
||||
$param.='&search_name='.$search_name;
|
||||
$param.='&search_ref_supplier='.$search_ref_supplier;
|
||||
$param.='&search_sale=' .$search_sale;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefSupplier"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
|
||||
@ -280,8 +291,14 @@ if ($resql)
|
||||
print '<td>';
|
||||
if($obj->socid)
|
||||
{
|
||||
$socstatic->fetch($obj->socid);
|
||||
$result=$socstatic->fetch($obj->socid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
|
||||
if ($listsalesrepresentatives < 0) dol_print_error($db);
|
||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
|
||||
168
htdocs/core/boxes/box_goodcustomers.php
Normal file
168
htdocs/core/boxes/box_goodcustomers.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_clients.php
|
||||
* \ingroup societes
|
||||
* \brief Module de generation de l'affichage de la box clients
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage the box to show last thirdparties
|
||||
*/
|
||||
class box_goodcustomers extends ModeleBoxes
|
||||
{
|
||||
var $boxcode="goodcustomers";
|
||||
var $boximg="object_company";
|
||||
var $boxlabel="BoxGoodCustomers";
|
||||
var $depends = array("societe");
|
||||
|
||||
var $db;
|
||||
var $enabled = 1;
|
||||
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
function __construct($db,$param='')
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// disable box for such cases
|
||||
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data for box to show them later
|
||||
*
|
||||
* @param int $max Maximum number of records to load
|
||||
* @return void
|
||||
*/
|
||||
function loadBox($max=5)
|
||||
{
|
||||
global $user, $langs, $db, $conf;
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$thirdpartystatic=new Societe($db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleGoodCustomers",$max));
|
||||
|
||||
if ($user->rights->societe->lire)
|
||||
{
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,";
|
||||
$sql.= " count(*) as nbfact, sum(". $db->if('f.paye=1','1','0').") as nbfactpaye";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('societe', 1).')';
|
||||
$sql.= ' AND s.rowid = f.fk_soc';
|
||||
$sql.= " GROUP BY s.rowid, s.nom, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms, s.status";
|
||||
$sql.= $db->order("nbfact","DESC");
|
||||
$sql.= $db->plimit($max,0);
|
||||
|
||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$line = 0;
|
||||
while ($line < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
$thirdpartystatic->id = $objp->rowid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->logo = $objp->logo;
|
||||
$nbfact = $objp->nbfact;
|
||||
$nbimpaye = $objp->nbfact - $objp->nbfactpaye;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $thirdpartystatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day")
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => $nbfact.( $nbimpaye != 0 ? ' ('.$nbimpaye.')':'')
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $thirdpartystatic->LibStatut($objp->status,3)
|
||||
);
|
||||
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @return void
|
||||
*/
|
||||
function showBox($head = null, $contents = null)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,10 +37,11 @@
|
||||
class CMailFile
|
||||
{
|
||||
var $subject; // Topic: Subject of email
|
||||
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>')
|
||||
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
|
||||
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
|
||||
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
|
||||
// Return-Path: Email where to send bounds.
|
||||
var $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined)
|
||||
var $errors_to; // Errors-To: Email where to send errors.
|
||||
var $addr_to;
|
||||
var $addr_cc;
|
||||
@ -190,6 +191,7 @@ class CMailFile
|
||||
// Define smtp_headers
|
||||
$this->subject = $subject;
|
||||
$this->addr_from = $from;
|
||||
$this->reply_to = $from; // Set this property after constructor if you want to use another value
|
||||
$this->errors_to = $errors_to;
|
||||
$this->addr_to = $to;
|
||||
$this->addr_cc = $addr_cc;
|
||||
@ -256,7 +258,8 @@ class CMailFile
|
||||
$smtps->setTO($this->getValidAddress($to,0,1));
|
||||
$smtps->setFrom($this->getValidAddress($from,0,1));
|
||||
$smtps->setTrackId($trackid);
|
||||
|
||||
$smtps->setReplyTo($this->getValidAddress($from,0,1)); // Set property with this->smtps->setReplyTo after constructor if you want to use another value than the From
|
||||
|
||||
if (! empty($this->html))
|
||||
{
|
||||
if (!empty($css))
|
||||
@ -308,6 +311,7 @@ class CMailFile
|
||||
$this->phpmailer->Subject($this->encodetorfc2822($subject));
|
||||
$this->phpmailer->setTO($this->getValidAddress($to,0,1));
|
||||
$this->phpmailer->SetFrom($this->getValidAddress($from,0,1));
|
||||
$this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From
|
||||
// TODO Add trackid into smtp header
|
||||
|
||||
if (! empty($this->html))
|
||||
@ -341,12 +345,10 @@ class CMailFile
|
||||
}
|
||||
}
|
||||
|
||||
$smtps->setCC($addr_cc);
|
||||
$smtps->setBCC($addr_bcc);
|
||||
$smtps->setErrorsTo($errors_to);
|
||||
$smtps->setDeliveryReceipt($deliveryreceipt);
|
||||
|
||||
$this->smtps=$smtps;
|
||||
$this->phpmailer->setCC($addr_cc);
|
||||
$this->phpmailer->setBCC($addr_bcc);
|
||||
$this->phpmailer->setErrorsTo($errors_to);
|
||||
$this->phpmailer->setDeliveryReceipt($deliveryreceipt);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -375,7 +377,7 @@ class CMailFile
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
|
||||
{
|
||||
dol_include_once('/core/class/hookmanager.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks(array(
|
||||
'maildao'
|
||||
|
||||
@ -384,7 +384,7 @@ abstract class CommonObject
|
||||
*/
|
||||
function errorsToString()
|
||||
{
|
||||
return $this->error.(is_array($this->errors)?(($this->error!=''?' ':'').join(',',$this->errors)):'');
|
||||
return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ',$this->errors)):'');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1001,26 +1001,30 @@ abstract class CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) return 0;
|
||||
if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id))
|
||||
return 0;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
|
||||
$idtofetch=isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty);
|
||||
if ($force_thirdparty_id) $idtofetch=$force_thirdparty_id;
|
||||
$idtofetch = isset($this->socid) ? $this->socid : (isset($this->fk_soc) ? $this->fk_soc : $this->fk_thirdparty);
|
||||
if ($force_thirdparty_id)
|
||||
$idtofetch = $force_thirdparty_id;
|
||||
|
||||
$thirdparty = new Societe($this->db);
|
||||
$result=$thirdparty->fetch($idtofetch);
|
||||
$this->client = $thirdparty; // deprecated
|
||||
$this->thirdparty = $thirdparty;
|
||||
if ($idtofetch) {
|
||||
$thirdparty = new Societe($this->db);
|
||||
$result = $thirdparty->fetch($idtofetch);
|
||||
$this->client = $thirdparty; // deprecated
|
||||
$this->thirdparty = $thirdparty;
|
||||
|
||||
// Use first price level if level not defined for third party
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level))
|
||||
{
|
||||
$this->client->price_level=1; // deprecated
|
||||
$this->thirdparty->price_level=1;
|
||||
}
|
||||
// Use first price level if level not defined for third party
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level)) {
|
||||
$this->client->price_level = 1; // deprecated
|
||||
$this->thirdparty->price_level = 1;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -2322,7 +2326,7 @@ abstract class CommonObject
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error[]=$this->db->lasterror();
|
||||
$this->errors[]=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3347,6 +3351,8 @@ abstract class CommonObject
|
||||
$text.= ' - '.(! empty($line->label)?$line->label:$label);
|
||||
$description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
|
||||
}
|
||||
|
||||
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
|
||||
|
||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
@ -3370,7 +3376,7 @@ abstract class CommonObject
|
||||
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("Label").'"';
|
||||
else $placeholder=' title="'.$langs->trans("Label").'"';
|
||||
|
||||
$pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
|
||||
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
|
||||
|
||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
|
||||
@ -66,8 +66,6 @@ abstract class CommonObjectLine extends CommonObject
|
||||
|
||||
$langs->load('products');
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$label_type = 'label';
|
||||
|
||||
if ($type == 'short')
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2016 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
|
||||
@ -878,7 +879,7 @@ class ExtraFields
|
||||
}
|
||||
else
|
||||
{
|
||||
$labeltoshow=$obj->$InfoFieldList[1];
|
||||
$labeltoshow=$obj->{$InfoFieldList[1]};
|
||||
}
|
||||
$labeltoshow=dol_trunc($labeltoshow,45);
|
||||
|
||||
@ -899,12 +900,12 @@ class ExtraFields
|
||||
{
|
||||
if(!$notrans)
|
||||
{
|
||||
$translabel=$langs->trans($obj->$InfoFieldList[1]);
|
||||
if ($translabel!=$obj->$InfoFieldList[1]) {
|
||||
$translabel=$langs->trans($obj->{$InfoFieldList[1]});
|
||||
if ($translabel!=$obj->{$InfoFieldList[1]}) {
|
||||
$labeltoshow=dol_trunc($translabel,18);
|
||||
}
|
||||
else {
|
||||
$labeltoshow=dol_trunc($obj->$InfoFieldList[1],18);
|
||||
$labeltoshow=dol_trunc($obj->{$InfoFieldList[1]},18);
|
||||
}
|
||||
}
|
||||
if (empty($labeltoshow)) $labeltoshow='(not defined)';
|
||||
@ -1055,7 +1056,7 @@ class ExtraFields
|
||||
$labeltoshow .= $obj->$field_toshow . ' ';
|
||||
}
|
||||
} else {
|
||||
$labeltoshow = $obj->$InfoFieldList[1];
|
||||
$labeltoshow = $obj->{$InfoFieldList[1]};
|
||||
}
|
||||
$labeltoshow = dol_trunc($labeltoshow, 45);
|
||||
|
||||
@ -1076,11 +1077,11 @@ class ExtraFields
|
||||
$out .= '/>' . $labeltoshow . '<br>';
|
||||
} else {
|
||||
if (! $notrans) {
|
||||
$translabel = $langs->trans($obj->$InfoFieldList[1]);
|
||||
if ($translabel != $obj->$InfoFieldList[1]) {
|
||||
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
|
||||
if ($translabel != $obj->{$InfoFieldList[1]}) {
|
||||
$labeltoshow = dol_trunc($translabel, 18);
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->$InfoFieldList[1], 18);
|
||||
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
|
||||
}
|
||||
}
|
||||
if (empty($labeltoshow))
|
||||
@ -1274,13 +1275,13 @@ class ExtraFields
|
||||
else
|
||||
{
|
||||
$translabel='';
|
||||
if (!empty($obj->$InfoFieldList[1])) {
|
||||
$translabel=$langs->trans($obj->$InfoFieldList[1]);
|
||||
if (!empty($obj->{$InfoFieldList[1]})) {
|
||||
$translabel=$langs->trans($obj->{$InfoFieldList[1]});
|
||||
}
|
||||
if ($translabel!=$obj->$InfoFieldList[1]) {
|
||||
if ($translabel!=$obj->{$InfoFieldList[1]}) {
|
||||
$value=dol_trunc($translabel,18);
|
||||
}else {
|
||||
$value=$obj->$InfoFieldList[1];
|
||||
$value=$obj->{$InfoFieldList[1]};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1354,13 +1355,13 @@ class ExtraFields
|
||||
}
|
||||
} else {
|
||||
$translabel = '';
|
||||
if (! empty($obj->$InfoFieldList[1])) {
|
||||
$translabel = $langs->trans($obj->$InfoFieldList[1]);
|
||||
if (! empty($obj->{$InfoFieldList[1]})) {
|
||||
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
|
||||
}
|
||||
if ($translabel != $obj->$InfoFieldList[1]) {
|
||||
if ($translabel != $obj->{$InfoFieldList[1]}) {
|
||||
$value .= dol_trunc($translabel, 18) . '<BR>';
|
||||
} else {
|
||||
$value .= $obj->$InfoFieldList[1] . '<BR>';
|
||||
$value .= $obj->{$InfoFieldList[1]} . '<BR>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ class Form
|
||||
* @param string $value Value to show/edit
|
||||
* @param object $object Object
|
||||
* @param boolean $perm Permission to allow button to edit parameter
|
||||
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...)
|
||||
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...)
|
||||
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value). Use '' to use same than $value
|
||||
* @param object $extObject External object
|
||||
* @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
|
||||
@ -503,7 +503,8 @@ class Form
|
||||
$ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').'>'.$label.'</option>';
|
||||
}
|
||||
$ret.='</select>';
|
||||
$ret.='<input type="submit" name="confirmmassaction" disabled="disabled" class="button hideobject massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
|
||||
// Warning: if you set submit button to disabled, post using Enter will no more work
|
||||
$ret.='<input type="submit" name="confirmmassaction" class="button hideobject massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
|
||||
$ret.='</div>';
|
||||
|
||||
$ret.='<!-- JS CODE TO ENABLE mass action select -->
|
||||
@ -515,7 +516,6 @@ class Form
|
||||
/* console.log( index + ": " + $( this ).text() ); */
|
||||
if ($(this).is(\':checked\')) atleastoneselected++;
|
||||
});
|
||||
console.log(atleastoneselected);
|
||||
if (atleastoneselected)
|
||||
{
|
||||
jQuery(".massaction").show();
|
||||
@ -531,6 +531,7 @@ class Form
|
||||
jQuery(".checkforselect").click(function() {
|
||||
initCheckForSelect();
|
||||
});
|
||||
/* Warning: if you set submit button to disabled, post using Enter will no more work
|
||||
jQuery(".massactionselect").change(function() {
|
||||
console.log( $( this ).val() );
|
||||
if ($(this).val() != \'0\')
|
||||
@ -542,6 +543,7 @@ class Form
|
||||
jQuery(".massactionconfirmed").prop(\'disabled\', true);
|
||||
}
|
||||
});
|
||||
*/
|
||||
});
|
||||
</script>
|
||||
';
|
||||
@ -893,7 +895,7 @@ class Form
|
||||
* @param string $selected Preselected type
|
||||
* @param string $htmlname Name of field in form
|
||||
* @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)')
|
||||
* @param int $showempty Add an empty field
|
||||
* @param string $showempty Add an empty field (Can be '1' or text to use on empty line)
|
||||
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
@ -902,7 +904,7 @@ class Form
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @return string HTML string with select box for thirdparty.
|
||||
*/
|
||||
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='')
|
||||
function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='')
|
||||
{
|
||||
$out='';
|
||||
|
||||
@ -948,7 +950,7 @@ class Form
|
||||
* @param string $selected Preselected type
|
||||
* @param string $htmlname Name of field in form
|
||||
* @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)')
|
||||
* @param int $showempty Add an empty field
|
||||
* @param string $showempty Add an empty field (Can be '1' or text to use on empty line)
|
||||
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
@ -959,7 +961,7 @@ class Form
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @return string HTML string with
|
||||
*/
|
||||
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='')
|
||||
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='')
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@ -1016,10 +1018,13 @@ class Form
|
||||
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparam?' '.$moreparam:'').' name="'.$htmlname.'"'.$nodatarole.'>'."\n";
|
||||
|
||||
$textifempty='';
|
||||
// Do not use textempty = ' ' or ' ' here, or search on key will search on ' key'.
|
||||
//$textifempty=' ';
|
||||
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.
|
||||
//if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
|
||||
if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) $textifempty.=$langs->trans("All");
|
||||
if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT))
|
||||
{
|
||||
if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty);
|
||||
else $textifempty.=$langs->trans("All");
|
||||
}
|
||||
if ($showempty) $out.= '<option value="-1">'.$textifempty.'</option>'."\n";
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -3772,14 +3777,14 @@ class Form
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print '<input type="text" name="'.$htmlname.'" value="'.(!empty($rate) ? $rate : 1).'" size="10" />';
|
||||
print '<input type="text" name="'.$htmlname.'" value="'.(!empty($rate) ? price($rate) : 1).'" size="10" />';
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print !empty($rate) ? $rate : 1;
|
||||
print !empty($rate) ? price(price2num($rate), 1, $langs) : 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4995,7 +5000,10 @@ class Form
|
||||
else {
|
||||
$(\'.'.$htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
|
||||
}
|
||||
});
|
||||
// Now, we submit page
|
||||
$(this).parents(\'form:first\').submit();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
';
|
||||
|
||||
@ -564,16 +564,21 @@ class FormCompany
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh contacts list on thirdparty list change
|
||||
$htmloption='';
|
||||
|
||||
$events=array();
|
||||
// Add an entry 'method' to say 'yes, we must execute url with param action = method';
|
||||
// Add an entry 'url' to say which url to execute
|
||||
// Add an entry htmlname to say which element we must change once url is called
|
||||
// Add entry params => array('cssid' => 'attr') to say to remov or add attribute attr if answer of url return 0 or >0 lines
|
||||
// To refresh contacts list on thirdparty list change
|
||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
|
||||
if (count($events)) // If there is some ajax events to run once selection is done, we add code here to run events
|
||||
{
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
$("#search_'.$htmlname.'").change(function() {
|
||||
console.log("Call runJsCodeForEvent'.$htmlname.'");
|
||||
var obj = '.json_encode($events).';
|
||||
$.each(obj, function(key,values) {
|
||||
if (values.method.length) {
|
||||
@ -583,7 +588,7 @@ class FormCompany
|
||||
/* Clean contact */
|
||||
$("div#s2id_contactid>a>span").html(\'\');
|
||||
});
|
||||
|
||||
|
||||
// Function used to execute events when search_htmlname change
|
||||
function runJsCodeForEvent'.$htmlname.'(obj) {
|
||||
var id = $("#'.$htmlname.'").val();
|
||||
@ -609,6 +614,7 @@ class FormCompany
|
||||
}
|
||||
}
|
||||
});
|
||||
/* console.log("Change select#"+htmlname+" with content "+response.value) */
|
||||
$("select#" + htmlname).html(response.value);
|
||||
}
|
||||
}
|
||||
@ -619,8 +625,8 @@ class FormCompany
|
||||
}
|
||||
|
||||
print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n";
|
||||
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$name.'" '.$htmloption.' />';
|
||||
print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength);
|
||||
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$name.'" />';
|
||||
print ajax_autocompleter(($socid?$socid:-1), $htmlname, DOL_URL_ROOT.'/societe/ajaxcompanies.php', '', $minLength, 0);
|
||||
return $socid;
|
||||
}
|
||||
else
|
||||
|
||||
@ -817,7 +817,36 @@ class SMTPs
|
||||
return $_retValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reply-To Address from which mail will be the reply-to
|
||||
*
|
||||
* @param string $_strReplyTo Address from which mail will be the reply-to
|
||||
* @return void
|
||||
*/
|
||||
function setReplyTo($_strReplyTo)
|
||||
{
|
||||
if ( $_strReplyTo )
|
||||
$this->_msgReplyTo = $this->_strip_email($_strReplyTo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the Address from which mail will be the reply-to
|
||||
*
|
||||
* @param boolean $_part To "strip" 'Real name' from address
|
||||
* @return string Address from which mail will be the reply-to
|
||||
*/
|
||||
function getReplyTo($_part = true)
|
||||
{
|
||||
$_retValue = '';
|
||||
|
||||
if ( $_part === true )
|
||||
$_retValue = $this->_msgReplyTo;
|
||||
else
|
||||
$_retValue = $this->_msgReplyTo[$_part];
|
||||
|
||||
return $_retValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts given addresses into structured format.
|
||||
* This method takes a list of given addresses, via an array
|
||||
@ -1159,7 +1188,8 @@ class SMTPs
|
||||
$_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n";
|
||||
if ( $this->getErrorsTo() )
|
||||
$_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n";
|
||||
|
||||
if ( $this->getReplyTo() )
|
||||
$_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n";
|
||||
|
||||
$_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n"
|
||||
. 'Mime-Version: 1.0' . "\r\n";
|
||||
|
||||
@ -589,9 +589,11 @@ function listOfSessions()
|
||||
if(! @is_dir($fullpath) && is_readable($fullpath))
|
||||
{
|
||||
$sessValues = file_get_contents($fullpath); // get raw session data
|
||||
|
||||
// Example of possible value
|
||||
//$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f";dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920";dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";';
|
||||
|
||||
if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session
|
||||
preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i',$sessValues) && // limit to current entity
|
||||
(preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity
|
||||
preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name
|
||||
{
|
||||
$tmp=explode('_', $file);
|
||||
|
||||
@ -35,29 +35,40 @@
|
||||
* @param string $urloption More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done)
|
||||
* @param array $ajaxoptions Multiple options array
|
||||
* Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
|
||||
* Ex: array('disabled'=>
|
||||
* Ex: array('show'=>
|
||||
* Ex: array('update_textarea'=>
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
||||
{
|
||||
if (empty($minLength)) $minLength=1;
|
||||
|
||||
// Input search_htmlname is original field
|
||||
// Input htmlname is a second input field used when using ajax autocomplete.
|
||||
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
||||
|
||||
$script.= '<script type="text/javascript">';
|
||||
$script.= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
|
||||
$script.= '<script type="text/javascript">'."\n";
|
||||
$script.= '$(document).ready(function() {
|
||||
var autoselect = '.$autoselect.';
|
||||
var options = '.json_encode($ajaxoptions).';
|
||||
|
||||
// Remove product id before select another product
|
||||
// use keyup instead change to avoid loosing the product id
|
||||
/* Remove product id before select another product use keyup instead of change to avoid loosing the product id. This is needed only for select of predefined product */
|
||||
/* TODO Check if we can remove this */
|
||||
$("input#search_'.$htmlname.'").keydown(function() {
|
||||
$("#'.$htmlname.'").val("");
|
||||
});
|
||||
$("input#search_'.$htmlname.'").change(function() {
|
||||
|
||||
/* I disable this. A call to trigger is already done later into the select action of the autocomplete code
|
||||
$("input#search_'.$htmlname.'").change(function() {
|
||||
console.log("Call the change trigger on input '.$htmlname.' because of a change on search_'.$htmlname.' was triggered");
|
||||
$("#'.$htmlname.'").trigger("change");
|
||||
});
|
||||
// Check when keyup
|
||||
});*/
|
||||
|
||||
// Check options for secondary actions when keyup
|
||||
$("input#search_'.$htmlname.'").keyup(function() {
|
||||
if ($(this).val().length == 0)
|
||||
{
|
||||
@ -123,8 +134,9 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
},
|
||||
dataType: "json",
|
||||
minLength: '.$minLength.',
|
||||
select: function( event, ui ) { // Function ran when new value is selected into javascript combo
|
||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
|
||||
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
|
||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||
// Disable an element
|
||||
if (options.option_disabled) {
|
||||
if (ui.item.disabled) {
|
||||
@ -167,6 +179,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log("ajax_autocompleter new value selected, we trigger change on original component");
|
||||
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
|
||||
}
|
||||
,delay: 500
|
||||
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 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
|
||||
@ -2273,18 +2274,18 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
// Define $accessallowed
|
||||
if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg))
|
||||
{
|
||||
if ($fuser->rights->$reg[1]->lire || $fuser->rights->$reg[1]->read || ($fuser->rights->$reg[1]->download)) $accessallowed=1;
|
||||
$original_file=$conf->$reg[1]->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
$original_file=$conf->{$reg[1]}->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
}
|
||||
else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg))
|
||||
{
|
||||
if ($fuser->rights->$reg[1]->lire || $fuser->rights->$reg[1]->read || ($fuser->rights->$reg[1]->download)) $accessallowed=1;
|
||||
$original_file=$conf->$reg[1]->dir_temp.'/'.$original_file;
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
$original_file=$conf->{$reg[1]}->dir_temp.'/'.$original_file;
|
||||
}
|
||||
else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg))
|
||||
{
|
||||
if ($fuser->rights->$reg[1]->lire || $fuser->rights->$reg[1]->read || ($fuser->rights->$reg[1]->download)) $accessallowed=1;
|
||||
$original_file=$conf->$reg[1]->dir_output.'/'.$fuser->id.'/'.$original_file;
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
$original_file=$conf->{$reg[1]}->dir_output.'/'.$fuser->id.'/'.$original_file;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -183,6 +183,11 @@ function supplierorder_admin_prepare_head()
|
||||
$head[$h][1] = $langs->trans("SuppliersInvoice");
|
||||
$head[$h][2] = 'invoice';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/supplier_payment.php";
|
||||
$head[$h][1] = $langs->trans("SuppliersPayment");
|
||||
$head[$h][2] = 'supplierpayment';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'supplierorder_admin');
|
||||
|
||||
|
||||
@ -2037,11 +2037,12 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($stringencoding)) $stringencoding='UTF-8';
|
||||
|
||||
if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
|
||||
|
||||
if (empty($stringencoding)) $stringencoding='UTF-8';
|
||||
// reduce for small screen
|
||||
if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3);
|
||||
if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3);
|
||||
|
||||
// We go always here
|
||||
if ($trunc == 'right')
|
||||
{
|
||||
@ -2170,6 +2171,27 @@ function img_object($titlealt, $picto, $options = '', $pictoisfullpath = false)
|
||||
return img_picto($titlealt, 'object_'.$picto, $options, $pictoisfullpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show weather picto
|
||||
*
|
||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||
* @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory.
|
||||
* @param string $options Add more attribute on img tag
|
||||
* @param int $pictoisfullpath If 1, image path is a full path
|
||||
* @return string Return img tag
|
||||
* @see #img_object, #img_picto
|
||||
*/
|
||||
function img_weather($titlealt, $picto, $options = '', $pictoisfullpath = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! preg_match('/(\.png|\.gif)$/i', $picto)) $picto .= '.png';
|
||||
|
||||
$path = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/weather/'.$picto;
|
||||
|
||||
return img_picto($titlealt, $path, $options, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show picto (generic function)
|
||||
*
|
||||
@ -2410,30 +2432,32 @@ function img_error($titlealt = 'default')
|
||||
* Show next logo
|
||||
*
|
||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||
* @return string Return img tag
|
||||
* @param string $options Add more attribute on img tag (For example 'style="float: right"')
|
||||
* @return string Return img tag
|
||||
*/
|
||||
function img_next($titlealt = 'default')
|
||||
function img_next($titlealt = 'default', $options='')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if ($titlealt == 'default') $titlealt = $langs->trans('Next');
|
||||
|
||||
return img_picto($titlealt, 'next.png');
|
||||
return img_picto($titlealt, 'next.png', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show previous logo
|
||||
*
|
||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||
* @param string $options Add more attribute on img tag (For example 'style="float: right"')
|
||||
* @return string Return img tag
|
||||
*/
|
||||
function img_previous($titlealt = 'default')
|
||||
function img_previous($titlealt = 'default', $options='')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if ($titlealt == 'default') $titlealt = $langs->trans('Previous');
|
||||
|
||||
return img_picto($titlealt, 'previous.png');
|
||||
return img_picto($titlealt, 'previous.png', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2955,31 +2979,35 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
|
||||
/**
|
||||
* Print a title with navigation controls for pagination
|
||||
*
|
||||
* @param string $titre Title to show (required)
|
||||
* @param string $page Numero of page to show in navigation links (required)
|
||||
* @param string $file Url of page (required)
|
||||
* @param string $options parametres complementaires lien ('' par defaut)
|
||||
* @param string $sortfield champ de tri ('' par defaut)
|
||||
* @param string $sortorder ordre de tri ('' par defaut)
|
||||
* @param string $center chaine du centre ('' par defaut)
|
||||
* @param int $num number of records found by select with limit+1
|
||||
* @param int $totalnboflines Total number of records/lines for all pages (if known)
|
||||
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
|
||||
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
|
||||
* @param string $morehtml More html to show
|
||||
* @param string $morecss More css to the table
|
||||
* @param int $limit Limit ofnumber of lines on each page
|
||||
* @param string $titre Title to show (required)
|
||||
* @param string $page Numero of page to show in navigation links (required)
|
||||
* @param string $file Url of page (required)
|
||||
* @param string $options parametres complementaires lien ('' par defaut)
|
||||
* @param string $sortfield champ de tri ('' par defaut)
|
||||
* @param string $sortorder ordre de tri ('' par defaut)
|
||||
* @param string $center chaine du centre ('' par defaut). We often find here string $massaction comming from $form->selectMassAction()
|
||||
* @param int $num number of records found by select with limit+1
|
||||
* @param int $totalnboflines Total number of records/lines for all pages (if known). Use a negative value to no show number.
|
||||
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
|
||||
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
|
||||
* @param string $morehtml More html to show
|
||||
* @param string $morecss More css to the table
|
||||
* @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit).
|
||||
* @param int $hideselectlimit Force to hide select limit
|
||||
* @return void
|
||||
*/
|
||||
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=0)
|
||||
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
$savlimit = $limit;
|
||||
$savtotalnboflines = $totalnboflines;
|
||||
$totalnboflines=abs($totalnboflines);
|
||||
|
||||
if ($picto == 'setup') $picto='title_setup.png';
|
||||
if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif';
|
||||
if ($limit < 1) $limit = $conf->liste_limit;
|
||||
|
||||
if (($num > $limit) || ($num == -1))
|
||||
if ($limit < 0) $limit = $conf->liste_limit;
|
||||
if ($savlimit != 0 && (($num > $limit) || ($num == -1) || ($limit == 0)))
|
||||
{
|
||||
$nextpage = 1;
|
||||
}
|
||||
@ -2987,7 +3015,8 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
{
|
||||
$nextpage = 0;
|
||||
}
|
||||
|
||||
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
|
||||
|
||||
print "\n";
|
||||
print "<!-- Begin title '".$titre."' -->\n";
|
||||
print '<table width="100%" border="0" class="notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>';
|
||||
@ -2995,9 +3024,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
// Left
|
||||
if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, '', $pictoisfullpath).'</td>';
|
||||
print '<td class="nobordernopadding"><div class="titre">'.$titre;
|
||||
if (!empty($totalnboflines) && !empty($titre)) {
|
||||
print ' ('.$totalnboflines.')';
|
||||
}
|
||||
if (!empty($titre) && $savtotalnboflines > 0) print ' ('.$totalnboflines.')';
|
||||
print '</div></td>';
|
||||
|
||||
// Center
|
||||
@ -3012,13 +3039,14 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
if ($sortorder) $options .= "&sortorder=".$sortorder;
|
||||
// Show navigation bar
|
||||
$pagelist = '';
|
||||
if ($page > 0 || $num > $limit)
|
||||
if ($savlimit != 0 && ($page > 0 || $num > $limit))
|
||||
{
|
||||
if ($totalnboflines) // If we know total nb of lines
|
||||
{
|
||||
$maxnbofpage=(empty($conf->dol_optimize_smallscreen) ? 6 : 3); // nb before and after selected page + ... + first or last
|
||||
$maxnbofpage=(empty($conf->dol_optimize_smallscreen) ? 4 : 2); // page nb before and after selected page + ... + first or last
|
||||
|
||||
$nbpages=ceil($totalnboflines/$limit);
|
||||
if ($limit > 0) $nbpages=ceil($totalnboflines/$limit);
|
||||
else $nbpages=1;
|
||||
$cpt=($page-$maxnbofpage);
|
||||
if ($cpt < 0) { $cpt=0; }
|
||||
|
||||
@ -3055,7 +3083,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
$pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1)."</li>";
|
||||
}
|
||||
}
|
||||
print_fleche_navigation($page,$file,$options,$nextpage,$pagelist,$morehtml); // output the div and ul for previous/last completed with page numbers into $pagelist
|
||||
print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
|
||||
print '</td>';
|
||||
|
||||
print '</tr></table>'."\n";
|
||||
@ -3071,13 +3099,64 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
* @param integer $nextpage Do we show a next page button
|
||||
* @param string $betweenarrows HTML content to show between arrows. MUST contains '<li> </li>' tags or '<li><span> </span></li>'.
|
||||
* @param string $afterarrows HTML content to show after arrows. Must NOT contains '<li> </li>' tags.
|
||||
* @param int $limit Max nb of record to show (-1 = no combo with limit, 0 = no limit, > 0 = limit)
|
||||
* @param int $totalnboflines Total number of records/lines for all pages (if known)
|
||||
* @param int $hideselectlimit Force to hide select limit
|
||||
* @return void
|
||||
*/
|
||||
function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='')
|
||||
function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0, $hideselectlimit=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
print '<div class="pagination"><ul>';
|
||||
if ((int) $limit >= 0 && empty($hideselectlimit))
|
||||
{
|
||||
$pagesizechoices='10:10,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000';
|
||||
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
|
||||
//$pagesizechoices.=',2:2';
|
||||
if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES;
|
||||
|
||||
print '<li class="pagination">';
|
||||
print '<select class="flat selectlimit" name="limit">';
|
||||
$tmpchoice=explode(',',$pagesizechoices);
|
||||
$tmpkey=$limit.':'.$limit;
|
||||
if (! in_array($tmpkey, $tmpchoice)) $tmpchoice[]=$tmpkey;
|
||||
$tmpkey=$conf->liste_limit.':'.$conf->liste_limit;
|
||||
if (! in_array($tmpkey, $tmpchoice)) $tmpchoice[]=$tmpkey;
|
||||
asort($tmpchoice, SORT_NUMERIC);
|
||||
$found=false;
|
||||
foreach($tmpchoice as $val)
|
||||
{
|
||||
$selected='';
|
||||
$tmp=explode(':',$val);
|
||||
$key=$tmp[0];
|
||||
$val=$tmp[1];
|
||||
if ($key != '' && $val != '')
|
||||
{
|
||||
if ((int) $key == (int) $limit)
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
$found = true;
|
||||
}
|
||||
print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<!-- JS CODE TO ENABLE select limit to launch submit of page -->
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".selectlimit").change(function() {
|
||||
console.log("Change limit. Send submit");
|
||||
$(this).parents(\'form:first\').submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
print '</li>';
|
||||
}
|
||||
if ($page > 0)
|
||||
{
|
||||
if (empty($conf->dol_use_jmobile)) print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page-1).$options.'"><</a></li>';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015-2016 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
|
||||
@ -1910,7 +1910,7 @@ function fetchObjectByElement($element_id, $element_type)
|
||||
global $db,$conf;
|
||||
|
||||
$element_prop = getElementProperties($element_type);
|
||||
if (is_array($element_prop) && $conf->$element_prop['module']->enabled)
|
||||
if (is_array($element_prop) && $conf->{$element_prop['module']}->enabled)
|
||||
{
|
||||
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
|
||||
|
||||
|
||||
@ -54,7 +54,8 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
|
||||
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false));
|
||||
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false)); // We use @ here because this may return warning if safe mode is on or open_basedir is on
|
||||
|
||||
if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
|
||||
curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it
|
||||
|
||||
|
||||
@ -986,6 +986,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
|
||||
// General Ledger
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=accountancy_bookkeeping",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping');
|
||||
if (preg_match('/accountancy_bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balance.php?leftmenu=accountancy_bookkeeping",$langs->trans("AccountBalance"),2,$user->rights->accounting->mouvements->lire);
|
||||
if (preg_match('/accountancy_bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php?leftmenu=accountancy_bookkeeping",$langs->trans("ByYear"),2,$user->rights->accounting->mouvements->lire);
|
||||
if (preg_match('/accountancy_bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php?leftmenu=accountancy_bookkeeping",$langs->trans("AccountBalanceByMonth"),2,$user->rights->accounting->mouvements->lire);
|
||||
|
||||
|
||||
@ -1258,7 +1258,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetFillColor(255,255,255);
|
||||
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -123,7 +123,7 @@ class mailing_fraise extends MailingTargets
|
||||
$s.='<option value="0">'.$langs->trans("MemberStatusResiliatedShort").'</option>';
|
||||
$s.='</select> ';
|
||||
$s.=$langs->trans("Type").': ';
|
||||
$s.='<select name="filter" class="flat">';
|
||||
$s.='<select name="filtertype" class="flat">';
|
||||
$sql = "SELECT rowid, libelle, statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
@ -212,7 +212,7 @@ class mailing_fraise extends MailingTargets
|
||||
if ($dateendsubscriptionafter > 0) $sql.=" AND datefin > '".$this->db->idate($dateendsubscriptionafter)."'";
|
||||
if ($dateendsubscriptionbefore > 0) $sql.=" AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'";
|
||||
$sql.= " AND a.fk_adherent_type = ta.rowid";
|
||||
if ($_POST['filter']) $sql.= " AND ta.rowid='".$_POST['filter']."'";
|
||||
if ($_POST['filtertype']) $sql.= " AND ta.rowid='".$_POST['filtertype']."'";
|
||||
$sql.= " ORDER BY a.email";
|
||||
//print $sql;
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ class modExpedition extends DolibarrModules
|
||||
// Constants
|
||||
$this->const = array();
|
||||
$r=0;
|
||||
|
||||
|
||||
$this->const[$r][0] = "EXPEDITION_ADDON_PDF";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "rouget";
|
||||
@ -124,7 +124,15 @@ class modExpedition extends DolibarrModules
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/delivery";
|
||||
$this->const[$r][3] = "";
|
||||
$this->const[$r][4] = 0;
|
||||
|
||||
$r++;
|
||||
|
||||
$this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "1";
|
||||
$this->const[$r][3] = "Enable shipments";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ class modMultiCurrency extends DolibarrModules
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 500000; // TODO Go on page http://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
|
||||
$this->numero = 40000;
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'multicurrency';
|
||||
|
||||
@ -54,14 +54,12 @@ class modMultiCurrency extends DolibarrModules
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "financial";
|
||||
// Module position in the family
|
||||
$this->module_position = 500;
|
||||
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
$this->familyinfo = array('financial' => array('position'=>'009', 'label'=>$langs->trans("ModuleFamilyFinancial")));
|
||||
$this->module_position = 555;
|
||||
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Description of module MyModule";
|
||||
$this->description = "Module to enter elements with a foreign currency";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
|
||||
$this->version = 'development';
|
||||
|
||||
@ -139,8 +139,8 @@ class modOauth extends DolibarrModules
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array(
|
||||
"CREATE TABLE IF NOT EXISTS llx_oauth_state (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), state varchar(128), fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;",
|
||||
"CREATE TABLE IF NOT EXISTS llx_oauth_token (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), token text, fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;",
|
||||
"CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."oauth_state (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), state varchar(128), fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;",
|
||||
"CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."oauth_token (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), token text, fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;",
|
||||
);
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
|
||||
@ -131,7 +131,9 @@ class modSociete extends DolibarrModules
|
||||
$this->boxes[$r][1] = "box_activity.php";
|
||||
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
|
||||
$r++;
|
||||
|
||||
$this->boxes[$r][1] = "box_goodcustomers.php";
|
||||
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
|
||||
$r++;
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'societe';
|
||||
@ -284,7 +286,11 @@ class modSociete extends DolibarrModules
|
||||
case 'sellist':
|
||||
$tmp='';
|
||||
$tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
|
||||
if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options']));
|
||||
if ($tmpparam['options'] && is_array($tmpparam['options']))
|
||||
{
|
||||
$stack=array_keys($tmpparam['options']);
|
||||
$tmp=array_shift($stack);
|
||||
}
|
||||
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ $backtourl = GETPOST('backtourl', 'alpha');
|
||||
$uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
|
||||
//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
|
||||
//$currentUri->setQuery('');
|
||||
$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php');
|
||||
$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/google_oauthcallback.php');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -75,7 +75,7 @@ class printing_printgcp extends PrintingDriver
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php'
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
@ -113,7 +113,7 @@ class printing_printgcp extends PrintingDriver
|
||||
|
||||
if ($this->google_id != '' && $this->google_secret != '') {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken('Google')?$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):''));
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken('Google')?$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):''));
|
||||
if ($token_ok) {
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_REFRESH', 'info'=>((! empty($refreshtoken))?'Yes':'No'), 'type'=>'info');
|
||||
@ -122,10 +122,10 @@ class printing_printgcp extends PrintingDriver
|
||||
}
|
||||
/*
|
||||
if ($storage->hasAccessToken('Google')) {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'delete');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'delete');
|
||||
} else {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink');
|
||||
}*/
|
||||
} else {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthNotConfigured', 'type'=>'info');
|
||||
@ -200,7 +200,7 @@ class printing_printgcp extends PrintingDriver
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/getgoogleoauthcallback.php'
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
@ -338,7 +338,7 @@ class printing_printgcp extends PrintingDriver
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/getoauthcallback.php?service=google'
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php?service=google'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
@ -387,7 +387,7 @@ class printing_printgcp extends PrintingDriver
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/getgoogleoauthcallback.php'
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
|
||||
@ -1187,7 +1187,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->SetFillColor(255,255,255);
|
||||
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1);
|
||||
|
||||
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php
|
||||
* \ingroup supplier_payment
|
||||
* \brief File containing class for numbering module Brodator
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier_payment.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage customer payment numbering rules Ant
|
||||
*/
|
||||
class mod_supplier_payment_brodator extends ModeleNumRefPayments
|
||||
{
|
||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
var $error = '';
|
||||
var $nom = 'Brodator';
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi la description du modele de numerotation
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$form = new Form($this->db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$texte.= '<input type="hidden" name="action" value="updateMask">';
|
||||
$texte.= '<input type="hidden" name="maskconstsupplierpayment" value="SUPPLIER_PAYMENT_BRODATOR_MASK">';
|
||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
|
||||
$tooltip.=$langs->trans("GenericMaskCodes2");
|
||||
$tooltip.=$langs->trans("GenericMaskCodes3");
|
||||
$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
|
||||
$tooltip.=$langs->trans("GenericMaskCodes5");
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="masksupplierpayment" value="'.$conf->global->SUPPLIER_PAYMENT_BRODATOR_MASK.'">',$tooltip,1,1).'</td>';
|
||||
|
||||
$texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||
|
||||
$texte.= '</tr>';
|
||||
|
||||
$texte.= '</table>';
|
||||
$texte.= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi un exemple de numerotation
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$old_code_client=$mysoc->code_client;
|
||||
$mysoc->code_client='CCCCCCCCCC';
|
||||
$numExample = $this->getNextValue($mysoc,'');
|
||||
$mysoc->code_client=$old_code_client;
|
||||
|
||||
if (! $numExample)
|
||||
{
|
||||
$numExample = $langs->trans('NotConfigured');
|
||||
}
|
||||
return $numExample;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
function getNextValue($objsoc,$object)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||
|
||||
// We get cursor rule
|
||||
$mask=$conf->global->SUPPLIER_PAYMENT_BRODATOR_MASK;
|
||||
|
||||
if (! $mask)
|
||||
{
|
||||
$this->error='NotConfigured';
|
||||
return 0;
|
||||
}
|
||||
|
||||
$numFinal=get_next_value($db,$mask,'paiementfourn','ref','',$objsoc,$object->datepaye);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param string $objforref Object for number to search
|
||||
* @return string Next free value
|
||||
*/
|
||||
function commande_get_num($objsoc,$objforref)
|
||||
{
|
||||
return $this->getNextValue($objsoc,$objforref);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/payment/mod_payment_bronan.php
|
||||
* \ingroup supplier_payment
|
||||
* \brief File containing class for numbering module Bronan
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier_payment.php';
|
||||
|
||||
/**
|
||||
* Class to manage customer payment numbering rules Cicada
|
||||
*/
|
||||
class mod_supplier_payment_bronan extends ModeleNumRefPayments
|
||||
{
|
||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
var $prefix='SPAY';
|
||||
var $error='';
|
||||
var $nom='Bronan';
|
||||
|
||||
|
||||
/**
|
||||
* Return description of numbering module
|
||||
*
|
||||
* @return string Text with description
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi un exemple de numerotation
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
return $this->prefix."0501-0001";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test si les numeros deje en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numerotation de fonctionner.
|
||||
*
|
||||
* @return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
|
||||
$payyymm=''; $max='';
|
||||
|
||||
$posindice=9;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn";
|
||||
$sql.= " WHERE ref LIKE '".$this->prefix."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; }
|
||||
}
|
||||
if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorNumRefModel', $max);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
function getNextValue($objsoc,$object)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
// D'abord on recupere la valeur max
|
||||
$posindice=10;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn";
|
||||
$sql.= " WHERE ref like '".$this->prefix."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $max = intval($obj->max);
|
||||
else $max=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//$date=time();
|
||||
$date=$object->datepaye;
|
||||
$yymm = strftime("%y%m",$date);
|
||||
|
||||
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
|
||||
else $num = sprintf("%04s",$max+1);
|
||||
|
||||
dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
|
||||
return $this->prefix.$yymm."-".$num;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param string $objforref Object for number to search
|
||||
* @return string Next free value
|
||||
*/
|
||||
function payment_get_num($objsoc,$objforref)
|
||||
{
|
||||
return $this->getNextValue($objsoc,$objforref);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class ModeleNumRefPayments
|
||||
* \brief Payment numbering references mother class
|
||||
*/
|
||||
|
||||
abstract class ModeleNumRefPayments
|
||||
{
|
||||
var $error='';
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
*
|
||||
* @return boolean true if module can be used
|
||||
*/
|
||||
function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default description of numbering module
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return numbering example
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run.
|
||||
*
|
||||
* @return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Valeur
|
||||
*/
|
||||
function getNextValue($objsoc,$object)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the module numbering version
|
||||
*
|
||||
* @return string Value
|
||||
*/
|
||||
function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
|
||||
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
|
||||
if ($this->version == 'dolibarr') return DOL_VERSION;
|
||||
if ($this->version) return $this->version;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
@ -1051,7 +1051,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$pdf->SetFillColor(255,255,255);
|
||||
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1);
|
||||
|
||||
@ -126,8 +126,19 @@ if (GETPOST('search_project') != '')
|
||||
}
|
||||
if (GETPOST('search_task') != '')
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
|
||||
exit;
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
|
||||
exit;
|
||||
}
|
||||
|
||||
if (GETPOST('search_user') != '')
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/user/index.php?mode=search&sall='.urlencode(GETPOST('search_user')));
|
||||
exit;
|
||||
}
|
||||
if (GETPOST('search_group') != '')
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/user/group/index.php?mode=search&sall='.urlencode(GETPOST('search_group')));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ of the module.
|
||||
|
||||
For example on Linux OS: Get the module from the command
|
||||
mkdir ~/git; cd ~/git
|
||||
git clone https://git.doliforge.org/p/newmodule/newmodule.git
|
||||
git clone https://git.framasoft.org/p/newmodule/newmodule.git
|
||||
Then create the symbolic link
|
||||
ln -fs ~/git/newmodule/htdocs /path_to_dolibarr/htdocs/custom/newmodule
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014-2015 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -199,7 +200,7 @@ if (empty($reshook))
|
||||
$batch="batchl".$i."_0";
|
||||
$stockLocation="ent1".$i."_0";
|
||||
$qty = "qtyl".$i;
|
||||
|
||||
|
||||
if (isset($_POST[$batch]))
|
||||
{
|
||||
//shipment line with batch-enable product
|
||||
@ -242,7 +243,8 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
//shipment line for product with no batch management
|
||||
//var_dump($_POST); var_dump($batch);
|
||||
//shipment line for product with no batch management and no multiple stock location
|
||||
if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int');
|
||||
}
|
||||
|
||||
@ -277,7 +279,7 @@ if (empty($reshook))
|
||||
{
|
||||
if ($stockLine[$i][$j]['qty']>0)
|
||||
{
|
||||
$ret=$object->addline($stockLine[$i][$j]['warehouse_id'], $stockLine[$i][$j]['ix_l'], $stockLine[$i][$j]['qty']);
|
||||
$ret=$object->addline($stockLine[$i][$j]['warehouse_id'], $stockLine[$i][$j]['ix_l'], $stockLine[$i][$j]['qty'], $array_options[$i]);
|
||||
if ($ret < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -286,19 +288,22 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))
|
||||
else
|
||||
{
|
||||
$ent = "entl".$i;
|
||||
$idl = "idl".$i;
|
||||
$entrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
|
||||
if ($entrepot_id < 0) $entrepot_id='';
|
||||
if (! ($objectsrc->lines[$i]->fk_product > 0)) $entrepot_id = 0;
|
||||
|
||||
$ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int'),$array_options[$i]);
|
||||
if ($ret < 0)
|
||||
if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
$ent = "entl".$i;
|
||||
$idl = "idl".$i;
|
||||
$entrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
|
||||
if ($entrepot_id < 0) $entrepot_id='';
|
||||
if (! ($objectsrc->lines[$i]->fk_product > 0)) $entrepot_id = 0;
|
||||
|
||||
$ret=$object->addline($entrepot_id, GETPOST($idl,'int'), GETPOST($qty,'int'), $array_options[$i]);
|
||||
if ($ret < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -549,7 +554,7 @@ if ($action == 'create2')
|
||||
$action=''; $id=''; $ref='';
|
||||
}
|
||||
|
||||
// Mode creation. TODO This part seems to not be used at all. Receipt record is created by the action "create_delivery" not from a form.
|
||||
// Mode creation.
|
||||
if ($action == 'create')
|
||||
{
|
||||
$expe = new Expedition($db);
|
||||
@ -577,9 +582,6 @@ if ($action == 'create')
|
||||
|
||||
if (! empty($conf->stock->enabled)) $entrepot = new Entrepot($db);
|
||||
|
||||
/*
|
||||
* Document source
|
||||
*/
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -711,9 +713,7 @@ if ($action == 'create')
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Expedition Lines
|
||||
*/
|
||||
// Shipment lines
|
||||
|
||||
$numAsked = count($object->lines);
|
||||
|
||||
@ -745,9 +745,9 @@ if ($action == 'create')
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
/* Lecture des expeditions deja effectuees */
|
||||
// Lecture des expeditions deja effectuees
|
||||
$object->loadExpeditions();
|
||||
|
||||
|
||||
if ($numAsked)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
@ -792,9 +792,9 @@ if ($action == 'create')
|
||||
if (! empty($line->date_end)) $type=1;
|
||||
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
|
||||
|
||||
// Product label
|
||||
if ($line->fk_product > 0)
|
||||
if ($line->fk_product > 0) // If predefined product
|
||||
{
|
||||
$product->fetch($line->fk_product);
|
||||
$product->load_stock();
|
||||
@ -819,12 +819,12 @@ if ($action == 'create')
|
||||
{
|
||||
print ($line->desc && $line->desc!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->desc):'';
|
||||
}
|
||||
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>";
|
||||
print "<td>";
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
@ -846,7 +846,7 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
$qtyProdCom=$line->qty;
|
||||
|
||||
// Qty already sent
|
||||
// Qty already shipped
|
||||
print '<td align="center">';
|
||||
$quantityDelivered = $object->expeditions[$line->id];
|
||||
print $quantityDelivered;
|
||||
@ -863,9 +863,9 @@ if ($action == 'create')
|
||||
$quantityToBeDelivered = $quantityAsked - $quantityDelivered;
|
||||
}
|
||||
$warehouse_id = GETPOST('entrepot_id','int');
|
||||
|
||||
|
||||
$warehouseObject = null;
|
||||
if ($warehouse_id > 0)
|
||||
if ($warehouse_id > 0 || ! ($line->fk_product > 0)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
|
||||
{
|
||||
//ship from preselected location
|
||||
$stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number
|
||||
@ -942,7 +942,7 @@ if ($action == 'create')
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
|
||||
|
||||
$staticwarehouse=new Entrepot($db);
|
||||
$staticwarehouse->fetch($warehouse_id);
|
||||
if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id);
|
||||
|
||||
$subj=0;
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
@ -970,16 +970,18 @@ if ($action == 'create')
|
||||
$quantityToBeDelivered = 0;
|
||||
}
|
||||
$subj++;
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="3" ></td><td align="center">';
|
||||
print '<tr><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -988,13 +990,16 @@ if ($action == 'create')
|
||||
// ship from multiple locations
|
||||
if (empty($conf->productbatch->enabled) || ! $product->hasbatch())
|
||||
{
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for each warehouse
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for each warehouse
|
||||
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
$subj=0;
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) {
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
$warehouseObject=new Entrepot($db);
|
||||
$warehouseObject->fetch($warehouse_id);
|
||||
if ($stock_warehouse->real > 0) {
|
||||
if ($stock_warehouse->real > 0)
|
||||
{
|
||||
$stock = + $stock_warehouse->real; // Convert it to number
|
||||
$deliverableQty = min($quantityToBeDelivered,$stock);
|
||||
// Quantity to send
|
||||
@ -1039,7 +1044,7 @@ if ($action == 'create')
|
||||
{
|
||||
$product->get_sousproduits_arbo();
|
||||
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
|
||||
if(count($prods_arbo) > 0)
|
||||
if (count($prods_arbo) > 0)
|
||||
{
|
||||
foreach($prods_arbo as $key => $value)
|
||||
{
|
||||
@ -1049,10 +1054,12 @@ if ($action == 'create')
|
||||
{
|
||||
$img=img_warning($langs->trans("StockTooLow"));
|
||||
}
|
||||
print "<tr ".$bc[$var]."><td> ->
|
||||
print "<tr ".$bc[$var]."><td>";
|
||||
print " ->
|
||||
<a href=\"".DOL_URL_ROOT."/product/card.php?id=".$value['id']."\">".$value['fullpath']."
|
||||
</a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td> </td><td> </td>
|
||||
<td align=\"center\">".$value['stock']." ".$img."</td></tr>";
|
||||
<td align=\"center\">".$value['stock']." ".$img."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1060,11 +1067,12 @@ if ($action == 'create')
|
||||
else
|
||||
{
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
|
||||
|
||||
|
||||
$subj=0;
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) {
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
$warehouseObject=new Entrepot($db);
|
||||
$warehouseObject->fetch($warehouse_id);
|
||||
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
|
||||
@ -1073,7 +1081,7 @@ if ($action == 'create')
|
||||
//var_dump($dbatch);
|
||||
$batchStock = + $dbatch->qty; // To get a numeric
|
||||
$deliverableQty = min($quantityToBeDelivered,$batchStock);
|
||||
print '<tr><td colspan="3" ></td><td align="center">';
|
||||
print '<tr><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '</td>';
|
||||
|
||||
@ -1091,25 +1099,44 @@ if ($action == 'create')
|
||||
}
|
||||
//dol_syslog('deliverableQty = '.$deliverableQty.' batchStock = '.$batchStock);
|
||||
$subj++;
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($subj == 0)
|
||||
if ($subj == 0) // Line not shown yet
|
||||
{
|
||||
print '<tr><td colspan="3" ></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
if ($warehouseObject)
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle);
|
||||
//$disabled='disabled="disabled"';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled?' '.$disabled:'').'> ';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_warning().' '.$langs->trans("StockTooLow");
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
if ($warehouseObject)
|
||||
{
|
||||
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($line->fk_product) print img_warning().' '.$langs->trans("StockTooLow");
|
||||
else print '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Service");
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1576,6 +1603,7 @@ else if ($id || $ref)
|
||||
{
|
||||
print (! empty($lines[$i]->description) && $lines[$i]->description!=$lines[$i]->product)?'<br>'.dol_htmlentitiesbr($lines[$i]->description):'';
|
||||
}
|
||||
print "</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014-2015 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -870,13 +871,23 @@ class Expedition extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) // FIXME Check is done for stock of product, it must be done for stock of product into warehouse if $entrepot_id defined
|
||||
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT)
|
||||
{
|
||||
// Check must be done for stock of product into warehouse if $entrepot_id defined
|
||||
$product=new Product($this->db);
|
||||
$result=$product->fetch($fk_product);
|
||||
$product_type=$product->type;
|
||||
|
||||
if ($product_type == 0 && $product->stock_reel < $qty)
|
||||
$product_type=$product->type;
|
||||
if ($entrepot_id > 0) {
|
||||
$product->load_stock();
|
||||
$product_stock = $product->stock_warehouse[$entrepot_id]->real;
|
||||
}
|
||||
else
|
||||
{
|
||||
$product_stock = $product->stock_reel;
|
||||
}
|
||||
|
||||
if ($product_type == 0 && $product_stock < $qty)
|
||||
{
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
$this->db->rollback();
|
||||
@ -901,8 +912,8 @@ class Expedition extends CommonObject
|
||||
*/
|
||||
function addline_batch($dbatch,$array_options=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
global $conf,$langs;
|
||||
|
||||
$num = count($this->lines);
|
||||
if ($dbatch['qty']>0)
|
||||
{
|
||||
@ -928,7 +939,17 @@ class Expedition extends CommonObject
|
||||
|
||||
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT)
|
||||
{
|
||||
// TODO
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
||||
$prod_batch = new Productbatch($this->db);
|
||||
$prod_batch->fetch($value['id_batch']);
|
||||
|
||||
if ($prod_batch->qty < $linebatch->dluo_qty)
|
||||
{
|
||||
$this->errors[] = $langs->trans('ErrorStockIsNotEnough');
|
||||
dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($linebatch);
|
||||
@ -945,6 +966,7 @@ class Expedition extends CommonObject
|
||||
|
||||
//var_dump($line);
|
||||
$this->lines[$num] = $line;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,17 +42,16 @@ $search_company = GETPOST("search_company");
|
||||
$sall = GETPOST('sall');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
|
||||
if (! $sortfield) $sortfield="e.ref";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="e.ref";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
@ -71,6 +70,19 @@ $fieldstosearchall = array(
|
||||
's.nom'=>"ThirdParty"
|
||||
);
|
||||
|
||||
$arrayfields=array(
|
||||
);
|
||||
// Extra fields
|
||||
/*
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -129,18 +141,22 @@ if ($resql)
|
||||
|
||||
$expedition = new Expedition($db);
|
||||
|
||||
$param="";
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp;
|
||||
if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv;
|
||||
if ($search_company) $param.= "&search_company=".$search_company;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords);
|
||||
|
||||
|
||||
$i = 0;
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
@ -149,6 +165,18 @@ if ($resql)
|
||||
}
|
||||
|
||||
$moreforfilter='';
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array('type'=>$type);
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2016 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
|
||||
@ -131,11 +132,11 @@ class Export
|
||||
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
||||
if (! empty($perm[2]))
|
||||
{
|
||||
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
|
||||
$bool=$user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
|
||||
}
|
||||
else
|
||||
{
|
||||
$bool=$user->rights->$perm[0]->$perm[1];
|
||||
$bool=$user->rights->{$perm[0]}->{$perm[1]};
|
||||
}
|
||||
if ($perm[0]=='user' && $user->admin) $bool=true;
|
||||
if (! $bool) break;
|
||||
|
||||
@ -42,9 +42,9 @@ $fichinterid = GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'ficheinter', $fichinterid,'fichinter');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
@ -123,13 +123,15 @@ if ($socid)
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
//print $sql;
|
||||
|
||||
@ -138,15 +140,14 @@ if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$urlparam='';
|
||||
if ($socid) $urlparam.="&socid=".$socid;
|
||||
if ($search_ref) $urlparam.="&search_ref=".urlencode($search_ref);
|
||||
if ($search_company) $urlparam.="&search_company=".urlencode($search_company);
|
||||
if ($search_desc) $urlparam.="&search_desc=".urlencode($search_desc);
|
||||
if ($search_status != '' && $search_status > -1) $urlparam.="&search_status=".urlencode($search_status);
|
||||
if ($optioncss != '') $urlparam.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_commercial.png');
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($socid) $param.="&socid=".$socid;
|
||||
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
|
||||
if ($search_company) $param.="&search_company=".urlencode($search_company);
|
||||
if ($search_desc) $param.="&search_desc=".urlencode($search_desc);
|
||||
if ($search_status != '' && $search_status > -1) $param.="&search_status=".urlencode($search_status);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -155,7 +156,9 @@ if ($result)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
if ($sall)
|
||||
print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
@ -164,16 +167,16 @@ if ($result)
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder);
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||
{
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],'');
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$urlparam,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ class ProductFournisseur extends Product
|
||||
var $ref_supplier; // ref supplier (can be set by get_buyprice)
|
||||
var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
|
||||
|
||||
var $fourn_id; //supplier id
|
||||
var $fourn_qty; // quantity for price (can be set by get_buyprice)
|
||||
var $fourn_pu; // unit price for quantity (can be set by get_buyprice)
|
||||
|
||||
@ -367,6 +368,7 @@ class ProductFournisseur extends Product
|
||||
if ($obj)
|
||||
{
|
||||
$this->product_fourn_price_id = $rowid;
|
||||
$this->fourn_id = $obj->fk_soc;
|
||||
$this->fourn_ref = $obj->ref_fourn; // deprecated
|
||||
$this->ref_supplier = $obj->ref_fourn;
|
||||
$this->fourn_price = $obj->price;
|
||||
@ -379,6 +381,7 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_tva_tx = $obj->tva_tx;
|
||||
$this->product_id = $obj->fk_product; // deprecated
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->id = $obj->fk_product;
|
||||
$this->fk_availability = $obj->fk_availability;
|
||||
$this->delivery_time_days = $obj->delivery_time_days;
|
||||
//$this->fourn_tva_npr = $obj->fourn_tva_npr; // TODO this field not exist in llx_product_fournisseur_price. We should add it ?
|
||||
|
||||
@ -74,7 +74,7 @@ class PaiementFourn extends Paiement
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
|
||||
$sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,';
|
||||
$sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
|
||||
$sql.= ' p.num_paiement, p.note, b.fk_account';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p';
|
||||
@ -95,7 +95,8 @@ class PaiementFourn extends Paiement
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->entity = $obj->entity;
|
||||
$this->date = $this->db->jdate($obj->dp);
|
||||
$this->numero = $obj->num_paiement;
|
||||
$this->bank_account = $obj->fk_account;
|
||||
@ -149,11 +150,12 @@ class PaiementFourn extends Paiement
|
||||
|
||||
if ($this->total <> 0) // On accepte les montants negatifs
|
||||
{
|
||||
$ref = $this->getNextNumRef('');
|
||||
$now=dol_now();
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
|
||||
$sql.= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
|
||||
$sql.= " VALUES ('".$this->db->idate($now)."',";
|
||||
$sql.= 'ref, entity, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
|
||||
$sql.= " VALUES ('".$this->db->escape($ref)."', ".$conf->entity.", '".$this->db->idate($now)."',";
|
||||
$sql.= " '".$this->db->idate($this->datepaye)."', '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
|
||||
|
||||
dol_syslog("PaiementFourn::create", LOG_DEBUG);
|
||||
@ -513,4 +515,114 @@ class PaiementFourn extends Paiement
|
||||
if ($withpicto != 2) $result.=$link.$text.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen($option='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
$now=dol_now();
|
||||
$arraynow=dol_getdate($now);
|
||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||
|
||||
// Initialize parameters
|
||||
$this->id=0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
$this->facid = 1;
|
||||
$this->datepaye = $nownotime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next reference of supplier invoice not already used (or last reference)
|
||||
* according to numbering module defined into constant SUPPLIER_PAYMENT_ADDON
|
||||
*
|
||||
* @param Societe $soc object company
|
||||
* @param string $mode 'next' for next value or 'last' for last value
|
||||
* @return string free ref or last ref
|
||||
*/
|
||||
function getNextNumRef($soc,$mode='next')
|
||||
{
|
||||
global $conf, $db, $langs;
|
||||
$langs->load("bills");
|
||||
|
||||
// Clean parameters (if not defined or using deprecated value)
|
||||
if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_bronan';
|
||||
else if ($conf->global->SUPPLIER_PAYMENT_ADDON=='brodator') $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_brodator';
|
||||
else if ($conf->global->SUPPLIER_PAYMENT_ADDON=='bronan') $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_bronan';
|
||||
|
||||
if (! empty($conf->global->SUPPLIER_PAYMENT_ADDON))
|
||||
{
|
||||
$mybool=false;
|
||||
|
||||
$file = $conf->global->SUPPLIER_PAYMENT_ADDON.".php";
|
||||
$classname = $conf->global->SUPPLIER_PAYMENT_ADDON;
|
||||
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_payment/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
if (is_file($dir.$file) && is_readable($dir.$file))
|
||||
{
|
||||
$mybool |= include_once $dir . $file;
|
||||
}
|
||||
}
|
||||
|
||||
// For compatibility
|
||||
if (! $mybool)
|
||||
{
|
||||
$file = $conf->global->SUPPLIER_PAYMENT_ADDON.".php";
|
||||
$classname = "mod_supplier_payment_".$conf->global->SUPPLIER_PAYMENT_ADDON;
|
||||
$classname = preg_replace('/\-.*$/','',$classname);
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot."/core/modules/supplier_payment/";
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
if (is_file($dir.$file) && is_readable($dir.$file)) {
|
||||
$mybool |= include_once $dir . $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
|
||||
/**
|
||||
* $numref can be empty in case we ask for the last value because if there is no invoice created with the
|
||||
* set up mask.
|
||||
*/
|
||||
if ($mode != 'last' && !$numref) {
|
||||
dol_print_error($db,"SupplierPayment::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -217,7 +217,6 @@ if ($resql)
|
||||
if ($billed != '') $param.="billed=".$billed;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -226,7 +225,9 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
if ($sall)
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -60,8 +60,8 @@ $page=GETPOST("page",'int');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -233,7 +233,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
@ -261,9 +260,7 @@ if ($resql)
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_status >= 0) $param.="&search_status=".$search_status;
|
||||
|
||||
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy');
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
@ -271,7 +268,9 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
if ($search_all)
|
||||
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit);
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
|
||||
|
||||
@ -304,10 +304,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<input type="hidden" name="socid" value="'.$obj->socid.'">';
|
||||
print '<input type="hidden" name="societe" value="'.$obj->name.'">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans('Payment').'</td>';
|
||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Company').'</td><td colspan="2">';
|
||||
$supplierstatic->id=$obj->socid;
|
||||
$supplierstatic->name=$obj->name;
|
||||
print $supplierstatic->getNomUrl(1,'supplier');
|
||||
@ -333,7 +334,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<tr><td colspan="2"> </td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$parameters=array('facid'=>$facid, 'ref'=>$ref, 'objcanvas'=>$objcanvas);
|
||||
$reshook=$hookmanager->executeHooks('paymentsupplierinvoices',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -360,7 +361,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
{
|
||||
$i = 0;
|
||||
print '<br>';
|
||||
print $langs->trans('Invoices').'<br>';
|
||||
|
||||
if(!empty($conf->global->FAC_AUTO_FILLJS)){
|
||||
//Add js for AutoFill
|
||||
@ -372,15 +372,15 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print ' });'."\n";
|
||||
print ' </script>'."\n";
|
||||
}
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('Invoice').'</td>';
|
||||
print '<td>'.$langs->trans('RefSupplier').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
|
||||
print '<td align="right">'.$langs->trans('AlreadyPaid').'</td>';
|
||||
print '<td align="right">'.$langs->trans('RemainderToPay').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Amount').'</td>';
|
||||
print '<td align="center">'.$langs->trans('PaymentAmount').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
@ -446,7 +446,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
if ($action != 'add_paiement')
|
||||
{
|
||||
print '<br><div class="center"><input type="checkbox" checked name="closepaidinvoices"> '.$langs->trans("ClosePaidInvoicesAutomatically");
|
||||
print '<br><input type="submit" class="button" value="'.$langs->trans('Save').'"></div>';
|
||||
print '<br><input type="submit" class="button" value="'.$langs->trans('ToMakePayment').'"></div>';
|
||||
}
|
||||
|
||||
// Form to confirm payment
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 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
|
||||
@ -106,11 +107,11 @@ class Import
|
||||
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
||||
if ($perm[2])
|
||||
{
|
||||
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
|
||||
$bool=$user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
|
||||
}
|
||||
else
|
||||
{
|
||||
$bool=$user->rights->$perm[0]->$perm[1];
|
||||
$bool=$user->rights->{$perm[0]}->{$perm[1]};
|
||||
}
|
||||
if ($perm[0]=='user' && $user->admin) $bool=true;
|
||||
//print $bool." $perm[0]"."<br>";
|
||||
|
||||
0
htdocs/includes/jquery/plugins/select2/release.sh
Normal file → Executable file
0
htdocs/includes/jquery/plugins/select2/release.sh
Normal file → Executable file
@ -618,10 +618,10 @@ function showWeather($totallate,$text,$options)
|
||||
$level2=$offset+2*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
||||
$level3=$offset+3*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
||||
|
||||
if ($totallate <= $level0) $out.=img_picto_common($text,'weather/weather-clear.png',$options);
|
||||
if ($totallate > $level0 && $totallate <= $level1) $out.=img_picto_common($text,'weather/weather-few-clouds.png',$options);
|
||||
if ($totallate > $level1 && $totallate <= $level2) $out.=img_picto_common($text,'weather/weather-clouds.png',$options);
|
||||
if ($totallate > $level2 && $totallate <= $level3) $out.=img_picto_common($text,'weather/weather-many-clouds.png',$options);
|
||||
if ($totallate > $level3) $out.=img_picto_common($text,'weather/weather-storm.png',$options);
|
||||
if ($totallate <= $level0) $out.=img_weather($text,'weather-clear.png',$options);
|
||||
if ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text,'weather-few-clouds.png',$options);
|
||||
if ($totallate > $level1 && $totallate <= $level2) $out.=img_weather($text,'weather-clouds.png',$options);
|
||||
if ($totallate > $level2 && $totallate <= $level3) $out.=img_weather($text,'weather-many-clouds.png',$options);
|
||||
if ($totallate > $level3) $out.=img_weather($text,'weather-storm.png',$options);
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -77,7 +77,8 @@ $conffiletoshow = "htdocs/conf/conf.php";
|
||||
//$conffiletoshow = "/etc/dolibarr/conf.php";
|
||||
|
||||
|
||||
if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
||||
// Load conf file if it is already defined
|
||||
if (! defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) // Test on filesize is to ensure that conf file is more that an empty template with just <?php in first line
|
||||
{
|
||||
$result=include_once $conffile; // Load conf file
|
||||
if ($result)
|
||||
|
||||
@ -34,9 +34,6 @@ ALTER TABLE llx_actioncomm ADD COLUMN email_tocc varchar(256) after email_to;
|
||||
ALTER TABLE llx_actioncomm ADD COLUMN email_tobcc varchar(256) after email_tocc;
|
||||
|
||||
|
||||
UPDATE llx_commande_fourn set billed=1 where statut = 8;
|
||||
UPDATE llx_commande_fourn set statut=5 where statut = 8 and billed=1;
|
||||
|
||||
ALTER TABLE llx_user MODIFY COLUMN pass varchar(128);
|
||||
ALTER TABLE llx_user MODIFY COLUMN pass_temp varchar(128);
|
||||
|
||||
@ -111,6 +108,9 @@ ALTER TABLE llx_commande ADD COLUMN fk_warehouse integer DEFAULT NULL AFTER fk_s
|
||||
ALTER TABLE llx_commande_fournisseur ADD COLUMN billed smallint DEFAULT 0 AFTER fk_statut;
|
||||
ALTER TABLE llx_commande_fournisseur ADD INDEX billed (billed);
|
||||
|
||||
UPDATE llx_commande_fournisseur set billed=1 where statut = 8;
|
||||
UPDATE llx_commande_fournisseur set statut=5 where statut = 8 and billed=1;
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN cost_price double(24,8) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE llx_ecm_directories MODIFY COLUMN fullpath varchar(750);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user