Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Maxime Kohlhaas 2014-04-23 17:51:22 +02:00
commit d21ea0fe19
764 changed files with 56572 additions and 48170 deletions

View File

@ -41,8 +41,14 @@ For users:
- New: Add field url as product properties.
- New: More options to create a credit note (can be filled autatically according to remain to pay).
- New: Can define custom fields for categories.
- New: Prepare generation of SEPA files into module withdrawal.
- New: Can filter on status for supplier order.
- New: Add option FACTURE_SENDBYEMAIL_FOR_ALL_STATUS to allow to send invoice by email
whatever is its status.
- New: Add filter date in bank writing list page.
- Fix: Project Task numbering customs rule works.
- Fix: Add actions events not implemented.
- Fix: Price min of composition is not supplier price min by quantity
TODO
- New: Predefined product and free product use same form.
@ -65,6 +71,7 @@ For developers:
action buttons into an element.
- New: Normalize code for barcode generation to match other modules.
- New: Uniformize code for contacts forms.
- New: Add some hooks for financial reports.
WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:
@ -72,10 +79,62 @@ Dolibarr better:
- The deprecated way (with 4 parameters) to declare a new tab into a module descriptor file has been
removed. You must now use the 6 parameters way. See file modMyModule.class.php for example.
- Remove the javascript function ac_delay() that is not used anymore by core code.
- Properties "dictionaries" into module descriptor files has been renamed into "dictionaries".
- Properties "dictionnaries" into module descriptor files has been renamed into "dictionaries".
- Method form->select_currency() has been removed. Use instead print form->selectCurrency().
- Method form->select_methodes_commande() has been renamed into english name selectInputMethod().
- The following hooks are now 'addreplace' hooks: "formCreateThirdpartyOptions"
So check that return value is 0 to keep default standard behaviour after hook or 1 to disable
default standard behaviour.
***** ChangeLog for 3.5.3 compared to 3.5.2 *****
Fix: Error on field accountancy code for export profile of invoices.
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
Fix: Can't add user for a task.
Fix: Autoselect of warehouse if there is only one warehouse.
Fix: Install of odt template for project and tasks.
Fix: [ bug #1318 ] Problem with enter key when adding an existing
product to a customer invoice.
Fix: [ bug #1307 ] Quotes get removed from several inputs.
Fix: [ bug #1317 ] Removing a category does not remove all child categories
Fix: [ bug #1312 ] Call to undefined function _()
Fix: Restore build for obs and launchpad.
Fix: deleting files into backup system tools.
Fix: Dump using php not not include lock on tables that are deleted.
Fix: Fixed a problem with bank accounts sharing across entities.
Fix: fields into group by of sql requests for module margins must be
same than fields into select.
Fix: When select_date is called with '' as preselected date,
automatic user date was not correctly et (We must set a date into PHP
server timezone area)
Fix: First param of select_date must always be forged with a dolibarr
date function and not time().
Fix: fix can't add line with product in supplier order
Fix: [bug #1309]
Fix: Solve pb of too many embedded tables
Fix: [ bug #1306 ] Fatal error when adding an external calendar
Fix: A fix to manage automatic creation of code for import.
Fix: Try to add code to provide easy way to fix warning on timezone not
defined.
Fix: Several fix into workflow/condition for invoice payments or convert
into discount.
Fix: Option MAIN_PDF_DASH_BETWEEN_LINES was not working when tcpdf was
making a pagebreak higher than 2 pages.
Fix: form to add images should not show link form.
Fix: Correction when adding order line with price as '0'.
Fix: [ bug #1283 ] ROUGET Shipment PDF.
Fix: [ bug #1300 ]
Fix: Miscellaneous problems on task tabs (withproject parameter lost and
download fails).
Fix: Avoid home project page to hung when too many tasks opened.
Fix: bug #1295: Error when creating an agenda extrafield with a number as reference
Fix: Translation of number for pt_PT.
Fix: Error on ajax_constantonoff function.
Fix: [ bug #1323 ] problème pour générer un odt depuis les taches dans projet.
Fix: Can not make withdrawals
***** ChangeLog for 3.5.1 compared to 3.5.0 *****
Fix: Do not report trigger errors twice.
Fix: Error when creating event was not reported.
@ -113,9 +172,11 @@ Fix: [ bug #520 ] Product statistics and detailed lists are wrong.
Fix: [ bug #1240 ] traduction.
Fix: [ bug #1238 ] When creating accompte with a %, free product are used for calculation.
Fix: [ bug #1280 ] service with not end of date was tagged as expired.
Fix: [ bug #1295 ] Error when creating an agenda extrafield with a number as reference
Fix: [ bug #1306 ] Fatal error when adding an external calendar
Fix: [ bug #1295 ] Error when creating an agenda extrafield with a number as reference.
Fix: [ bug #1306 ] Fatal error when adding an external calendar.
New: Added es_CL language
Fix: Margin tabs bad data show
Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice.
***** ChangeLog for 3.5 compared to 3.4.* *****
For users:
@ -249,18 +310,12 @@ parameter. All methods addline in this case were modified to remove this paramet
***** ChangeLog for 3.4.3 compared to 3.4.2 *****
Fix: Bad get of localtaxes into contracts add lines
***** ChangeLog for 3.4.3 compared to 3.4.2 *****
Fix: Warning into bank conciliation feature.
Fix: Bad get of localtaxes into contracts add lines.
Fix: Add a limit into list to avoid browser to hang when database is too large.
Fix: [ bug #1212 ] 'jqueryFileTree.php' directory traversal vulnerability
***** ChangeLog for 3.4.3 compared to 3.4.2 *****
Fix: Warning into bank conciliation feature.
Fix: Bad get of localtaxes into contracts add lines.
Fix: Add a limit into list to avoid browser to hang when database is too large.
Fix: [ bug #1212 ] 'jqueryFileTree.php' directory traversal vulnerability
Fix: Agenda and Banks module were not working with multicompany module
Fix: [ bug #1317 ] Removing a category does not remove all child categories
***** ChangeLog for 3.4.2 compared to 3.4.1 *****
Fix: field's problem into company's page (RIB).

View File

@ -166,8 +166,7 @@ Warning: Date must have format reported by "date -R"
Warning: Name and email must match value into debian/control file (Entry added here is used by next step).
* We try to build package
> rm -fr ../build-area
> git-buildpackage -us -uc
> rm -fr ../build-area; git-buildpackage -us -uc
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match
@ -230,20 +229,20 @@ from origin/upstream and origin/pristine.
* Staying into git root directory, run
> git-import-orig -vv ../dolibarr-3.3.4.tgz
and enter version when requested.
Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit
* Add an entry into debian/changelog
> dch -v x.y.z-1 "My comment" will add entry.
For example: dch -v x.y.z-1 "New upstream release." for a new version
> dch -v x.y.z-w "My comment" will add entry.
For example: dch -v x.y.z-w "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import)
Then modify changelog to replace "unstable" with "UNRELEASED".
Warning: Date must have format reported by "date -R"
Warning: Name and email must match value into debian/control file (Entry added here is used by next step).
Then check/modify also the user/date signature:
- Date must have format reported by "date -R"
- Name and email must match value into debian/control file (Entry added here is used by next step).
* We try to build package
> rm -fr ../build-area
> git-buildpackage -us -uc
> rm -fr ../build-area; git-buildpackage -us -uc
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match
@ -272,4 +271,3 @@ http://packages.qa.debian.org
* Package will be into release when test will be moved as stable.

View File

@ -6,7 +6,7 @@ Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
Standards-Version: 3.9.4
Homepage: http://www.dolibarr.org
Build-Depends: debhelper (>= 9), po-debconf
Comments: This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version
# This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version
Package: dolibarr
Architecture: all
@ -16,7 +16,7 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, php5-geoip,
# Required PHP libraries
php-pear, php-mail-mime,
# libfpdi-php, libfpdf-tpl-php, php-fpdf,
# php-tcpdf, libfpdi-php, libfpdf-tpl-php, php-fpdf,
# libphp-adodb,
# libnusoap-php,
# libphp-pclzip,

View File

@ -37,7 +37,7 @@ $force_install_lockinstall='444';
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
//$force_dolibarr_lib_PHPEXCEL_PATH='';
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor'; // Use '/javascript/ckeditor' or 'disabled'
//$force_dolibarr_js_JQUERY='/javascript/jquery';
//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';
//$force_dolibarr_js_JQUERY_FLOT='/javascript/flot';

View File

@ -20,7 +20,8 @@ $RPMSUBVERSION="auto"; # auto use value found into BUILD
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
%REQUIREMENTPUBLISH=(
"SF"=>"git ssh rsync"
"SF"=>"git ssh rsync",
"ASSO"=>"git ssh rsync"
);
%REQUIREMENTTARGET=( # Tool requirement for each package
"TGZ"=>"tar",
@ -58,7 +59,8 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
$SOURCE="$DIR/..";
$DESTI="$SOURCE/build";
$PUBLISH="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/files";
if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"})
{
print "Error: Missing environment variables.\n";
@ -174,15 +176,15 @@ for (0..@ARGV-1) {
}
if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTIBETARC is defined
if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTISTABLE is defined
if ($ENV{"PUBLISHBETARC"} && $BUILD =~ /[a-z]/i) { $PUBLISH = $ENV{"PUBLISHBETARC"}; } # Force target site for publishing if env PUBLISHBETARC is defined
if ($ENV{"PUBLISHSTABLE"} && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $ENV{"PUBLISHSTABLE"}; } # Force target site for publishing if env PUBLISHSTABLE is defined
if ($ENV{"PUBLISHBETARC"} && $BUILD =~ /[a-z]/i) { $PUBLISHBETARC = $ENV{"PUBLISHBETARC"}; } # Force target site for publishing if env PUBLISHBETARC is defined
if ($ENV{"PUBLISHSTABLE"} && $BUILD =~ /^[0-9]+$/) { $PUBLISHSTABLE = $ENV{"PUBLISHSTABLE"}; } # Force target site for publishing if env PUBLISHSTABLE is defined
print "Makepack version $VERSION\n";
print "Building/publishing package name: $PROJECT\n";
print "Building/publishing package version: $MAJOR.$MINOR.$BUILD\n";
print "Source directory (SOURCE): $SOURCE\n";
print "Target directory (DESTI) : $DESTI\n";
print "Publishing target (PUBLISH): $PUBLISH\n";
#print "Publishing target (PUBLISH): $PUBLISH\n";
# Choose package targets
@ -190,24 +192,27 @@ print "Publishing target (PUBLISH): $PUBLISH\n";
if ($target) {
if ($target eq "ALL") {
foreach my $key (@LISTETARGET) {
if ($key ne 'SNAPSHOT' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; }
if ($key ne 'SNAPSHOT' && $key ne 'SF' && $key ne 'ASSO') { $CHOOSEDTARGET{$key}=1; }
}
}
if ($target ne "ALL" && $target ne "SF") { $CHOOSEDTARGET{uc($target)}=1; }
if ($target ne "ALL" && $target ne "SF" && $target ne "ASSO") { $CHOOSEDTARGET{uc($target)}=1; }
if ($target eq "SF") { $CHOOSEDPUBLISH{"SF"}=1; }
if ($target eq "ASSO") { $CHOOSEDPUBLISH{"ASSO"}=1; }
}
else {
my $found=0;
my $NUM_SCRIPT;
my $cpt=0;
while (! $found) {
printf(" %2d - %-12s (%s)\n",$cpt,"ALL (1..9)","Need ".join(",",values %REQUIREMENTTARGET));
printf(" %2d - %-14s (%s)\n",$cpt,"ALL (1..9)","Need ".join(",",values %REQUIREMENTTARGET));
foreach my $target (@LISTETARGET) {
$cpt++;
printf(" %2d - %-12s (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target});
printf(" %2d - %-14s (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target});
}
$cpt=98;
printf(" %2d - %-14s (%s)\n",$cpt,"ASSO (publish)","Need ".join(",",values %REQUIREMENTPUBLISH));
$cpt=99;
printf(" %2d - %-12s (%s)\n",$cpt,"SF (publish)","Need ".join(",",values %REQUIREMENTPUBLISH));
printf(" %2d - %-14s (%s)\n",$cpt,"SF (publish)","Need ".join(",",values %REQUIREMENTPUBLISH));
# Ask which target to build
print "Choose one package number or several separated with space (0 - ".$cpt."): ";
@ -224,19 +229,25 @@ else {
}
}
print "\n";
if ($NUM_SCRIPT eq "99") {
$CHOOSEDPUBLISH{"SF"}=1;
if ($NUM_SCRIPT eq "98") {
$CHOOSEDPUBLISH{"ASSO"}=1;
}
else {
if ($NUM_SCRIPT eq "0") {
foreach my $key (@LISTETARGET) {
if ($key ne 'SNAPSHOT' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; }
}
else
{
if ($NUM_SCRIPT eq "99") {
$CHOOSEDPUBLISH{"SF"}=1;
}
else {
foreach my $num (split(/\s+/,$NUM_SCRIPT)) {
$CHOOSEDTARGET{$LISTETARGET[$num-1]}=1;
}
if ($NUM_SCRIPT eq "0") {
foreach my $key (@LISTETARGET) {
if ($key ne 'SNAPSHOT' && $key ne 'ASSO' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; }
}
}
else {
foreach my $num (split(/\s+/,$NUM_SCRIPT)) {
$CHOOSEDTARGET{$LISTETARGET[$num-1]}=1;
}
}
}
}
}
@ -301,10 +312,8 @@ foreach my $target (keys %CHOOSEDTARGET) {
}
foreach my $target (keys %CHOOSEDPUBLISH) {
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
if ($target eq 'SF')
{
$nbofpublishneedtag++;
}
if ($target eq 'ASSO') { $nbofpublishneedtag++; }
if ($target eq 'SF') { $nbofpublishneedtag++; }
$nboftargetok++;
}
@ -439,8 +448,8 @@ 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/_source`; # Keep this removal in case we embed libraries
$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/adapters`; # 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 -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
@ -502,8 +511,9 @@ if ($nboftargetok) {
$cmd="cp -pr \"$BUILDROOT/$PROJECT/\" \"$BUILDROOT/$FILENAMETGZ\"";
$ret=`$cmd`;
$ret=`rm -fr $BUILDROOT/$PROJECT/build/exe`;
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ/build/exe`;
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages
print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n";
$cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMETGZ.tgz\" $FILENAMETGZ";
$ret=`$cmd`;
@ -529,6 +539,9 @@ if ($nboftargetok) {
$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEXZ\"";
$ret=`$cmd`;
$ret=`rm -fr $BUILDROOT/$FILENAMEXZ/build/exe`;
$ret=`rm -fr $BUILDROOT/$FILENAMEXZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages
print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n";
print "Go to directory $BUILDROOT\n";
@ -560,6 +573,9 @@ if ($nboftargetok) {
$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEZIP\"";
$ret=`$cmd`;
$ret=`rm -fr $BUILDROOT/$FILENAMEZIP/build/exe`;
$ret=`rm -fr $BUILDROOT/$FILENAMEZIP/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages
print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n";
print "Go to directory $BUILDROOT\n";
@ -947,14 +963,14 @@ if ($nboftargetok) {
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
print "\nList of files to publish\n";
%filestoscan=(
%filestoscansf=(
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
);
foreach my $file (sort keys %filestoscan)
foreach my $file (sort keys %filestoscansf)
{
$found=0;
my $filesize = -s $file;
@ -963,10 +979,14 @@ if ($nboftargetok) {
print "\n";
}
if ($target eq 'SF')
if ($target eq 'SF' || $target eq 'ASSO')
{
print "\n";
if ($target eq 'SF') { $PUBLISH = $PUBLISHSTABLE; }
if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { $PUBLISH = $PUBLISHBETARC.'/lastbuild'; }
if ($target eq 'ASSO' && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $PUBLISHBETARC.'/stable'; }
$NEWPUBLISH=$PUBLISH;
print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n";
@ -977,6 +997,8 @@ if ($nboftargetok) {
print "Create empty dir /tmp/emptydir. We need it to create target dir using rsync.\n";
$ret=`mkdir -p "/tmp/emptydir/"`;
%filestoscan=%filestoscansf;
foreach my $file (sort keys %filestoscan)
{
$found=0;
@ -1001,6 +1023,7 @@ if ($nboftargetok) {
#$command="ssh eldy,dolibarr\@frs.sourceforge.net mkdir -p \"$destFolder\"";
#print "$command\n";
#my $ret=`$command 2>&1`;
$command="rsync -s -e 'ssh' --recursive /tmp/emptydir/ \"".$destFolder."\"";
print "$command\n";
my $ret=`$command 2>&1`;

View File

@ -103,6 +103,7 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr build/tgz/* $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz
%{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
@ -331,7 +332,7 @@ fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog
* Fri Feb 7 2014 Laurent Destailleur 3.6.0-0.2.b
* Fri Feb 21 2014 Laurent Destailleur 3.6.0-0.2.b
- Upstream release
* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3

View File

@ -166,6 +166,7 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr build/tgz/* $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz
%{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap
@ -306,6 +307,11 @@ done >>%{name}.lang
%post
echo Run post script of packager dolibarr_generic.spec
echo Detected constant fedora=0%{?fedora}
echo Detected constant rhel_version=0%{?rhel_version}
echo Detected constant centos_version=0%{?centos_version}
echo Detected constant mdkversion=0%{?mdkversion}
echo Detected constant suse_version=0%{?suse_version}
# Define vars
export docdir="/var/lib/dolibarr/documents"
@ -466,9 +472,12 @@ echo Restart mysql server
%else
%if 0%{?suse_version}
if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart
else
/sbin/service mysqld restart
#/etc/init.d/mysqld restart
fi
if [ -f /etc/init.d/mysql ]; then
/sbin/service mysql restart
#/etc/init.d/mysql restart
fi
%else
if [ -f /etc/init.d/mysqld ]; then
@ -559,7 +568,7 @@ fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog
* Mon Feb 7 2014 Laurent Destailleur 3.6.0-0.2.b
* Mon Feb 21 2014 Laurent Destailleur 3.6.0-0.2.b
- Upstream release
* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3

View File

@ -102,6 +102,7 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr build/tgz/* $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz
%{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
# Lang
@ -336,7 +337,7 @@ fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog
* Mon Feb 7 2014 Laurent Destailleur 3.6.0-0.2.b
* Mon Feb 21 2014 Laurent Destailleur 3.6.0-0.2.b
- Upstream release
* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3

View File

@ -103,6 +103,7 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr build/tgz/* $RPM_BUILD_ROOT%{_datadir}/%{name}/build/tgz
%{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
# Lang
@ -290,8 +291,9 @@ fi
# Restart mysql
echo Restart mysql
if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart
else
/sbin/service mysqld restart
fi
if [ -f /etc/init.d/mysql ]; then
/sbin/service mysql restart
fi
@ -346,7 +348,7 @@ fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog
* Mon Feb 7 2014 Laurent Destailleur 3.6.0-0.2.b
* Mon Feb 21 2014 Laurent Destailleur 3.6.0-0.2.b
- Upstream release
* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3

View File

@ -21,4 +21,4 @@ doli*.rpm
doli*.deb
doli*.zip
cvschangelogbuilder_dolibarr*
dolibarr_install.log
dolibarr_install.log

View File

@ -21,4 +21,4 @@ dolibarr*.rpm
dolibarr*.deb
dolibarr*.zip
cvschangelogbuilder_dolibarr*
dolibarr_install.log
dolibarr_install.log

View File

@ -0,0 +1,34 @@
#!/bin/sh
# Recursively deduplicate file lines on a per file basis
# Useful to deduplicate language files
#
# Needs awk 4.0 for the inplace fixing command
#
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Usage: deduplicatefilelinesrecursively.sh [list|fix]"
fi
# To detect
if [ "x$1" = "xlist" ]
then
for file in `find . -type f`
do
if [ `sort "$file" | uniq -d | wc -l` -gt 0 ]
then
echo "$file"
fi
done
fi
# To fix
if [ "x$1" = "xfix" ]
then
for file in `find . -type f`
do
awk -i inplace ' !x[$0]++' "$file"
done;
fi

21
dev/detectduplicatelangkey.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# Helps find duplicate translation keys in language files
#
# Copyright (C) 2014 Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
for file in `find . -type f`
do
dupes=$(
sed "s/^\s*//" "$file" | # Remove any leading whitespace
sed "s/\s*\=/=/" | # Remove any whitespace before =
grep -Po "(^.*?)=" | # Non greedeely match everything before =
sed "s/\=//" | # Remove trailing = so we get the key
sort | uniq -d # Find duplicates
)
if [ -n "$dupes" ]
then
echo "Duplicates found in $file"
echo "$dupes"
fi
done

File diff suppressed because one or more lines are too long

View File

@ -171,6 +171,7 @@ export list="
--ignore-table=$base.llx_abonne_extrafields
--ignore-table=$base.llx_abonne_type
--ignore-table=$base.llx_abonnement
--ignore-table=$base.llx_bootstrap
--ignore-table=$base.llx_bt_namemap
--ignore-table=$base.llx_bt_speedlimit
--ignore-table=$base.llx_bt_summary

View File

@ -115,7 +115,7 @@ class modMyModule extends DolibarrModules
// Array to add new pages in new tabs
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
// 'objecttype:-tabname':NU:conditiontoremove); // To remove an existing tab identified by code tabname
// 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
// where objecttype can be
// 'thirdparty' to add a tab in third party view
// 'intervention' to add a tab in intervention view

View File

@ -5,3 +5,9 @@ languages or to update translation files for existing languages.
See Dolibarr Wiki page:
http://wiki.dolibarr.org/index.php/Translator_documentation
For more informations on how to use them.
To install transifex client:
sudo pip install --upgrade transifex-client
To update transifex client:
sudo pip install --upgrade transifex-client

View File

@ -20,7 +20,7 @@ fi
if [ "x$1" = "xall" ]
then
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sq_AL sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW
do
echo "tx pull -l $fic $2 $3"
tx pull -l $fic $2 $3

View File

@ -20,7 +20,7 @@ fi
if [ "x$1" = "xall" ]
then
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sq_AL sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW
do
echo "tx push --skip -t -l $fic $2 $3"
tx push --skip -t -l $fic $2 $3

View File

@ -121,7 +121,7 @@ if ($action != 'create' && $action != 'edit')
/* ************************************************************************** */
/* */
/* Creation d'un champ optionnel */
/* Creation of an optional field */
/* */
/* ************************************************************************** */
@ -135,7 +135,7 @@ if ($action == 'create')
/* ************************************************************************** */
/* */
/* Edition d'un champ optionnel */
/* Edition of an optional field */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))

View File

@ -124,7 +124,7 @@ if ($action != 'create' && $action != 'edit')
/* ************************************************************************** */
/* */
/* Creation d'un champ optionnel */
/* Creation of an optional field */
/* */
/* ************************************************************************** */
@ -138,7 +138,7 @@ if ($action == 'create')
/* ************************************************************************** */
/* */
/* Edition d'un champ optionnel */
/* Edition of an optional field */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -330,54 +330,73 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$invoice=new Facture($db);
$customer=new Societe($db);
$result=$customer->fetch($object->fk_soc);
if ($result <= 0)
{
$errmsg=$customer->error;
$error++;
}
// Create draft invoice
$invoice->type= Facture::TYPE_STANDARD;
$invoice->cond_reglement_id=$customer->cond_reglement_id;
if (empty($invoice->cond_reglement_id))
if (! $error)
{
$paymenttermstatic=new PaymentTerm($db);
$invoice->cond_reglement_id=$paymenttermstatic->getDefaultId();
if (empty($invoice->cond_reglement_id))
{
$error++;
$errmsg='ErrorNoPaymentTermRECEPFound';
}
if (! ($object->fk_soc > 0))
{
$langs->load("errors");
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
$error++;
}
}
$invoice->socid=$object->fk_soc;
$invoice->date=$datecotisation;
$result=$invoice->create($user);
if ($result <= 0)
if (! $error)
{
$errmsg=$invoice->error;
$error++;
$result=$customer->fetch($object->fk_soc);
if ($result <= 0)
{
$errmsg=$customer->error;
$error++;
}
}
// Add line to draft invoice
$idprodsubscription=0;
$vattouse=0;
if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry')
if (! $error)
{
$vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription);
// Create draft invoice
$invoice->type= Facture::TYPE_STANDARD;
$invoice->cond_reglement_id=$customer->cond_reglement_id;
if (empty($invoice->cond_reglement_id))
{
$paymenttermstatic=new PaymentTerm($db);
$invoice->cond_reglement_id=$paymenttermstatic->getDefaultId();
if (empty($invoice->cond_reglement_id))
{
$error++;
$errmsg='ErrorNoPaymentTermRECEPFound';
}
}
$invoice->socid=$object->fk_soc;
$invoice->date=$datecotisation;
$result=$invoice->create($user);
if ($result <= 0)
{
$errmsg=$invoice->error;
$error++;
}
}
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
$result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datecotisation,$datesubend,0,0,'','TTC',$cotisation,1);
if ($result <= 0)
if (! $error)
{
$errmsg=$invoice->error;
$error++;
// Add line to draft invoice
$idprodsubscription=0;
$vattouse=0;
if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry')
{
$vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription);
}
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
$result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datecotisation,$datesubend,0,0,'','TTC',$cotisation,1);
if ($result <= 0)
{
$errmsg=$invoice->error;
$error++;
}
// Validate invoice
$result=$invoice->validate($user);
}
// Validate invoice
$result=$invoice->validate($user);
// Add payment onto invoice
if ($option == 'bankviainvoice' && $accountid)
{
@ -486,8 +505,8 @@ if ($rowid)
dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user');
$rowspan=9;
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan+=1;
$rowspan=10;
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
if (! empty($conf->societe->enabled)) $rowspan++;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -764,9 +783,9 @@ if ($rowid)
}
else
{
if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled) && $object->fk_soc) $bankviainvoice=1;
if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $bankviainvoice=1;
else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && ! empty($conf->banque->enabled)) $bankdirect=1;
else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled) && $object->fk_soc) $invoiceonly=1;
else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $invoiceonly=1;
}
print "\n\n<!-- Form add subscription -->\n";
@ -917,12 +936,14 @@ if ($rowid)
if (! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
{
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(! empty($invoiceonly)?' checked="checked"':'');
if (empty($object->fk_soc)) print ' disabled="disabled"';
//if (empty($object->fk_soc)) print ' disabled="disabled"';
print '> '.$langs->trans("MoreActionInvoiceOnly");
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
else
{
print ' ('.$langs->trans("NoThirdPartyAssociatedToMember");
print ' (';
if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
print $langs->trans("NoThirdPartyAssociatedToMember");
print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
print $langs->trans("CreateDolibarrThirdParty");
print '</a>)';
@ -934,12 +955,14 @@ if ($rowid)
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
{
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(! empty($bankviainvoice)?' checked="checked"':'');
if (empty($object->fk_soc)) print ' disabled="disabled"';
//if (empty($object->fk_soc)) print ' disabled="disabled"';
print '> '.$langs->trans("MoreActionBankViaInvoice");
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
else
{
print ' ('.$langs->trans("NoThirdPartyAssociatedToMember");
print ' (';
if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
print $langs->trans("NoThirdPartyAssociatedToMember");
print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
print $langs->trans("CreateDolibarrThirdParty");
print '</a>)';

View File

@ -183,7 +183,7 @@ if ($resql)
if ($type > 0)
{
$membertype=new AdherentType($db);
$result=$membertype->fetch($_REQUEST["type"]);
$result=$membertype->fetch(GETPOST("type"));
$titre.=" (".$membertype->libelle.")";
}
@ -193,6 +193,7 @@ if ($resql)
if ($search_login) $param.="&search_login=".$search_login;
if ($search_email) $param.="&search_email=".$search_email;
if ($filter) $param.="&filter=".$filter;
if ($type > 0) $param.="&type=".$type;
print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
if ($sall)

View File

@ -1,4 +1,4 @@
<?php
<?php //ligne 86
/* Copyright (c) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -60,6 +60,8 @@ $title=$langs->trans("Statistics");
if ($mode == 'memberbycountry') $title=$langs->trans("MembersStatisticsByCountries");
if ($mode == 'memberbystate') $title=$langs->trans("MembersStatisticsByState");
if ($mode == 'memberbytown') $title=$langs->trans("MembersStatisticsByTown");
if ($mode == 'memberbyregion') $title=$langs->trans("MembersStatisticsByRegion");
print_fiche_titre($title, $mesg);
@ -67,7 +69,7 @@ dol_mkdir($dir);
if ($mode)
{
// Define sql
// Define sql
if ($mode == 'memberbycountry')
{
$label=$langs->trans("Country");
@ -81,14 +83,15 @@ if ($mode)
$sql.=" GROUP BY c.libelle, c.code";
//print $sql;
}
if ($mode == 'memberbystate')
if ($mode == 'memberbystate')
{
$label=$langs->trans("Country");
$label2=$langs->trans("State");
$tab='statsstate';
$data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.code, p.libelle as label, c.nom as label2";
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.code, p.libelle as label, c.nom as label2"; //
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p on d.country = p.rowid";
@ -97,6 +100,22 @@ if ($mode)
$sql.=" GROUP BY p.libelle, p.code, c.nom";
//print $sql;
}
if ($mode == 'memberbyregion') //
{
$label=$langs->trans("Country"); //pays
$label2=$langs->trans("Region"); //département
$tab='statsregion'; //onglet
$data = array(); //tableau de donnée
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.code, p.libelle as label, r.nom as label2";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p on d.country = p.rowid";
$sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY p.libelle, p.code, r.nom"; //+
//print $sql;
}
if ($mode == 'memberbytown')
{
$label=$langs->trans("Country");
@ -137,6 +156,15 @@ if ($mode)
'lastdate'=>$db->jdate($obj->lastdate)
);
}
if ($mode == 'memberbyregion') //+
{
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
);
}
if ($mode == 'memberbystate')
{
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
@ -183,6 +211,7 @@ else
if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'<br>';
else if ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'<br>';
else if ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'<br>';
else if ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'<br>';//+
else
{
print $langs->trans("MembersStatisticsDesc").'<br>';
@ -192,6 +221,8 @@ else
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbystate">'.$langs->trans("MembersStatisticsByState").'</a><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>';
print '<br>';//+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>';//+
}
print '<br>';
}
@ -249,7 +280,7 @@ if (count($arrayjs) && $mode == 'memberbycountry')
if ($mode)
{
// Print array
// Print array / Affiche le tableau
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td align="center">'.$label.'</td>';

View File

@ -305,7 +305,7 @@ if ($action == 'edit' || $action == 'updateedit')
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyCurrency").'</td><td>';
$form->select_currency($conf->currency,"currency");
print $form->selectCurrency($conf->currency,"currency");
print '</td></tr>'."\n";
$var=!$var;
@ -381,7 +381,7 @@ if ($action == 'edit' || $action == 'updateedit')
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ManagingDirectors").'</td><td>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" size="80" value="' . $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '"></td></tr>';
// Capital
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>';
@ -530,7 +530,7 @@ if ($action == 'edit' || $action == 'updateedit')
$var=true;
$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" value=\"reel\"".($conf->global->FACTURE_TVAOPTION != "franchise"?" checked":"")."> ".$langs->trans("VATIsUsed")."</label></td>";
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->trans("VATIsUsedDesc")."</td></tr>";
@ -539,7 +539,7 @@ if ($action == 'edit' || $action == 'updateedit')
print "</td></tr>\n";
$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" value=\"franchise\"".($conf->global->FACTURE_TVAOPTION == "franchise"?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->trans("VATIsNotUsedDesc")."</td></tr>";
@ -746,7 +746,7 @@ else
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ManagingDirectors").'</td><td>';
print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '</td></tr>';
// Capital
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>';
@ -913,7 +913,7 @@ else
$var=true;
$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optiontva\" disabled value=\"reel\"".($conf->global->FACTURE_TVAOPTION != "franchise"?" checked":"")."> ".$langs->trans("VATIsUsed")."</label></td>";
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optiontva\" disabled value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->trans("VATIsUsedDesc")."</td></tr>";
@ -922,7 +922,7 @@ else
print "</td></tr>\n";
$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optiontva\" disabled value=\"franchise\"".($conf->global->FACTURE_TVAOPTION == "franchise"?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optiontva\" disabled value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->trans("VATIsNotUsedDesc")."</td></tr>";

View File

@ -167,8 +167,27 @@ else
$editor=new DolEditor('formtestfield',isset($conf->global->FCKEDITOR_TEST)?$conf->global->FCKEDITOR_TEST:'Test','',200,$mode,'In', true, $uselocalbrowser, 1, 120, 8, $readonly);
$editor->Create();
print '<center><br><input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"></center>'."\n";
print '<div id="divforlog"></div>';
print '</form>'."\n";
// Add env of ckeditor
// This is to show how CKEditor detect browser to understand why editor is disabled or not
if (1 == 2) // Change this to enable output
{
print '<br><script language="javascript">
function jsdump(obj, id) {
var out = \'\';
for (var i in obj) {
out += i + ": " + obj[i] + "<br>\n";
}
jQuery("#"+id).html(out);
}
jsdump(CKEDITOR.env, "divforlog");
</script>';
}
/*
print '<!-- Result -->';
print $_POST["formtestfield"];

View File

@ -51,6 +51,9 @@ if ($action == "set")
if (! $res > 0) $error++;
}
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int');
$account = new Account($db, $id);
@ -148,6 +151,13 @@ print '<tr class="impair"><td>'.$langs->trans("BankToReceiveWithdraw").'</td>';
print '<td align="left">';
print $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1);
print '</td></tr>';
// ICS
print '<tr class="impair"><td>'.$langs->trans("ICS").'</td>';
print '<td align="left">';
print '<input type="text" name="PRELEVEMENT_ICS" value="'.$conf->global->PRELEVEMENT_ICS.'" size="9" ></td>';
print '</td></tr>';
print '</table>';
print '<br>';

View File

@ -50,7 +50,7 @@ if (! $user->admin)
if ($action == 'delete')
{
$file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile');
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');

View File

@ -58,7 +58,7 @@ if ($file && ! $what)
if ($action == 'delete')
{
$file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile');
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
@ -451,46 +451,53 @@ function backup_tables($outputfile, $tables='*')
//fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
$row2 = $db->fetch_row($resqldrop);
fwrite($handle,$row2[1].";\n");
//fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
// Dumping the data (locking the table and disabling the keys check while doing the process)
fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
$sql='SELECT * FROM '.$table;
$result = $db->query($sql);
$num_fields = $db->num_rows($result);
while($row = $db->fetch_row($result)) {
// For each row of data we print a line of INSERT
fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES (');
$columns = count($row);
for($j=0; $j<$columns; $j++) {
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
if ($row[$j] == null and !is_string($row[$j])) {
// IMPORTANT: if the field is NULL we set it NULL
$row[$j] = 'NULL';
} elseif(is_string($row[$j]) and $row[$j] == '') {
// if it's an empty string, we set it as an empty string
$row[$j] = "''";
} elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
// if it's a number, we return it as-is
$row[$j] = $row[$j];
} else { // else for all other cases we escape the value and put quotes around
$row[$j] = addslashes($row[$j]);
$row[$j] = preg_replace("#\n#", "\\n", $row[$j]);
$row[$j] = "'".$row[$j]."'";
}
}
fwrite($handle,implode(',', $row).");\n");
if (empty($row2[1]))
{
fwrite($handle, "\n-- WARNING: Show create table ".$table." return empy string when it should not.\n");
}
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking
if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table
fwrite($handle,"\n\n\n");
}
else
{
fwrite($handle,$row2[1].";\n");
//fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
// Dumping the data (locking the table and disabling the keys check while doing the process)
fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
$sql='SELECT * FROM '.$table;
$result = $db->query($sql);
$num_fields = $db->num_rows($result);
while($row = $db->fetch_row($result))
{
// For each row of data we print a line of INSERT
fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES (');
$columns = count($row);
for($j=0; $j<$columns; $j++) {
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
if ($row[$j] == null and !is_string($row[$j])) {
// IMPORTANT: if the field is NULL we set it NULL
$row[$j] = 'NULL';
} elseif(is_string($row[$j]) and $row[$j] == '') {
// if it's an empty string, we set it as an empty string
$row[$j] = "''";
} elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
// if it's a number, we return it as-is
$row[$j] = $row[$j];
} else { // else for all other cases we escape the value and put quotes around
$row[$j] = addslashes($row[$j]);
$row[$j] = preg_replace("#\n#", "\\n", $row[$j]);
$row[$j] = "'".$row[$j]."'";
}
}
fwrite($handle,implode(',', $row).");\n");
}
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking
if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table
fwrite($handle,"\n\n\n");
}
}
/* Backup Procedure structure*/
/*
$result = $db->query('SHOW PROCEDURE STATUS');

View File

@ -270,7 +270,7 @@ print '<div class="tagtable">';
print ' <div class="tagtr">';
print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' &nbsp; ';
print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels=array();
foreach(array_keys($_Avery_Labels) as $codecards)
@ -284,7 +284,7 @@ print '</div></div>';
print ' <div class="tagtr">';
print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
print $langs->trans("NumberOfStickers").' &nbsp; ';
print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
print '<input size="4" type="text" name="numberofsticker" value="'.(GETPOST('numberofsticker')?GETPOST('numberofsticker','int'):10).'">';
print '</div></div>';

View File

@ -333,6 +333,20 @@ class Categorie extends CommonObject
$this->db->begin();
/* FIX #1317 : Check for child cat and move up 1 level*/
if (! $error)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
$sql.= " SET fk_parent = ".$this->fk_parent;
$sql.= " WHERE fk_parent = ".$this->id;
if (!$this->db->query($sql))
{
$this->error=$this->db->lasterror();
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
$error++;
}
}
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_societe";

View File

@ -538,7 +538,7 @@ if ($action == 'create')
// Busy
print '<tr><td width="30%" class="nowrap">'.$langs->trans("Busy").'</td><td>';
print '<input id="transparency" type="checkbox" name="transparency" value="'.$object->transparency.'">';
print '<input id="transparency" type="checkbox" name="transparency"'.($actioncomm->transparency?' checked="checked"':'').'>';
print '</td></tr>';
// Realised by

View File

@ -312,7 +312,7 @@ $sql.= ' FROM ('.MAIN_DB_PREFIX.'c_actioncomm as ca,';
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a)";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= ' WHERE a.fk_action = ca.id';
$sql.= ' AND a.entity IN ('.getEntity().')';
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";

View File

@ -381,7 +381,7 @@ if ($id > 0)
print '<td colspan="3">';
$amount_discount=$object->getAvailableDiscounts();
if ($amount_discount < 0) dol_print_error($db,$object->error);
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount).'</a>&nbsp;'.$langs->trans("Currency".$conf->currency);
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount,1,$langs,1,-1,-1,$conf->currency).'</a>';
else print $langs->trans("DiscountNone");
print '</td>';
print '</tr>';

View File

@ -8,7 +8,7 @@
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1187,12 +1187,12 @@ if ($action == 'create') {
// What trigger creation
print '<tr><td>' . $langs->trans('Source') . '</td><td>';
$form->select_demand_reason('', 'demand_reason_id', "SRC_PROP", 1);
$form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1);
print '</td></tr>';
// Delivery delay
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
$form->select_availability('', 'availability_id', '', 1);
$form->selectAvailabilityDelay('', 'availability_id', '', 1);
print '</td></tr>';
// Delivery date (or manufacturing)
@ -1465,7 +1465,7 @@ if ($action == 'create') {
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
if ($absolute_discount) {
if ($object->statut > 0) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount, 0, $langs, 0, 0, -1, $conf->currency));
} else {
// Remise dispo de type non avoir
$filter = 'fk_facture_source IS NULL';
@ -1474,7 +1474,7 @@ if ($action == 'create') {
}
}
if ($absolute_creditnote) {
print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '. ';
print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote, 0, $langs, 0, 0, -1, $conf->currency)) . '. ';
}
if (! $absolute_discount && ! $absolute_creditnote)
print $langs->trans("CompanyHasNoAbsoluteDiscount") . '.';
@ -1604,13 +1604,11 @@ if ($action == 'create') {
print '<td align="right"><a href="' . $_SERVER ["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
// print $object->demand_reason_id;
if ($action == 'editdemandreason') {
$form->form_demand_reason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
$form->formInputReason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
} else {
$form->form_demand_reason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
$form->formInputReason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
}
print '</td>';
print '</tr>';

View File

@ -2298,51 +2298,23 @@ class Propal extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
function LibStatut($statut,$mode=1)
function LibStatut($statut,$mode=1)
{
global $langs;
$langs->load("propal");
global $langs;
$langs->load("propal");
if ($mode == 0)
{
return $this->labelstatut[$statut];
}
if ($mode == 1)
{
return $this->labelstatut_short[$statut];
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans('PropalStatusDraftShort'),'statut0').' '.$this->labelstatut_short[$statut];
if ($statut==1) return img_picto($langs->trans('PropalStatusOpenedShort'),'statut1').' '.$this->labelstatut_short[$statut];
if ($statut==2) return img_picto($langs->trans('PropalStatusSignedShort'),'statut3').' '.$this->labelstatut_short[$statut];
if ($statut==3) return img_picto($langs->trans('PropalStatusNotSignedShort'),'statut5').' '.$this->labelstatut_short[$statut];
if ($statut==4) return img_picto($langs->trans('PropalStatusBilledShort'),'statut6').' '.$this->labelstatut_short[$statut];
}
if ($mode == 3)
{
if ($statut==0) return img_picto($langs->trans('PropalStatusDraftShort'),'statut0');
if ($statut==1) return img_picto($langs->trans('PropalStatusOpenedShort'),'statut1');
if ($statut==2) return img_picto($langs->trans('PropalStatusSignedShort'),'statut3');
if ($statut==3) return img_picto($langs->trans('PropalStatusNotSignedShort'),'statut5');
if ($statut==4) return img_picto($langs->trans('PropalStatusBilledShort'),'statut6');
}
if ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans('PropalStatusDraft'),'statut0').' '.$this->labelstatut[$statut];
if ($statut==1) return img_picto($langs->trans('PropalStatusOpened'),'statut1').' '.$this->labelstatut[$statut];
if ($statut==2) return img_picto($langs->trans('PropalStatusSigned'),'statut3').' '.$this->labelstatut[$statut];
if ($statut==3) return img_picto($langs->trans('PropalStatusNotSigned'),'statut5').' '.$this->labelstatut[$statut];
if ($statut==4) return img_picto($langs->trans('PropalStatusBilled'),'statut6').' '.$this->labelstatut[$statut];
}
if ($mode == 5)
{
if ($statut==0) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($langs->trans('PropalStatusDraftShort'),'statut0');
if ($statut==1) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($langs->trans('PropalStatusOpenedShort'),'statut1');
if ($statut==2) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($langs->trans('PropalStatusSignedShort'),'statut3');
if ($statut==3) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($langs->trans('PropalStatusNotSignedShort'),'statut5');
if ($statut==4) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($langs->trans('PropalStatusBilledShort'),'statut6');
}
if ($statut==0) $statuttrans='statut0';
if ($statut==1) $statuttrans='statut1';
if ($statut==2) $statuttrans='statut3';
if ($statut==3) $statuttrans='statut5';
if ($statut==4) $statuttrans='statut6';
if ($mode == 0) return $this->labelstatut[$statut];
if ($mode == 1) return $this->labelstatut_short[$statut];
if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut];
if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans);
if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut];
if ($mode == 5) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($this->labelstatut_short[$statut],$statuttrans);
}

View File

@ -308,7 +308,7 @@ if ($result)
print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">';
print '</td>';
print '<td class="liste_titre" align="right">';
$formpropal->select_propal_statut($viewstatut,1);
$formpropal->selectProposalStatus($viewstatut,1);
print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';

View File

@ -544,9 +544,9 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
// Clean parameters
$date_start = dol_mktime(0, 0, 0, GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
$date_end = dol_mktime(0, 0, 0, GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
$price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT');
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
@ -735,13 +735,13 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
*/
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) {
// Clean parameters
$date_start = '';
$date_end = '';
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc'));
$pu_ht = GETPOST('price_ht');
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$date_start='';
$date_end='';
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description=dol_htmlcleanlastbr(GETPOST('product_desc'));
$pu_ht=GETPOST('price_ht');
$vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
// Define info_bits
$info_bits = 0;
@ -1446,12 +1446,12 @@ if ($action == 'create' && $user->rights->commande->creer) {
// Delivery delay
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
$form->select_availability($availability_id, 'availability_id', '', 1);
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1);
print '</td></tr>';
// What trigger creation
print '<tr><td>' . $langs->trans('Source') . '</td><td colspan="2">';
$form->select_demand_reason($demand_reason_id, 'demand_reason_id', '', 1);
$form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1);
print '</td></tr>';
// Project
@ -1648,7 +1648,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
// => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
// 'value' => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'), 'idwarehouse', '', 1)));
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
}
$formconfirm = $form->formconfirm($_SERVER ["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
@ -1668,7 +1668,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
// => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
// 'value' => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'), 'idwarehouse', '', 1)));
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
}
$formconfirm = $form->formconfirm($_SERVER ["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220);
@ -1697,7 +1697,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
// => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
// 'value' => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'), 'idwarehouse', '', 1)));
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
}
$formconfirm = $form->formconfirm($_SERVER ["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Cancel'), $text, 'confirm_cancel', $formquestion, 0, 1);
@ -1929,9 +1929,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editdemandreason') {
$form->form_demand_reason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
$form->formInputReason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
} else {
$form->form_demand_reason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
$form->formInputReason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
}
// Removed because using dictionary is an admin feature, not a user feature. Ther is already the "star" to show info to admin users.
// This is to avoid too heavy screens and have an uniform look and feel for all screens.

View File

@ -53,7 +53,7 @@ $confirm=GETPOST('confirm','alpha');
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
$fieldtype = (! empty($ref) ? 'ref' :'rowid');
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype);
$result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype);
$paiementtype=GETPOST('paiementtype','alpha',3);
$req_nb=GETPOST("req_nb",'',3);

View File

@ -43,7 +43,7 @@ if (isset($_GET["id"]) || isset($_GET["ref"]))
}
$fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid);
$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid);
/*

View File

@ -44,7 +44,7 @@ if (isset($_GET["id"]) || isset($_GET["ref"]))
}
$fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid);
$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid);
/*
@ -256,7 +256,7 @@ if ($action == 'create')
print '<td colspan="3">';
$selectedcode=$account->account_currency_code;
if (! $selectedcode) $selectedcode=$conf->currency;
$form->select_currency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
//print $langs->trans("Currency".$conf->currency);
//print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
print '</td></tr>';
@ -325,7 +325,7 @@ if ($action == 'create')
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
print '<td colspan="3">';
$form->select_date(time(), 're', 0, 0, 0, 'formsoc');
$form->select_date('', 're', 0, 0, 0, 'formsoc');
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
@ -374,7 +374,7 @@ else
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
}
print '<table class="border" width="100%">';
@ -531,7 +531,7 @@ else
print '<td colspan="3">';
$selectedcode=$account->account_currency_code;
if (! $selectedcode) $selectedcode=$conf->currency;
$form->select_currency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
//print $langs->trans("Currency".$conf->currency);
//print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
print '</td></tr>';

View File

@ -41,7 +41,7 @@ if (isset($_GET["account"]) || isset($_GET["ref"]))
}
$fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid);
$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid);
$account=$_GET["account"];
$mode='standard';

View File

@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copytight (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copytight (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
*
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
$langs->load("banks");
$langs->load("categories");
@ -43,14 +45,20 @@ $credit=GETPOST("credit");
$type=GETPOST("type");
$account=GETPOST("account");
$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'));
$param='';
if ($description) $param.='&description='.$description;
if ($type) $param.='&type='.$type;
if ($debit) $param.='&debit='.$debit;
if ($credit) $param.='&credit='.$credit;
if ($account) $param.='&account='.$account;
if ($bid) $param.='&bid='.$bid;
if (!empty($description)) $param.='&description='.$description;
if (!empty($type)) $param.='&type='.$type;
if (!empty($debit)) $param.='&debit='.$debit;
if (!empty($credit)) $param.='&credit='.$credit;
if (!empty($account)) $param.='&account='.$account;
if (!empty($bid)) $param.='&bid='.$bid;
if (dol_strlen($search_dt_start) > 0)
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
if (dol_strlen($search_dt_end) > 0)
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@ -74,6 +82,7 @@ $bankaccountstatic=new Account($db);
llxHeader();
$form = new Form($db);
$formother = new FormOther($db);
if ($vline) $viewline = $vline;
else $viewline = 50;
@ -108,6 +117,13 @@ if (! empty($type))
{
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
}
//Search period criteria
if (dol_strlen($search_dt_start)>0) {
$sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
}
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));
@ -128,6 +144,7 @@ $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1,$offset);
//print $sql;
dol_syslog('compta/bank/search.php:: sql='.$sql);
$resql = $db->query($sql);
if ($resql)
{
@ -147,6 +164,19 @@ if ($resql)
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
}
print '<form method="post" action="search.php" name="search_form">';
$moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('DateOperationShort') . ': ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1);
$moreforfilter .= $langs->trans('PeriodEndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1);
if ($moreforfilter) {
print '<div class="liste_titre">';
print $moreforfilter;
print '</div>';
}
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
@ -161,7 +191,6 @@ if ($resql)
print '<td class="liste_titre" align="left"> &nbsp; '.$langs->trans("Account").'</td>';
print "</tr>\n";
print '<form method="post" action="search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
@ -189,6 +218,8 @@ if ($resql)
print '</tr>';
// Loop on each record
$total_debit=0;
$total_credit=0;
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
@ -259,10 +290,12 @@ if ($resql)
if ($objp->amount < 0)
{
print "<td align=\"right\">".price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
$total_debit+=$objp->amount;
}
else
{
print "<td>&nbsp;</td><td align=\"right\">".price($objp->amount)."</td>\n";
$total_credit+=$objp->amount;
}
// Bank account
@ -275,6 +308,15 @@ if ($resql)
}
$i++;
}
if ($num>0) {
print '<tr class="liste_total">';
print '<td>' . $langs->trans('Total') . '</td>';
print '<td colspan="6"></td>';
print '<td align="right">' . price($total_debit * - 1) . '</td>';
print '<td align="right">' . price($total_credit) . '</td>';
print '<td></td>';
print '</tr>';
}
print "</table>";
@ -285,7 +327,7 @@ else
dol_print_error($db);
}
// Si acc<63>s issu d'une recherche et rien de trouv<75>
// If no data to display after a search
if ($_POST["action"] == "search" && ! $num)
{
print $langs->trans("NoRecordFound");

View File

@ -42,7 +42,7 @@ if (isset($_GET["account"]) || isset($_GET["ref"]))
}
$fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid);
$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid);
$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"];

View File

@ -180,15 +180,18 @@ if ($conf->tax->enabled)
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT c.id, c.libelle as lib,";
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye";
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment,";
$sql.= " pct.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
$sql.= " WHERE cs.fk_type = c.id";
$sql.= " AND cs.entity = ".$conf->entity;
if ($year > 0)
@ -241,19 +244,27 @@ if ($conf->tax->enabled)
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
// Date payment
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day').'</td>';
// Type payment
print '<td>';
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
print $obj->num_payment.'</td>';
// Paid
print '<td align="right">'.price($obj->totalpaye).'</td>';
print '<td align="right">';
if ($obj->totalpaye) print price($obj->totalpaye);
print '</td>';
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$i++;
}
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="right">'.price($totalpaye)."</td>";
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td align="right" class="liste_total">'.price($total)."</td>";
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="right" class="liste_total">'.price($totalpaye)."</td>";
print "</tr>";
}
else

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/compta/deplacement/stats/index.php
* \ingroup deplacement
* \brief Page des stats deplacement et notes de frais
* \brief Page for statistics of module trips and expenses
*/
require '../../../main.inc.php';

View File

@ -181,8 +181,8 @@ if ($resql)
print '<td class="nobordernopadding">';
print $obj->societe;
print ($obj->societe && $obj->nom?' / ':'');
print dolGetFirstLastname($obj->nom,$obj->firstname);
print ($obj->societe && ($obj->lastname || $obj->firstname)?' / ':'');
print dolGetFirstLastname($obj->lastname,$obj->firstname);
print '</td>';
print '<td align="right" class="nobordernopadding">';

View File

@ -52,6 +52,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$langs->load('bills');
$langs->load('companies');
$langs->load('compta');
$langs->load('products');
$langs->load('banks');
$langs->load('main');
@ -336,7 +337,8 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
}
// Classify to validated
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider) {
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
{
$idwarehouse = GETPOST('idwarehouse');
$object->fetch($id);
@ -345,8 +347,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
// Check parameters
// Check for mandatory prof id
for($i = 1; $i < 5; $i ++) {
for($i = 1; $i < 6; $i ++)
{
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
$idprof = 'idprof' . $i;
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) {
@ -374,9 +376,11 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
}
}
if (! $error) {
if (! $error)
{
$result = $object->validate($user, '', $idwarehouse);
if ($result >= 0) {
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang = '';
@ -393,7 +397,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
} else {
setEventMessage($object->error, 'errors');
if (count($object->errors)) setEventMessage($object->errors, 'errors');
else setEventMessage($object->error, 'errors');
}
}
}
@ -500,7 +505,7 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
{
$object->fetch($id);
$object->fetch_thirdparty();
$object->fetch_lines();
//$object->fetch_lines(); // Already done into fetch
// Check if there is already a discount (protection to avoid duplicate creation when resubmit post)
$discountcheck=new DiscountAbsolute($db);
@ -673,13 +678,14 @@ else if ($action == 'add' && $user->rights->facture->creer)
$id = $object->create($user);
if(GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0) {
if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0)
{
$facture_source = new Facture($db); // fetch origin object
if($facture_source->fetch($object->fk_facture_source)>0) {
foreach($facture_source->lines as $line) {
if ($facture_source->fetch($object->fk_facture_source)>0)
{
foreach($facture_source->lines as $line)
{
$line->fk_facture = $object->id;
$line->subprice =-$line->subprice; // invert price for object
@ -729,14 +735,16 @@ else if ($action == 'add' && $user->rights->facture->creer)
}
// Standard invoice or Deposit invoice created from a Predefined invoice
if (($_POST['type'] == 0 || $_POST['type'] == 3) && $_POST['fac_rec'] > 0) {
if (($_POST['type'] == 0 || $_POST['type'] == 3) && $_POST['fac_rec'] > 0)
{
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) {
$error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
}
if (! $error) {
if (! $error)
{
$object->socid = GETPOST('socid', 'int');
$object->type = $_POST['type'];
$object->number = $_POST['facnumber'];
@ -755,8 +763,10 @@ else if ($action == 'add' && $user->rights->facture->creer)
}
// Standard or deposit or proforma invoice
if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0) {
if (GETPOST('socid', 'int') < 1) {
if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0)
{
if (GETPOST('socid', 'int') < 1)
{
$error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
}
@ -767,7 +777,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
}
if (! $error) {
if (! $error)
{
// Si facture standard
$object->socid = GETPOST('socid', 'int');
$object->type = GETPOST('type');
@ -1032,7 +1043,9 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$error = 0;
// Set if we used free entry or predefined product
if (GETPOST('addline_libre'))
if (GETPOST('addline_libre')
|| (GETPOST('dp_desc') && ! GETPOST('addline_libre') && ! GETPOST('idprod', 'int')>0) // we push enter onto qty field
)
{
$predef = '';
$idprod = 0;
@ -1040,7 +1053,9 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$price_ht = GETPOST('price_ht');
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
}
if (GETPOST('addline_predefined'))
if (GETPOST('addline_predefined')
|| (! GETPOST('dp_desc') && ! GETPOST('addline_predefined') && GETPOST('idprod', 'int')>0) // we push enter onto qty field
)
{
$predef = (($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
$idprod = GETPOST('idprod', 'int');
@ -1863,22 +1878,26 @@ if ($action == 'create')
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (! empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
$remise_percent = (! empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (! empty($soc->remise_percent) ? $soc->remise_percent : 0));
$remise_absolue = (! empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (! empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options = $objectsrc->array_options;
}
} else {
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : ''; // Dot not set 0 here (0 for a date is 1970)
}
else
{
$cond_reglement_id = $soc->cond_reglement_id;
$mode_reglement_id = $soc->mode_reglement_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : ''; // Do not set 0 here (0 for a date is 1970)
}
$absolute_discount = $soc->getAvailableDiscounts();
if (! empty($conf->use_javascript_ajax)) {
if (! empty($conf->use_javascript_ajax))
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
print ajax_combobox('fac_replacement');
print ajax_combobox('fac_avoir');
}
@ -2008,7 +2027,7 @@ if ($action == 'create')
// Standard invoice
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="0"' . (GETPOST('type') == 0 ? ' checked="checked"' : '') . '>';
print '<input type="radio" id="radio_standard" name="type" value="0"' . (GETPOST('type') == 0 ? ' checked="checked"' : '') . '>';
print '</td><td valign="middle">';
$desc = $form->textwithpicto($langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1);
print $desc;
@ -2095,10 +2114,18 @@ if ($action == 'create')
print ' disabled="disabled"';
print '>';
print '</td><td valign="top">';
// Show credit note options only if we checked credit note
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#fac_avoir").click(function() {
jQuery("#radio_creditnote").attr(\'checked\',\'checked\');
if (! jQuery("#radio_creditnote").attr(\'checked\'))
{
jQuery("#credit_note_options").hide();
}
jQuery("#radio_creditnote").click(function() {
jQuery("#credit_note_options").show();
});
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() {
jQuery("#credit_note_options").hide();
});
});
</script>';
@ -2118,8 +2145,10 @@ if ($action == 'create')
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1);
print $desc;
print '<div id="credit_note_options">';
print '&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').attr(\'checked\',\'checked\'); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked="checked"':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
print '<br />&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').attr(\'checked\',\'checked\'); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked="checked"':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').attr(\'checked\',\'checked\'); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked="checked"':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '</div>';
print '</td></tr>' . "\n";
}
@ -2436,7 +2465,7 @@ if ($action == 'create')
// 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value'
// => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'), 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"))));
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"))));
$formconfirm = $form->formconfirm($_SERVER ['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1);
} else {
$formconfirm = $form->formconfirm($_SERVER ['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', '', 1);
@ -2487,7 +2516,7 @@ if ($action == 'create')
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse'), 'idwarehouse', '', 1);
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1);
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
@ -2527,7 +2556,7 @@ if ($action == 'create')
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse'), 'idwarehouse', '', 1);
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1);
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
@ -3303,9 +3332,11 @@ if ($action == 'create')
dol_fiche_end();
// Boutons actions
if ($action != 'prerelance' && $action != 'presend' && $action != 'valid' && $action != 'editline') {
// Actions buttons
if ($action != 'prerelance' && $action != 'presend' && $action != 'valid' && $action != 'editline')
{
print '<div class="tabsAction">';
$parameters = array();
@ -3353,7 +3384,7 @@ if ($action == 'create')
}
// Send by mail
if (($object->statut == 1 || $object->statut == 2)) {
if (($object->statut == 1 || $object->statut == 2) || ! empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($objectidnext) {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('SendByMail') . '</span></div>';
} else {

View File

@ -866,7 +866,6 @@ class Facture extends CommonInvoice
$this->datem = $this->db->jdate($obj->datem);
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
//$this->remise = $obj->remise;
$this->total_ht = $obj->total;
$this->total_tva = $obj->tva;
$this->total_localtax1 = $obj->localtax1;
@ -947,7 +946,7 @@ class Facture extends CommonInvoice
$this->lines=array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.rang, l.special_code,';
$sql.= ' l.date_start as date_start, l.date_end as date_end,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
@ -1007,10 +1006,6 @@ class Facture extends CommonInvoice
$line->special_code = $objp->special_code;
$line->fk_parent_line = $objp->fk_parent_line;
// Ne plus utiliser
//$line->price = $objp->price;
//$line->remise = $objp->remise;
$this->lines[$i] = $line;
$i++;
@ -1069,7 +1064,6 @@ class Facture extends CommonInvoice
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").",";
$sql.= " remise_percent=".(isset($this->remise_percent)?$this->remise_percent:"null").",";
$sql.= " remise_absolue=".(isset($this->remise_absolue)?$this->remise_absolue:"null").",";
//$sql.= " remise=".(isset($this->remise)?$this->remise:"null").",";
$sql.= " close_code=".(isset($this->close_code)?"'".$this->db->escape($this->close_code)."'":"null").",";
$sql.= " close_note=".(isset($this->close_note)?"'".$this->db->escape($this->close_note)."'":"null").",";
$sql.= " tva=".(isset($this->total_tva)?$this->total_tva:"null").",";
@ -1276,6 +1270,16 @@ class Facture extends CommonInvoice
}
// Fin appel triggers
}
// Removed extrafields
if (! $error) {
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR);
}
}
if (! $error)
{
@ -2223,16 +2227,6 @@ class Facture extends CommonInvoice
$pu_tva = $tabprice[4];
$pu_ttc = $tabprice[5];
// Old properties: $price, $remise (deprecated)
$price = $pu;
$remise = 0;
if ($remise_percent > 0)
{
$remise = round(($pu * $remise_percent / 100),2);
$price = ($pu - $remise);
}
$price = price2num($price);
// Update line into database
$this->line=new FactureLigne($this->db);
@ -2276,10 +2270,6 @@ class Facture extends CommonInvoice
$this->line->fk_fournprice = $fk_fournprice;
$this->line->pa_ht = $pa_ht;
// A ne plus utiliser
//$this->line->price=$price;
//$this->line->remise=$remise;
if (is_array($array_option) && count($array_option)>0) {
$this->line->array_options=$array_option;
}
@ -2391,7 +2381,7 @@ class Facture extends CommonInvoice
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= ' SET remise_percent = '.$remise;
$sql.= ' WHERE rowid = '.$this->id;
$sql.= ' AND fk_statut = 0 ;';
$sql.= ' AND fk_statut = 0';
if ($this->db->query($sql))
{
@ -2426,7 +2416,7 @@ class Facture extends CommonInvoice
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= ' SET remise_absolue = '.$remise;
$sql.= ' WHERE rowid = '.$this->id;
$sql.= ' AND fk_statut = 0 ;';
$sql.= ' AND fk_statut = 0';
dol_syslog(get_class($this)."::set_remise_absolue sql=$sql");

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
@ -385,13 +385,13 @@ else
print "<tr><td>".$langs->trans("Author").'</td><td colspan="3">'.$author->getFullName($langs)."</td></tr>";
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
print '<td align="right" colspan="2"><b>'.price($object->total_ht).'</b></td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
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 align="right" colspan="2">'.price($object->total_tva).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td align="right" colspan="2">'.price($object->total_ttc).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></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">';

View File

@ -164,7 +164,7 @@ if ($result)
}
else
{
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
}
print '</table><br>';
}

View File

@ -528,75 +528,6 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
else dol_print_error($db);
}
// Last trips and expenses
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
{
include_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
$langs->load("boxes");
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.fk_statut, d.rowid, d.dated as date, d.tms as dm, d.km";
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = d.fk_user";
$sql.= " AND d.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND d.fk_soc = ".$socid;
$sql.= $db->order("d.tms","DESC");
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result)
{
$var=false;
$num = $db->num_rows($result);
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",$max).'</td>';
print '<td align="right">'.$langs->trans("FeesKilometersOrAmout").'</td>';
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
print '<td width="16">&nbsp;</td>';
print '</tr>';
if ($num)
{
$total_ttc = $totalam = $total = 0;
$deplacementstatic=new Deplacement($db);
$userstatic=new User($db);
while ($i < $num && $i < $max)
{
$objp = $db->fetch_object($result);
$deplacementstatic->ref=$objp->rowid;
$deplacementstatic->id=$objp->rowid;
$userstatic->id=$objp->uid;
$userstatic->lastname=$objp->lastname;
$userstatic->firstname=$objp->firstname;
print '<tr '.$bc[$var].'>';
print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(1).'</td>';
print '<td align="right">'.$objp->km.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
print '<td>'.$deplacementstatic->LibStatut($objp->fk_statut,3).'</td>';
print '</tr>';
$var=!$var;
$i++;
}
}
else
{
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
}
print '</table><br>';
}
else dol_print_error($db);
}
/**
* Social contributions to pay
*/

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -153,6 +154,17 @@ print "<td align=\"right\">".$vatcust."</td>";
print "</tr>\n";
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
$action = "tvaclient";
$object = &$coll_list;
$parameters["mode"] = $modetax;
$parameters["start"] = $date_start;
$parameters["end"] = $date_end;
$parameters["direction"] = 'sell';
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list))
{
$var=true;
@ -160,7 +172,7 @@ if (is_array($coll_list))
$i = 1;
foreach($coll_list as $coll)
{
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2>0)
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2!=0)
{
$var=!$var;
$intra = str_replace($find,$replace,$coll->tva_intra);
@ -222,6 +234,8 @@ print "</tr>\n";
$company_static=new Societe($db);
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$parameters["direction"] = 'buy';
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list))
{
$var=true;
@ -229,7 +243,7 @@ if (is_array($coll_list))
$i = 1;
foreach($coll_list as $coll)
{
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2>0)
if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2!=0)
{
$var=!$var;
$intra = str_replace($find,$replace,$coll->tva_intra);

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -134,6 +135,15 @@ for ($m = 1 ; $m < 13 ; $m++ )
{
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
$action = "tva";
$object = array(&$coll_listsell, &$coll_listbuy);
$parameters["mode"] = $modetax;
$parameters["year"] = $y;
$parameters["month"] = $m;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (! is_array($coll_listbuy) && $coll_listbuy == -1)
{
@ -181,7 +191,7 @@ for ($m = 1 ; $m < 13 ; $m++ )
print '<td align="right">'.$langs->trans("SubTotal").':</td>';
print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td>';
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>';
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>';
print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll=0; $subtotalpaye=0; $subtotal=0;

View File

@ -406,7 +406,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Date payment
print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
$datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment);
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment);
$form->select_date($datepayment,'','','',0,"add_paiement",1,1);
print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>';

View File

@ -185,7 +185,7 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$charge->lib."</td></tr>\n";
print '<tr><td>'.$langs->trans("DateDue")."</td><td colspan=\"2\">".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td colspan=\"2\"><b>".price($charge->amount).'</b> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans("Amount")."</td><td colspan=\"2\">".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
$sql = "SELECT sum(p.amount) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
@ -197,8 +197,8 @@ if ($_GET["action"] == 'create')
$sumpaid = $obj->total;
$db->free();
}
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td colspan="2"><b>'.price($sumpaid).'</b> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
print "<tr><td valign=\"top\">".$langs->trans("RemainderToPay")."</td><td colspan=\"3\"><b>".price($total - $sumpaid).'</b> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td colspan="2">'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print "<tr><td valign=\"top\">".$langs->trans("RemainderToPay")."</td><td colspan=\"3\">".price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print "<tr class=\"liste_titre\"><td colspan=\"3\">".$langs->trans("Payment").'</td>';
@ -223,9 +223,10 @@ if ($_GET["action"] == 'create')
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '',1); // Show opend bank account list
print '</td></tr>';
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print "<td><input name=\"num_paiement\" type=\"text\"></td></tr>\n";
print '<td><input name="num_paiement" type="text" value="'.GETPOST('num_paiement').'"></td></tr>'."\n";
/*
* Autres charges impayees
@ -238,10 +239,10 @@ if ($_GET["action"] == 'create')
print '<tr class="liste_titre">';
//print '<td>'.$langs->trans("SocialContribution").'</td>';
print '<td align="left">'.$langs->trans("DateDue").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
print '<td align="right">'.$langs->trans("AlreadyPaid").'</td>';
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
print '<td align="center">'.$langs->trans("Amount").'</td>';
print "</tr>\n";
$var=True;
@ -274,7 +275,7 @@ if ($_GET["action"] == 'create')
print '<td align="right">'.price($objp->amount-$sumpaid)."</td>";
print '<td align="right">';
print '<td align="center">';
if ($sumpaid < $objp->amount)
{
$namef = "amount_".$objp->id;
@ -296,7 +297,7 @@ if ($_GET["action"] == 'create')
{
// Print total
print "<tr ".$bc[!$var].">";
print '<td colspan="2" align="left">'.$langs->trans("TotalTTC").':</td>';
print '<td colspan="2" align="left">'.$langs->trans("Total").':</td>';
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>";
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>";
print "<td align=\"right\"><b>".price($total_ttc - $totalrecu)."</b></td>";
@ -304,29 +305,18 @@ if ($_GET["action"] == 'create')
print "</tr>\n";
}
print "</table></td></tr>\n";
// }
// $db->free();
// }
// else
// {
// print $sql ."<br>".$db->error();
// }
/*
*
*/
print "</table>";
print '<br><center>';
//print '<tr><td colspan="3" align="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp; &nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</center>';
//print '</td></tr>';
print "</form>\n";
// }
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
*
@ -37,13 +37,19 @@ $langs->load('banks');
$langs->load('companies');
// Security check
$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
$id=GETPOST("id");
$action=GETPOST("action");
$confirm=GETPOST('confirm');
if ($user->societe_id) $socid=$user->societe_id;
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
$mesg='';
$paiement = new PaymentSocialContribution($db);
if ($id > 0)
{
$result=$paiement->fetch($id);
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
}
/*
@ -51,12 +57,10 @@ $mesg='';
*/
// Delete payment
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->tax->charges->supprimer)
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->charges->supprimer)
{
$db->begin();
$paiement = new PaymentSocialContribution($db);
$paiement->fetch($_REQUEST['id']);
$result = $paiement->delete($user);
if ($result > 0)
{
@ -66,19 +70,19 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
}
else
{
$mesg='<div class="error">'.$paiement->error.'</div>';
setEventMessage($paiement->error, 'errors');
$db->rollback();
}
}
// Create payment
if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->tax->charges->creer)
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer)
{
$db->begin();
$paiement = new PaymentSocialContribution($db);
$paiement->id = $_REQUEST['id'];
if ($paiement->valide() > 0)
$result=$paiement->valide();
if ($result > 0)
{
$db->commit();
@ -102,7 +106,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
}
else
{
$mesg='<div class="error">'.$paiement->error.'</div>';
setEventMessage($paiement->error);
$db->rollback();
}
}
@ -115,14 +119,6 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
llxHeader();
$socialcontrib=new ChargeSociales($db);
$paiement = new PaymentSocialContribution($db);
$result=$paiement->fetch($_GET['id']);
if ($result <= 0)
{
dol_print_error($db,'Payment '.$_GET['id'].' not found in database');
exit;
}
$form = new Form($db);
@ -144,7 +140,7 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0,
/*
* Confirmation de la suppression du paiement
*/
if ($_GET['action'] == 'delete')
if ($action == 'delete')
{
print $form->formconfirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
@ -153,7 +149,7 @@ if ($_GET['action'] == 'delete')
/*
* Confirmation de la validation du paiement
*/
if ($_GET['action'] == 'valide')
if ($action == 'valide')
{
$facid = $_GET['facid'];
print $form->formconfirm('fiche.php?id='.$paiement->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
@ -161,9 +157,6 @@ if ($_GET['action'] == 'valide')
}
if ($mesg) print $mesg.'<br>';
print '<table class="border" width="100%">';
// Ref
@ -182,8 +175,7 @@ print '<tr><td valign="top">'.$langs->trans('Mode').'</td><td colspan="3">'.$lan
print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
// Montant
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount).'&nbsp;'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
// Note
print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
@ -262,7 +254,7 @@ if ($resql)
// Expected to pay
print '<td align="right">'.price($objp->sc_amount).'</td>';
// Status
print '<td align="center">'.$socialcontrib->getLibStatut(4).'</td>';
print '<td align="center">'.$socialcontrib->getLibStatut(4,$objp->amount).'</td>';
// Amount payed
print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n";
@ -323,7 +315,8 @@ if ($_GET['action'] == '')
print '</div>';
$db->close();
llxFooter();
$db->close();
?>

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
/**
* Class to manage withdrawal receipts
*/
@ -44,6 +45,11 @@ class BonPrelevement extends CommonObject
var $emetteur_numero_compte;
var $emetteur_code_banque;
var $emetteur_number_key;
var $emetteur_iban;
var $emetteur_bic;
var $emetteur_ics;
var $total;
var $_fetched;
var $statut; // 0-Wait, 1-Trans, 2-Done
@ -74,6 +80,10 @@ class BonPrelevement extends CommonObject
$this->emetteur_code_banque = "";
$this->emetteur_number_key = "";
$this->emetteur_iban = "";
$this->emetteur_bic = "";
$this->emetteur_ics = "";
$this->factures = array();
$this->numero_national_emetteur = "";
@ -655,9 +665,9 @@ class BonPrelevement extends CommonObject
$resql = $this->db->query($sql);
if ( $resql )
{
$row = $this->db->fetch_row($resql);
$obj = $this->db->fetch_object($resql);
return $row[0];
return $obj->nb;
$this->db->free($resql);
}
@ -671,38 +681,39 @@ class BonPrelevement extends CommonObject
/**
* Get number of invoices to withdrawal
* TODO delete params banque and agence when not necesary
*
* @param int $banque bank
* @param int $agence agence
* @param int $banque dolibarr mysoc bank
* @param int $agence dolibarr mysoc agence
* @return int <O if KO, number of invoices if OK
*/
function NbFactureAPrelever($banque=0,$agence=0)
{
global $conf;
$sql = "SELECT count(f.rowid)";
$sql = "SELECT count(f.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
if ($banque || $agence) $sql.=", ".MAIN_DB_PREFIX."societe_rib as sr";
//if ($banque || $agence) $sql.=", ".MAIN_DB_PREFIX."societe_rib as sr";
$sql.= " WHERE f.fk_statut = 1";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.rowid = pfd.fk_facture";
$sql.= " AND f.paye = 0";
$sql.= " AND pfd.traite = 0";
$sql.= " AND f.total_ttc > 0";
if ($banque || $agence) $sql.= " AND f.fk_soc = sr.rowid";
if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
//if ($banque || $agence) $sql.= " AND f.fk_soc = sr.rowid";
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
$resql = $this->db->query($sql);
if ( $resql )
{
$row = $this->db->fetch_row($resql);
$obj = $this->db->fetch_object($resql);
$this->db->free($resql);
return $row[0];
return $obj->nb;
}
else
{
@ -715,9 +726,10 @@ class BonPrelevement extends CommonObject
/**
* Create a withdraw
* TODO delete params banque and agence when not necesary
*
* @param int $banque code of bank (to withdraw a specific bankof a specific customer. By default '')
* @param int $agence code of bank office (guichet) (to withdraw a specific bankof a specific customer. By default '')
* @param int $banque dolibarr mysoc bank
* @param int $agence dolibarr mysoc bank office (guichet)
* @param string $mode real=do action, simu=test only
* @return int <0 if KO, nbre of invoice withdrawed if OK
*/
@ -755,17 +767,17 @@ class BonPrelevement extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
if ($banque || $agence) $sql.= ", ".MAIN_DB_PREFIX."societe_rib as sr";
//if ($banque || $agence) $sql.= ", ".MAIN_DB_PREFIX."societe_rib as sr";
$sql.= " WHERE f.rowid = pfd.fk_facture";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND s.rowid = f.fk_soc";
if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc";
//if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc";
$sql.= " AND f.fk_statut = 1";
$sql.= " AND f.paye = 0";
$sql.= " AND pfd.traite = 0";
$sql.= " AND f.total_ttc > 0";
if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -1006,6 +1018,9 @@ class BonPrelevement extends CommonObject
$bonprev->emetteur_code_guichet = $conf->global->PRELEVEMENT_CODE_GUICHET;
$bonprev->emetteur_numero_compte = $conf->global->PRELEVEMENT_NUMERO_COMPTE;
$bonprev->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY;
$bonprev->emetteur_iban = $conf->global->PRELEVEMENT_IBAN;
$bonprev->emetteur_bic = $conf->global->PRELEVEMENT_BIC;
$bonprev->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // TODO Add this into setup of admin/prelevement.php. Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
$bonprev->factures = $factures_prev_id;
@ -1225,11 +1240,15 @@ class BonPrelevement extends CommonObject
// TODO Move code for es and fr into an external module file with selection into setup of prelevement module
$found=0;
// Build file for Spain
if ($mysoc->country_code=='ES')
{
if (! empty($conf->esaeb->enabled))
{
$found++;
dol_include_once('/esaeb/class/esaeb19.class.php');
//Head
@ -1278,102 +1297,124 @@ class BonPrelevement extends CommonObject
$i++;
}
}
else
{
{
$result = -2;
}
fputs($this->file, $esaeb19->generaRemesa());
}
else
{
$this->total = 0;
$sql = "SELECT pl.amount";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
$sql.= " AND pf.fk_facture = f.rowid";
//Lines
$i = 0;
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$this->total = $this->total + $obj->amount;
$i++;
}
}
else
{
$result = -2;
}
$langs->load('withdrawals');
fputs($this->file, $langs->trans('WithdrawalFileNotCapable'));
}
}
// Build file for France
elseif ($mysoc->country_code=='FR')
// Build file for European countries
if (! $found && $mysoc->isInEEC())
{
/*
* En-tete Emetteur
*/
$this->EnregEmetteur();
$found++;
/*
* Lines
*/
$this->total = 0;
/**
* SECTION CREATION FICHIER SEPA
* SECTION CREATION FICHIER SEPA
* SECTION CREATION FICHIER SEPA
*/
// SEPA Initialisation
$CrLf = "\n";
$date_actu = dol_now();
$dateTime_YMD = dol_print_date($date_actu, '%Y%m%d');
$dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S');
$dateTime_ECMA = dol_print_date($date_actu, '%Y-%m-%dT%H:%M:%S');
$fileDebiteurSection = '';
$fileEmetteurSection = '';
$i = 0;
$this->total = 0;
$sql = "SELECT pl.rowid, pl.client_nom, pl.code_banque, pl.code_guichet, pl.number, pl.amount,";
$sql.= " f.facnumber, pf.fk_facture";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
$sql.= " AND pf.fk_facture = f.rowid";
/*
* section Debiteur (sepa Debiteurs bloc lines)
*/
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, p.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
$sql.= " ".MAIN_DB_PREFIX."societe as soc,";
$sql.= " ".MAIN_DB_PREFIX."c_pays as p,";
$sql.= " ".MAIN_DB_PREFIX."societe_rib as rib";
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
$sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND soc.fk_pays = p.rowid";
$sql.= " AND soc.rowid = f.fk_soc";
$sql.= " AND rib.fk_soc = f.fk_soc";
$sql.= " AND rib.default_rib = 1";
$i = 0;
//echo $sql;
$resql=$this->db->query($sql);
if ($resql)
{ $num = $this->db->num_rows($resql);
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum);
$this->total = $this->total + $obj->somme;
$i++;
}
}
else
{ fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
$result = -2;
}
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
/*
* section Emetteur(sepa Emetteur bloc lines)
*/
if ($result != -2)
{ $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
}
else
{ fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
}
while ($i < $num)
{
$row = $this->db->fetch_row($resql);
/**
* SECTION CREATION FICHIER SEPA
* SECTION CREATION FICHIER SEPA
* SECTION CREATION FICHIER SEPA
*/
// SEPA File Header
fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
fputs($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
fputs($this->file, ' <CstmrDrctDbtInitn>'.$CrLf);
// SEPA Group header
fputs($this->file, ' <GrpHdr>'.$CrLf);
fputs($this->file, ' <MsgId>'.('PREL'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
fputs($this->file, ' <CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
fputs($this->file, ' <InitgPty>'.$CrLf);
fputs($this->file, ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf);
/* fputs($this->file, ' <Id>'.$CrLf);
fputs($this->file, ' <Othr>'.$CrLf);
fputs($this->file, ' <Id>0533883248</Id>'.$CrLf);
fputs($this->file, ' <Issr>KBO-BCE</Issr>'.$CrLf);
fputs($this->file, ' <Othr>'.$CrLf);
fputs($this->file, ' </Id>'.$CrLf);
*/ fputs($this->file, ' </InitgPty>'.$CrLf);
fputs($this->file, ' </GrpHdr>'.$CrLf);
// SEPA File Emetteur
if ($result != -2)
{ fputs($this-> file, $fileEmetteurSection);}
// SEPA File Debiteurs
if ($result != -2)
{ fputs($this-> file, $fileDebiteurSection);}
// SEPA FILE FOOTER
fputs($this->file, ' </PmtInf>'.$CrLf);
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
fputs($this->file, '</Document>'.$CrLf);
$this->EnregDestinataire($row[0],$row[1],$row[2],$row[3],$row[4],$row[5],$row[6],$row[7]);
$this->total = $this->total + $row[5];
$i++;
}
}
else
{
$result = -2;
}
/*
* Pied de page total
*/
$this->EnregTotal($this->total);
}
// Build file for Other Countries with unknow format
else
if (! $found)
{
$this->total = 0;
$sql = "SELECT pl.amount";
@ -1426,9 +1467,10 @@ class BonPrelevement extends CommonObject
* @param float $amount amount
* @param string $facnumber ref of invoice
* @param int $facid id of invoice
* @param string $rib_dom rib domiciliation
* @return void
*/
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid)
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid, $rib_dom='')
{
fputs($this->file, "06");
fputs($this->file, "08"); // Prelevement ordinaire
@ -1445,11 +1487,11 @@ class BonPrelevement extends CommonObject
// Raison Sociale Destinataire C2
fputs($this->file, substr($client->nom. " ",0,24));
fputs($this->file, substr(strtoupper($client_nom)." ",0,24));
// Domiciliation facultative D1
fputs($this->file, substr(" ",0,24));
$domiciliation = strtr($rib_dom, array(" " => "-", CHR(13) => " ", CHR(10) => ""));
fputs($this->file, substr($domiciliation." ",0,24));
// Zone Reservee D2
@ -1471,8 +1513,7 @@ class BonPrelevement extends CommonObject
// Libelle F
fputs($this->file, substr("*".$this->ref.$rowid." ",0,13));
fputs($this->file, substr(" ",0,18));
fputs($this->file, substr("*_".$facnumber."_RDVnet".$rowid." ", 0, 31));
// Code etablissement G1
@ -1480,12 +1521,79 @@ class BonPrelevement extends CommonObject
// Zone Reservee G2
fputs($this->file, substr(" ",0,5));
fputs($this->file, substr(" ", 0, 5));
fputs($this->file, "\n");
}
/**
* Write recipient of request (customer)
*
* @param string $row_code_client soc.code_client as code,
* @param string $row_nom pl.client_nom AS nom,
* @param string $row_address soc.address AS adr,
* @param string $row_zip soc.zip
* @param string $row_town soc.town
* @param string $row_country_code p.code AS pays,
* @param string $row_cb pl.code_banque AS cb,
* @param string $row_cg pl.code_guichet AS cg,
* @param string $row_cc pl.number AS cc,
* @param string $row_somme pl.amount AS somme,
* @param string $row_facnumber f.facnumber
* @param string $row_idfac pf.fk_facture AS idfac,
* @param string $row_iban rib.iban_prefix AS iban,
* @param string $row_bic rib.bic AS bic,
* @param string $row_datec soc.datec,
* @param string $row_drum soc.rowid AS drum
* @return void
*/
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
{
$CrLf = "\n";
$Rowing = sprintf("%06d", $row_idfac);
$Date_Rum = strtotime($row_datec);
$pre = ($date_Rum > 1359673200) ? 'Rum' : '++R';
$Rum = $pre.$row_code_client.$row_drum.'-0'.date('U', $Date_Rum);
$XML_DEBITOR ='';
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
$XML_DEBITOR .=' <PmtId>'.$CrLf;
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.$row_facnumber.'-'.$Rowing).'</EndToEndId>'.$CrLf;
$XML_DEBITOR .=' </PmtId>'.$CrLf;
$XML_DEBITOR .=' <InstdAmt Ccy.="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
$XML_DEBITOR .=' <MndtRltdInf>'.$CrLf;
$XML_DEBITOR .=' <MndtId>'.$Rum.'</MndtId>'.$CrLf;
$XML_DEBITOR .=' <DtOfSgntr>'.$row_datec.'</DtOfSgntr>'.$CrLf;
$XML_DEBITOR .=' <AmdmntInd>false</AmdmntInd>'.$CrLf;
$XML_DEBITOR .=' </MndtRltdInf>'.$CrLf;
$XML_DEBITOR .=' </DrctDbtTx>'.$CrLf;
$XML_DEBITOR .=' <DbtrAgt>'.$CrLf;
$XML_DEBITOR .=' <FinInstnId>'.$CrLf;
$XML_DEBITOR .=' <BIC>'.$row_iban.'</BIC>'.$CrLf;
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
$XML_DEBITOR .=' <Nm>'.strtoupper($row_nom).'</Nm>'.$CrLf;
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.strtr($row_adr, array(CHR(13) => ", ", CHR(10) => "")).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.$row_zip.' '.$row_town.'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
$XML_DEBITOR .=' <Id>'.$CrLf;
$XML_DEBITOR .=' <IBAN>'.$row_iban.'</IBAN>'.$CrLf;
$XML_DEBITOR .=' </Id>'.$CrLf;
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
$XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
return $XML_DEBITOR;
}
/**
* Write sender of request (me)
*
@ -1552,6 +1660,106 @@ class BonPrelevement extends CommonObject
}
/**
* Write sender of request (me)
*
* @param string $configuration conf
* @param date $ladate Date
* @param int $nombre 0 or 1
* @param float $total Total
* @param string $CrLf End of line character
* @return SEPA
*/
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
{ // SEPA INITIALISATION
global $confs;
$dateTime_YMD = dol_print_date($ladate, '%Y%m%d');
$dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d');
$dateTime_YMDHMS = dol_print_date($ladate, '%Y-%m-%dT%H:%M:%S');
// Récupération info demandeur
$sql = "SELECT rowid, ref";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql.= " WHERE pb.rowid = ".$this->id;
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
// DONNEES BRUTES : par la suite Rows['XXX'] de la requete au dessus
$pays = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
$IdBon = sprintf("%05d", $obj->rowid);
$RefBon = $obj->ref;
$type = ($nombre == 1) ? 'FRST' : 'RCUR' ;
// SEPA Paiement Information
$XML_SEPA_INFO = '';
$XML_SEPA_INFO .= ' <PmtInf>'.$CrLf;
$XML_SEPA_INFO .= ' <PmtInfId>'.('PREL'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
$XML_SEPA_INFO .= ' <PmtMtd>DD</PmtMtd>'.$CrLf;
$XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
$XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
$XML_SEPA_INFO .= ' <PmtTpInf>'.$CrLf;
$XML_SEPA_INFO .= ' <InstrPrty>NORM</InstrPrty>'.$CrLf;
$XML_SEPA_INFO .= ' <SvcLvl>'.$CrLf;
$XML_SEPA_INFO .= ' <Cd>SEPA</Cd>'.$CrLf;
$XML_SEPA_INFO .= ' </SvcLvl>'.$CrLf;
$XML_SEPA_INFO .= ' <LclInstrm>'.$CrLf;
$XML_SEPA_INFO .= ' <Cd>CORE</Cd>'.$CrLf;
$XML_SEPA_INFO .= ' </LclInstrm>'.$CrLf;
$XML_SEPA_INFO .= ' <SeqTp>'.$type.'</SeqTp>'.$CrLf;
$XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf;
$XML_SEPA_INFO .= ' <ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
$XML_SEPA_INFO .= ' <Cdtr>'.$CrLf;
$XML_SEPA_INFO .= ' <Nm>'.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.'</Nm>'.$CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' <Ctry>'.$pays[1].'</Ctry>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.$configuration->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.$configuration->global->MAIN_INFO_SOCIETE_ZIP.' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </Cdtr>'.$CrLf;
$XML_SEPA_INFO .= ' <CdtrAcct>'.$CrLf;
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
$XML_SEPA_INFO .= ' <IBAN>'.preg_replace('/\s/', '', $configuration->global->PRELEVEMENT_IBAN).'</IBAN>'.$CrLf;
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
$XML_SEPA_INFO .= ' </CdtrAcct>'.$CrLf;
$XML_SEPA_INFO .= ' <CdtrAgt>'.$CrLf;
$XML_SEPA_INFO .= ' <FinInstnId>'.$CrLf;
$XML_SEPA_INFO .= ' <BIC>'.$configuration->global->PRELEVEMENT_BIC.'</BIC>'.$CrLf;
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
$XML_SEPA_INFO .= ' </CdtrAgt>'.$CrLf;
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
$XML_SEPA_INFO .= ' <Nm>'.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.'</Nm>'.$CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' <Ctry>'.$pays[1].'</Ctry>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;
*/ $XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf;
$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
$XML_SEPA_INFO .= ' <Othr>'.$CrLf;
$XML_SEPA_INFO .= ' <Id>'.$configuration->global->PRELEVEMENT_ICS.'</Id>'.$CrLf;
$XML_SEPA_INFO .= ' <SchmeNm>'.$CrLf;
$XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>'.$CrLf;
$XML_SEPA_INFO .= ' </SchmeNm>'.$CrLf;
$XML_SEPA_INFO .= ' </Othr>'.$CrLf;
$XML_SEPA_INFO .= ' </PrvtId>'.$CrLf;
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;
}
else
{
fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf);
$result = -2;
}
return $XML_SEPA_INFO;
}
/**
* Write end
*

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -729,6 +730,16 @@ if ($mysoc->tva_assuj != 'franchise') // Assujeti
print '</tr>';
}
$action = "balanceclient";
$object = array(&$total_ht, &$total_ttc);
$parameters["mode"] = $modecompta;
$parameters["date_start"] = $date_start;
$parameters["date_end"] = $date_end;
$parameters["bc"] = $bc;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
print $hookmanager->resPrint;
if ($mysoc->tva_assuj != 'franchise') // Assujeti
{

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -461,8 +462,12 @@ if ($result) {
} else {
dol_print_error($db);
}
$action = "balance";
$object = array(&$encaiss, &$encaiss_ttc, &$decaiss, &$decaiss_ttc);
$parameters["mode"] = $modecompta;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
/*
* Show result array

View File

@ -1,19 +1,19 @@
<?php
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@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/>.
*/
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/salaries/class/paymentsalary.class.php
@ -26,270 +26,199 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
* Put here description of your class
* Class to manage salary payments
*/
class PaymentSalary extends CommonObject
{
//public $element='payment_salary'; //!< Id that identify managed objects
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
var $id;
var $ref;
var $id;
var $ref;
var $tms;
var $fk_user;
var $datep;
var $datep;
var $datev;
var $amount;
var $type_payment;
var $num_payment;
var $label;
var $datesp;
var $dateep;
var $datesp;
var $dateep;
var $note;
var $fk_bank;
var $fk_user_creat;
var $fk_user_modif;
/**
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->element = 'payment_salary';
$this->table_element = 'payment_salary';
return 1;
}
*/
function __construct($db)
{
$this->db = $db;
$this->element = 'payment_salary';
$this->table_element = 'payment_salary';
return 1;
}
/**
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
{
global $conf, $langs;
/**
* Create in database
*
* @param User $user User that create
* @return int <0 if KO, >0 if OK
*/
function create($user)
{
global $conf, $langs;
$error=0;
$error=0;
// Clean parameters
$this->fk_user=trim($this->fk_user);
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Clean parameters
$this->fk_user=trim($this->fk_user);
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters
if (empty($this->fk_user) || $this->fk_user < 0)
{
$this->error='ErrorBadParameter';
return -1;
}
// Check parameters
// Put here code to add control on parameters values
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary(";
$sql.= "tms,";
$sql.= "fk_user,";
$sql.= "datep,";
$sql.= "datev,";
$sql.= "amount,";
$sql.= "label,";
$sql.= "datesp,";
$sql.= "dateep,";
$sql.= "note,";
$sql.= "fk_bank,";
$sql.= "fk_user_creat,";
$sql.= "fk_user_modif";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " fk_user='".$this->fk_user."',";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " amount='".$this->amount."',";
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
$sql.= " num_payment='".$this->num_payment."',";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " datesp=".$this->db->idate($this->datesp).",";
$sql.= " dateep=".$this->db->idate($this->dateep).",";
$sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
$sql.= ") VALUES (";
$sql.= " WHERE rowid=".$this->id;
$sql.= " '".$this->db->idate($this->tms).",";
$sql.= " '".$this->fk_user."',";
$sql.= " '".$this->db->idate($this->datep)."',";
$sql.= " '".$this->db->idate($this->datev)."',";
$sql.= " '".$this->amount."',";
$sql.= " '".$this->label."',";
$sql.= " '".$this->db->idate($this->datesp)."',";
$sql.= " '".$this->db->idate($this->dateep)."',";
$sql.= " '".$this->note."',";
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->fk_bank."'").",";
$sql.= " '".$this->fk_user_creat."',";
$sql.= " '".$this->fk_user_modif."'";
$sql.= ")";
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return $this->id;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Clean parameters
$this->fk_user=trim($this->fk_user);
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters
if (empty($this->fk_user) || $this->fk_user < 0)
{
$this->error='ErrorBadParameter';
return -1;
}
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " fk_user='".$this->fk_user."',";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " amount='".$this->amount."',";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " datesp=".$this->db->idate($this->datesp).",";
$sql.= " dateep=".$this->db->idate($this->dateep).",";
$sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " fk_bank='".$this->fk_bank."',";
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
return -1;
}
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
return -1;
}
if (! $notrigger)
{
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
}
return 1;
}
return 1;
}
/**
* Load object in memory from database
*
* @param int $id id object
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $user=0)
{
global $langs;
$sql = "SELECT";
$sql.= " s.rowid,";
/**
* Load object in memory from database
*
* @param int $id id object
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $user=0)
{
global $langs;
$sql = "SELECT";
$sql.= " s.rowid,";
$sql.= " s.tms,";
$sql.= " s.fk_user,";
$sql.= " s.datep,";
$sql.= " s.datev,";
$sql.= " s.amount,";
$sql.= " s.label,";
$sql.= " s.datesp,";
$sql.= " s.dateep,";
$sql.= " s.note,";
$sql.= " s.fk_bank,";
$sql.= " s.fk_user_creat,";
$sql.= " s.fk_user_modif,";
$sql.= " b.fk_account,";
$sql.= " b.fk_type,";
$sql.= " b.rappro";
$sql.= " s.tms,";
$sql.= " s.fk_user,";
$sql.= " s.datep,";
$sql.= " s.datev,";
$sql.= " s.amount,";
$sql.= " s.fk_typepayment,";
$sql.= " s.num_payment,";
$sql.= " s.label,";
$sql.= " s.datesp,";
$sql.= " s.dateep,";
$sql.= " s.note,";
$sql.= " s.fk_bank,";
$sql.= " s.fk_user_creat,";
$sql.= " s.fk_user_modif,";
$sql.= " b.fk_account,";
$sql.= " b.fk_type,";
$sql.= " b.rappro";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " WHERE s.rowid = ".$id;
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " WHERE s.rowid = ".$id;
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->tms = $this->db->jdate($obj->tms);
$this->fk_user = $obj->fk_user;
$this->datep = $this->db->jdate($obj->datep);
$this->datev = $this->db->jdate($obj->datev);
$this->amount = $obj->amount;
$this->label = $obj->label;
$this->datesp = $this->db->jdate($obj->datesp);
$this->dateep = $this->db->jdate($obj->dateep);
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->fk_account = $obj->fk_account;
$this->fk_type = $obj->fk_type;
$this->rappro = $obj->rappro;
}
$this->db->free($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->tms = $this->db->jdate($obj->tms);
$this->fk_user = $obj->fk_user;
$this->datep = $this->db->jdate($obj->datep);
$this->datev = $this->db->jdate($obj->datev);
$this->amount = $obj->amount;
$this->type_payement = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
$this->label = $obj->label;
$this->datesp = $this->db->jdate($obj->datesp);
$this->dateep = $this->db->jdate($obj->dateep);
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->fk_account = $obj->fk_account;
$this->fk_type = $obj->fk_type;
$this->rappro = $obj->rappro;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
}
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
}
/**
/**
* Delete object in database
*
* @param User $user User that delete
* @param User $user User that delete
* @return int <0 if KO, >0 if OK
*/
function delete($user)
@ -301,32 +230,34 @@ class PaymentSalary extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete sql=".$sql);
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
return -1;
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
return 1;
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
@ -334,7 +265,7 @@ class PaymentSalary extends CommonObject
$this->tms='';
$this->fk_user='';
$this->datep='';
$this->datep='';
$this->datev='';
$this->amount='';
$this->label='';
@ -346,192 +277,198 @@ class PaymentSalary extends CommonObject
$this->fk_user_modif='';
}
/**
* Ajoute un paiement de salaire
*
/**
* Ajoute un paiement de salaire
*
* @param User $user Object user that insert
* @return int <0 if KO, rowid in tva table if OK
*/
function addPayment($user)
{
global $conf,$langs;
*/
function create($user)
{
global $conf,$langs;
$this->db->begin();
// Clean parameters
$this->amount=price2num(trim($this->amount));
// Clean parameters
$this->amount=price2num(trim($this->amount));
// Check parameters
if (! $this->label)
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
return -3;
}
if ($this->fk_user < 0 || $this->fk_user == '')
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Employee"));
return -4;
}
if ($this->amount < 0 || $this->amount == '')
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
return -5;
}
if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
return -6;
}
if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
return -6;
}
// Check parameters
if (! $this->label)
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
return -3;
}
if ($this->fk_user < 0 || $this->fk_user == '')
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Employee"));
return -4;
}
if ($this->amount < 0 || $this->amount == '')
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
return -5;
}
if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
return -6;
}
if (! empty($conf->banque->enabled) && (empty($this->paymenttype) || $this->paymenttype <= 0))
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
return -6;
}
$this->db->begin();
// Insertion dans table des paiement salaires
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user";
$sql.= ", datep";
$sql.= ", datev";
$sql.= ", amount";
if ($this->note) $sql.=", note";
if ($this->label) $sql.=", label";
$sql.= ", datesp";
$sql.= ", dateep";
$sql.= ", fk_user_creat";
$sql.= ", fk_bank";
$sql.= ", entity";
$sql.= ") ";
$sql.= " VALUES (";
$sql.= "'".$this->fk_user."'";
$sql.= ", '".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", ".$this->amount;
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
if ($this->label) $sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", '".$this->db->idate($this->datesp)."'";
$sql.= ", '".$this->db->idate($this->dateep)."'";
$sql.= ", '".$user->id."'";
$sql.= ", NULL";
$sql.= ", ".$conf->entity;
$sql.= ")";
// Insertion dans table des paiement salaires
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user";
$sql.= ", datep";
$sql.= ", datev";
$sql.= ", amount";
$sql.= ", fk_typepayment";
$sql.= ", num_payment";
$sql.=", note";
$sql.=", label";
$sql.= ", datesp";
$sql.= ", dateep";
$sql.= ", fk_user_creat";
$sql.= ", fk_bank";
$sql.= ", entity";
$sql.= ") ";
$sql.= " VALUES (";
$sql.= "'".$this->fk_user."'";
$sql.= ", '".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", ".$this->amount;
$sql.= ", ".$this->type_payment;
$sql.= ", ".$this->num_payment;
$sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", '".$this->db->idate($this->datesp)."'";
$sql.= ", '".$this->db->idate($this->dateep)."'";
$sql.= ", '".$user->id."'";
$sql.= ", NULL";
$sql.= ", ".$conf->entity;
$sql.= ")";
dol_syslog(get_class($this)."::addPayment sql=".$sql);
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO devrait s'appeler payment_salary
dol_syslog(get_class($this)."::create sql=".$sql);
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO devrait s'appeler payment_salary
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_ADDPAYMENT',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
if ($this->id > 0)
{
$ok=1;
if (! empty($conf->banque->enabled) && ! empty($this->amount))
{
// Insertion dans llx_bank
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if ($this->id > 0)
{
$ok=1;
if (! empty($conf->banque->enabled) && ! empty($this->amount))
{
// Insertion dans llx_bank
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$acc = new Account($this->db);
$result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($this->db);
$acc = new Account($this->db);
$result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($this->db);
// Insert payment into llx_bank
// Add link 'payment_salary' in bank_url between payment and bank transaction
$bank_line_id = $acc->addline(
$this->datep,
$this->paymenttype,
$this->label,
-abs($this->amount),
'',
'',
$user
);
// Insert payment into llx_bank
// Add link 'payment_salary' in bank_url between payment and bank transaction
$bank_line_id = $acc->addline(
$this->datep,
$this->type_payment,
$this->label,
-abs($this->amount),
$this->num_payment,
'',
$user
);
// Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0)
{
$this->update_fk_bank($bank_line_id);
}
else
{
$this->error=$acc->error;
$ok=0;
}
// Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0)
{
$this->update_fk_bank($bank_line_id);
}
else
{
$this->error=$acc->error;
$ok=0;
}
// Add link 'payment_salary' in bank_url between payment and bank transaction
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
// Add link 'payment_salary' in bank_url between payment and bank transaction
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
if ($result <= 0)
{
$this->error=$acc->error;
$ok=0;
}
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
if ($result <= 0)
{
$this->error=$acc->error;
$ok=0;
}
// Add link 'user' in bank_url between operation and bank transaction
$linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value)
{
$sal = new PaymentSalary($this->db);
// Add link 'user' in bank_url between operation and bank transaction
$linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value)
{
$sal = new PaymentSalary($this->db);
$sal->fetch($key);
$sal->fetch_user($this->fk_user);
$sal->fetch($key);
$sal->fetch_user($this->fk_user);
if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
{
$result=$acc->add_url_line(
$bank_line_id,
$sal->user->id,
DOL_URL_ROOT.'/user/fiche.php?id=',
$sal->user->lastname,
'user'
);
if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
{
$result=$acc->add_url_line(
$bank_line_id,
$sal->user->id,
DOL_URL_ROOT.'/user/fiche.php?id=',
$sal->user->lastname,
'user'
);
if ($result <= 0) dol_print_error($this->db);
$linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty
}
if ($result <= 0) dol_print_error($this->db);
$linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty
}
}
}
}
}
if ($ok)
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -3;
}
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -2;
}
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -1;
}
}
if ($ok)
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -3;
}
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -2;
}
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -1;
}
}
/**
* Mise a jour du lien entre le paiement salaire et la ligne générée dans llx_bank
*
* @param int $id_bank Id compte bancaire
/**
* Mise a jour du lien entre le paiement salaire et la ligne générée dans llx_bank
*
* @param int $id_bank Id compte bancaire
* @return int <0 if KO, >0 if OK
*/
*/
function update_fk_bank($id_bank)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank;

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,7 +18,7 @@
/**
* \file htdocs/compta/salaries/fiche.php
* \ingroup tax
* \ingroup salaries
* \brief Page of salaries payments
*/
@ -59,50 +60,73 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$db->begin();
$error=0;
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
$sal->accountid=GETPOST("accountid");
$sal->fk_user=GETPOST("fk_user");
$sal->datev=$datev;
$sal->datep=$datep;
$sal->amount=price2num(GETPOST("amount"));
$sal->label=GETPOST("label");
$sal->datesp=$datesp;
$sal->dateep=$dateep;
$sal->type_payment=GETPOST("paymenttype");
$sal->num_payment=GETPOST('num_payment');
$sal->accountid=$_POST["accountid"];
$sal->paymenttype=$_POST["paiementtype"];
$sal->fk_user=$_POST["fk_user"];
$sal->datev=$datev;
$sal->datep=$datep;
$sal->amount=$_POST["amount"];
$sal->label=$_POST["label"];
$sal->datesp=$datesp;
$sal->dateep=$dateep;
if (empty($sal->fk_user) || $sal->fk_user < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Employee")),'errors');
$error++;
}
if (empty($sal->type_payment) || $sal->type_payment < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');
$error++;
}
if (empty($sal->amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")),'errors');
$error++;
}
$ret=$sal->addPayment($user);
if ($ret > 0)
{
$db->commit();
header("Location: index.php");
exit;
}
else
{
$db->rollback();
setEventMessage($sal->error, 'errors');
$action="create";
}
if (! $error)
{
$db->begin();
$ret=$sal->create($user);
if ($ret > 0)
{
$db->commit();
header("Location: index.php");
exit;
}
else
{
$db->rollback();
setEventMessage($sal->error, 'errors');
$action="create";
}
}
$action='create';
}
if ($action == 'delete')
{
$result=$sal->fetch($id);
$result=$sal->fetch($id);
if ($sal->rappro == 0)
{
$db->begin();
$db->begin();
$ret=$sal->delete($user);
if ($ret > 0)
{
$ret=$sal->delete($user);
if ($ret > 0)
{
if ($sal->fk_bank)
{
$accountline=new AccountLine($db);
@ -122,23 +146,23 @@ if ($action == 'delete')
$db->rollback();
setEventMessage($sal->error,'errors');
}
}
else
{
$db->rollback();
setEventMessage($sal->error,'errors');
}
}
else
{
$db->rollback();
setEventMessage($sal->error,'errors');
}
}
else
{
setEventMessage('Error try do delete a line linked to a conciliated bank transaction','errors');
setEventMessage('Error try do delete a line linked to a conciliated bank transaction','errors');
}
}
/*
* View
*/
* View
*/
llxHeader();
@ -146,7 +170,7 @@ $form = new Form($db);
if ($id)
{
$salpayment = new PaymentSalary($db);
$salpayment = new PaymentSalary($db);
$result = $salpayment->fetch($id);
if ($result <= 0)
{
@ -158,86 +182,93 @@ if ($id)
// Formulaire saisie salaire
if ($action == 'create')
{
$year_current = strftime("%Y",dol_now());
$pastmonth = strftime("%m",dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0)
{
$pastmonth = 12;
$pastmonthyear--;
}
$year_current = strftime("%Y",dol_now());
$pastmonth = strftime("%m",dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0)
{
$pastmonth = 12;
$pastmonthyear--;
}
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
if (empty($datesp) || empty($dateep)) // We define date_start and date_end
{
$datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false);
}
if (empty($datesp) || empty($dateep)) // We define date_start and date_end
{
$datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false);
}
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print_fiche_titre($langs->trans("NewSalaryPayment"));
print_fiche_titre($langs->trans("NewSalaryPayment"));
print '<table class="border" width="100%">';
print '<table class="border" width="100%">';
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->select_date($datep,"datep",'','','','add');
print '</td></tr>';
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->select_date($datep,"datep",'','','','add');
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
print $form->select_date($datev,"datev",'','','','add');
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
print $form->select_date($datev,"datev",'','','','add');
print '</td></tr>';
// Employee
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("Employee").'</td><td>';
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
print '</td></tr>';
// Employee
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("Employee").'</td><td>';
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
print $form->select_date($datesp,"datesp",'','','','add');
print '</td></tr>';
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
print $form->select_date($datesp,"datesp",'','','','add');
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("DateEndPeriod").'</td><td>';
print $form->select_date($dateep,"dateep",'','','','add');
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("DateEndPeriod").'</td><td>';
print $form->select_date($dateep,"dateep",'','','','add');
print '</td></tr>';
// Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>';
// Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';
// Bank
if (! empty($conf->banque->enabled))
{
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
print '</td></tr>';
// Bank
if (! empty($conf->banque->enabled))
{
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements($_POST["paiementtype"], "paiementtype");
print "</td>\n";
print "</tr>";
}
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// TYpe payment
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype");
print "</td>\n";
print "</tr>";
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '</table>';
print "<br>";
print "<br>";
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print '</form>';
print '</form>';
}
@ -265,17 +296,17 @@ if ($id)
print $salpayment->ref;
print '</td></tr>';
// Person
print '<tr><td>'.$langs->trans("Person").'</td><td>';
$usersal=new User($db);
$usersal->fetch($salpayment->fk_user);
print $usersal->getNomUrl(1);
print '</td></tr>';
// Person
print '<tr><td>'.$langs->trans("Person").'</td><td>';
$usersal=new User($db);
$usersal->fetch($salpayment->fk_user);
print $usersal->getNomUrl(1);
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$salpayment->label.'</td></tr>';
print "<tr>";
print "<tr>";
print '<td>'.$langs->trans("DateStartPeriod").'</td><td colspan="3">';
print dol_print_date($salpayment->datesp,'day');
print '</td></tr>';
@ -293,34 +324,34 @@ if ($id)
print dol_print_date($salpayment->datev,'day');
print '</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($salpayment->amount).'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($salpayment->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
if (! empty($conf->banque->enabled))
{
if ($salpayment->fk_account > 0)
{
$bankline=new AccountLine($db);
$bankline->fetch($salpayment->fk_bank);
$bankline=new AccountLine($db);
$bankline->fetch($salpayment->fk_bank);
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">';
print $bankline->getNomUrl(1,0,'showall');
print '</td>';
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">';
print $bankline->getNomUrl(1,0,'showall');
print '</td>';
print '</tr>';
}
}
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '</div>';
/*
* Boutons d'actions
* Boutons d'actions
*/
print "<div class=\"tabsAction\">\n";
if ($salpayment->rappro == 0)
@ -342,7 +373,8 @@ if ($id)
}
$db->close();
llxFooter();
?>
$db->close();
?>

View File

@ -17,8 +17,8 @@
/**
* \file htdocs/compta/salaries/index.php
* \ingroup tax
* \brief List of salaries payments
* \ingroup salaries
* \brief List of salaries payments
*/
require '../../main.inc.php';
@ -26,6 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
$langs->load("compta");
$langs->load("salaries");
$langs->load("bills");
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
@ -46,8 +47,11 @@ $userstatic = new User($db);
print_fiche_titre($langs->trans("SalariesPayments"));
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.num_payment,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,";
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = s.fk_user";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= " ORDER BY dm DESC";
@ -65,6 +69,7 @@ if ($result)
print "<td>".$langs->trans("Person")."</td>";
print "<td>".$langs->trans("Label")."</td>";
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$paramlist,"",$sortfield,$sortorder);
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
print "</tr>\n";
$var=1;
@ -78,20 +83,23 @@ if ($result)
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;
$salstatic->id=$obj->rowid;
$salstatic->ref=$obj->rowid;
$salstatic->ref=$obj->rowid;
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
print "<td>".dol_trunc($obj->label,40)."</td>\n";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
$total = $total + $obj->amount;
print "<td align=\"right\">".price($obj->amount)."</td>";
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
// Amount
print "<td align=\"right\">".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
print "</tr>\n";
$total = $total + $obj->amount;
$i++;
}
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
print "<td align=\"right\"><b>".price($total)."</b></td></tr>";
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td></tr>";
print "</table>";
$db->free($result);

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -32,6 +32,7 @@ $langs->load("bills");
$id=GETPOST('id','int');
$action=GETPOST("action");
$confirm=GETPOST('confirm');
// Security check
$socid = GETPOST('socid','int');
@ -47,20 +48,16 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
/* */
/* *************************************************************************** */
/*
* Classify paid
*/
if ($action == 'confirm_paid' && $_REQUEST["confirm"] == 'yes')
// Classify paid
if ($action == 'confirm_paid' && $confirm == 'yes')
{
$chargesociales = new ChargeSociales($db);
$chargesociales->fetch($id);
$result = $chargesociales->set_paid($user);
}
/*
* Delete social contribution
*/
if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
// Delete social contribution
if ($action == 'confirm_delete' && $confirm == 'yes')
{
$chargesociales=new ChargeSociales($db);
$chargesociales->fetch($id);
@ -77,10 +74,7 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
}
/*
* Add social contribution
*/
// Add social contribution
if ($action == 'add' && $user->rights->tax->charges->creer)
{
$dateech=@dol_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]);
@ -226,7 +220,7 @@ if ($action == 'create')
print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1);
print '</td>';
print '<td align="right"><input type="text" size="6" name="amount" class="flat"></td>';
print '<td align="right"><input type="text" size="6" name="amount" class="flat" value="'.GETPOST('amount').'"></td>';
print '<td align="center">';
print $form->select_date(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1);
@ -303,8 +297,8 @@ if ($id > 0)
print '<td rowspan="'.$rowspan.'" valign="top">';
/*
* Paiements
*/
* Paiements
*/
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
$sql.= "c.libelle as paiement_type";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
@ -325,7 +319,7 @@ if ($id > 0)
echo '<table class="nobordernopadding" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Payments").'</td><td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td><td>&nbsp;</td></tr>';
print '<td align="right">'.$langs->trans("Amount").'</td><td>&nbsp;</td></tr>';
$var=True;
while ($i < $num)
@ -336,7 +330,7 @@ if ($id > 0)
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").'</a> ';
print dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td>\n";
print '<td align="right">'.price($objp->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$i++;
@ -363,7 +357,7 @@ if ($id > 0)
print "</tr>";
// Period end date
// Period end date
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
print "<td>";
if ($action == 'edit')
@ -388,10 +382,10 @@ if ($id > 0)
}
// Amount
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount).'</td></tr>';
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
print '</table>';

View File

@ -102,7 +102,7 @@ class ChargeSociales extends CommonObject
}
else
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
}
@ -317,28 +317,31 @@ class ChargeSociales extends CommonObject
}
/**
* Retourne le libelle du statut d'une charge (impaye, payee)
* Retourne le libelle du statut d'une charge (impaye, payee)
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Label
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
function getLibStatut($mode=0)
function getLibStatut($mode=0,$alreadypaid=-1)
{
return $this->LibStatut($this->paye,$mode);
return $this->LibStatut($this->paye,$mode,$alreadypaid);
}
/**
* Renvoi le libelle d'un statut donne
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
* @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
function LibStatut($statut,$mode=0)
function LibStatut($statut,$mode=0,$alreadypaid=-1)
{
global $langs;
$langs->load('customers');
$langs->load('bills');
if ($mode == 0)
{
if ($statut == 0) return $langs->trans("Unpaid");
@ -351,22 +354,26 @@ class ChargeSociales extends CommonObject
}
if ($mode == 2)
{
if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
if ($mode == 3)
{
if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1');
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
}
if ($mode == 4)
{
if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
if ($mode == 5)
{
if ($statut == 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
@ -63,7 +63,7 @@ if (! $sortfield) $sortfield="name";
$object = new ChargeSociales($db);
$object->fetch($id);
if ($id > 0) $object->fetch($id);
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
$modulepart='tax';
@ -87,6 +87,8 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url);
if ($object->id)
{
$alreadypayed=$object->getSommePaiement();
$head=tax_prepare_head($object, $user);
dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
@ -149,10 +151,10 @@ if ($object->id)
}
// Amount
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount).'</td></tr>';
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4,$alreadypayed).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -78,12 +78,14 @@ llxHeader();
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
$sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
$sql.= " c.libelle as type_lib";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " c.libelle as type_lib,";
$sql.= " SUM(pc.amount) as alreadypayed";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql.= " WHERE cs.fk_type = c.id";
$sql.= " AND cs.entity = ".$conf->entity;
if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".GETPOST("search_label")."%'";
if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".$db->escape(GETPOST("search_label"))."%'";
if ($year > 0)
{
$sql .= " AND (";
@ -100,6 +102,7 @@ if ($filtre) {
if ($typeid) {
$sql .= " AND cs.fk_type=".$typeid;
}
$sql.= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1,$offset);
@ -207,7 +210,7 @@ if ($resql)
// Due date
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5).'</a></td>';
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).'</a></td>';
print '</tr>';
$i++;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -185,6 +186,17 @@ print "<td align=\"right\">".$vatcust."</td>";
print "</tr>\n";
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
$action = "tvaclient";
$object = &$coll_list;
$parameters["mode"] = $modetax;
$parameters["start"] = $date_start;
$parameters["end"] = $date_end;
$parameters["direction"] = 'sell';
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list))
{
$var=true;
@ -263,6 +275,9 @@ print "</tr>\n";
$company_static=new Societe($db);
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$parameters["direction"] = 'buy';
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list))
{
$var=true;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -153,6 +154,15 @@ for ($m = 1 ; $m < 13 ; $m++ )
{
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
$action = "tva";
$object = array(&$coll_listsell, &$coll_listbuy);
$parameters["mode"] = $modetax;
$parameters["year"] = $y;
$parameters["month"] = $m;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (! is_array($coll_listbuy) && $coll_listbuy == -1)
{

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2014 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
@ -318,7 +319,16 @@ else
print '<td align="right">'.$langs->trans("AmountHTVATRealReceived").'</td>';
print '<td align="right">'.$vatcust.'</td>';
print '</tr>';
$action = "tvadetail";
$parameters["mode"] = $modetax;
$parameters["start"] = $date_start;
$parameters["end"] = $date_end;
$object = array(&$x_coll, &$x_paye, &$x_both);
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
foreach(array_keys($x_coll) as $rate)
{
$subtot_coll_total_ht = 0;
@ -415,14 +425,14 @@ else
print '<td class="nowrap" align="right">';
$temp_ht=$fields['totalht'];
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
print price(price2num($temp_ht,'MT'));
print price(price2num($temp_ht,'MT'),1);
print '</td>';
// VAT
print '<td class="nowrap" align="right">';
$temp_vat=$fields['vat'];
if ($type == 1) $temp_vat=$fields['vat']*$ratiopaymentinvoice;
print price(price2num($temp_vat,'MT'));
print price(price2num($temp_vat,'MT'),1);
//print price($fields['vat']);
print '</td>';
print '</tr>';
@ -566,14 +576,14 @@ else
print '<td class="nowrap" align="right">';
$temp_ht=$fields['totalht'];
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
print price(price2num($temp_ht,'MT'));
print price(price2num($temp_ht,'MT'),1);
print '</td>';
// VAT
print '<td class="nowrap" align="right">';
$temp_vat=$fields['vat'];
if ($type == 1) $temp_vat=$fields['vat']*$ratiopaymentinvoice;
print price(price2num($temp_vat,'MT'));
print price(price2num($temp_vat,'MT'),1);
//print price($fields['vat']);
print '</td>';
print '</tr>';

View File

@ -170,6 +170,8 @@ $dolibarr_main_db_collation='utf8_general_ci';
// $dolibarr_main_authentication='dolibarr';
// $dolibarr_main_authentication='ldap';
// $dolibarr_main_authentication='openid,dolibarr';
// $dolibarr_main_authentication='forceuser'; // Add also $dolibarr_auto_user='loginforuser';
//
$dolibarr_main_authentication='dolibarr';

View File

@ -72,8 +72,10 @@ class box_ficheinter extends ModeleBoxes
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
$sql.= " WHERE f.fk_soc = s.rowid ";
$sql.= " AND f.entity = ".$conf->entity;
if (! $user->rights->societe->client->voir)
if (! $user->rights->societe->client->voir && !$user->societe_id)
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " ORDER BY f.tms DESC";
$sql.= $db->plimit($max, 0);

View File

@ -816,9 +816,10 @@ abstract class CommonObject
*
* @param string $filter Optional filter
* @param int $fieldid Name of field to use for the select MAX and MIN
* @param int $nodbprefix Do not include DB prefix to forge table name
* @return int <0 if KO, >0 if OK
*/
function load_previous_next_ref($filter,$fieldid)
function load_previous_next_ref($filter,$fieldid,$nodbprefix=0)
{
global $conf, $user;
@ -834,7 +835,7 @@ abstract class CommonObject
if ($this->element == 'societe') $alias = 'te';
$sql = "SELECT MAX(te.".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'";
@ -847,7 +848,7 @@ abstract class CommonObject
$result = $this->db->query($sql);
if (! $result)
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
$row = $this->db->fetch_row($result);
@ -855,7 +856,7 @@ abstract class CommonObject
$sql = "SELECT MIN(te.".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
$sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'";
@ -869,7 +870,7 @@ abstract class CommonObject
$result = $this->db->query($sql);
if (! $result)
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -2;
}
$row = $this->db->fetch_row($result);

View File

@ -200,12 +200,21 @@ class Conf
}
//var_dump($this->modules);
//var_dump($this->modules_parts['theme']);
// If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
// In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore.
//$this->global->MAIN_SERVER_TZ='Europe/Paris';
if (! empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') date_default_timezone_set($this->global->MAIN_SERVER_TZ);
if (! empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto')
{
try {
date_default_timezone_set($this->global->MAIN_SERVER_TZ);
}
catch(Exception $e)
{
dol_syslog("Error: Bad value for parameter MAIN_SERVER_TZ=".$this->global->MAIN_SERVER_TZ, LOG_ERR);
}
}
// Object $mc
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
{
@ -235,6 +244,14 @@ class Conf
if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_menu.php";
if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
// Clean var use vat for company
if (! isset($this->global->FACTURE_TVAOPTION)) $this->global->FACTURE_TVAOPTION=1;
else if (! empty($this->global->FACTURE_TVAOPTION) && ! is_numeric($this->global->FACTURE_TVAOPTION))
{
// Old value of option, we clean to use new value (0 or 1)
if ($this->global->FACTURE_TVAOPTION != "franchise") $this->global->FACTURE_TVAOPTION=1;
else $this->global->FACTURE_TVAOPTION=0;
}
// Variable globales LDAP
if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME='';

View File

@ -81,7 +81,7 @@ class DolEditor
// Check if extended editor is ok. If not we force textarea
if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) $this->tool = 'textarea';
if ($conf->browser->phone) $this->tool = 'textarea';
//if ($conf->browser->phone) $this->tool = 'textarea';
// Define content and some properties
if ($this->tool == 'ckeditor')

View File

@ -674,6 +674,7 @@ class ExtraFields
$out = '';
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
@ -693,6 +694,7 @@ class ExtraFields
$out = '';
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
@ -789,6 +791,7 @@ class ExtraFields
$labeltoshow=dol_trunc($obj->$field_toshow,18).' ';
}
}
$out.='<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
}
else
{

View File

@ -137,6 +137,7 @@ class HookManager
'addMoreActionsButtons',
'addStatisticLine',
'doActions',
'formCreateThirdpartyOptions',
'formObjectOptions',
'formattachOptions',
'formBuilddocLineOptions',

View File

@ -202,7 +202,7 @@ class Form
else
{
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
elseif ($typeofdata == 'amount') $ret.=($value != '' ? price($value,'',$langs) : '');
elseif ($typeofdata == 'amount') $ret.=($value != '' ? price($value,'',$langs,0,0,-1,$conf->currency) : '');
elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value);
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour');
@ -729,12 +729,13 @@ class Form
* @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')))
* @param int $limit Maximum number of elements
* @return string HTML string with
* @deprecated Use select_thirdparty instead
*/
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array())
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0)
{
return $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events);
return $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit);
}
/**
@ -752,11 +753,11 @@ class Form
* @param int $limit Limit number of answers
* @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=20)
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0)
{
global $conf,$user,$langs;
$out='';
$out=''; $num=0;
$outarray=array();
// On recherche les societes
@ -774,25 +775,24 @@ class Form
$sql.=" AND (";
if (! empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index
{
$sql.="(s.name LIKE '".$filterkey."%'";
$sql.=")";
$sql.="(s.name LIKE '".$this->db->escape($filterkey)."%')";
}
else
{
// For natural search
$scrit = explode(' ', $filterkey);
foreach ($scrit as $crit) {
$sql.=" AND (s.name LIKE '%".$crit."%'";
$sql.=")";
$sql.=" AND (s.name LIKE '%".$this->db->escape($crit)."%')";
}
}
if (! empty($conf->barcode->enabled))
{
$sql .= " OR s.barcode LIKE '".$filterkey."'";
$sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'";
}
$sql.=")";
}
$sql.= " ORDER BY nom ASC";
$sql.=$this->db->order("nom","ASC");
if ($limit > 0) $sql.=$this->db->plimit($limit);
dol_syslog(get_class($this)."::select_thirdparty_list sql=".$sql);
$resql=$this->db->query($sql);
@ -800,7 +800,8 @@ class Form
{
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
$out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
// Construct $out and $outarray
@ -858,6 +859,8 @@ class Form
dol_print_error($this->db);
}
$this->result=array('nbofthirdparties'=>$num);
if ($outputmode) return $outarray;
return $out;
}
@ -1340,7 +1343,7 @@ class Form
$sql.=' ,pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,';
$sql.=' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx';
}
// Multilang : we add translation
if (! empty($conf->global->MAIN_MULTILANGS))
{
@ -1616,23 +1619,23 @@ class Form
$opt.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
$outval.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
}
//Price by customer
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
if (!empty($objp->idprodcustprice)) {
$found = 1;
if ($objp->custprice_base_type == 'HT')
{
$opt.= price($objp->custprice,1).' '.$currencytext.' '.$langs->trans("HT");
$outval.= price($objp->custprice,1).' '.$currencytextnoent.' '.$langs->transnoentities("HT");
$opt.= price($objp->custprice,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("HT");
$outval.= price($objp->custprice,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("HT");
}
else
{
$opt.= price($objp->custprice_ttc,1).' '.$currencytext.' '.$langs->trans("TTC");
$outval.= price($objp->custprice_ttc,1).' '.$currencytextnoent.' '.$langs->transnoentities("TTC");
$opt.= price($objp->custprice_ttc,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("TTC");
$outval.= price($objp->custprice_ttc,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("TTC");
}
$outprice_ht=price($objp->custprice);
$outprice_ttc=price($objp->custprice_ttc);
$outpricebasetype=$objp->custprice_base_type;
@ -2123,7 +2126,7 @@ class Form
* @param int $addempty Add empty entry
* @return void
*/
function select_availability($selected='',$htmlname='availid',$filtertype='',$addempty=0)
function selectAvailabilityDelay($selected='',$htmlname='availid',$filtertype='',$addempty=0)
{
global $langs,$user;
@ -2153,7 +2156,7 @@ class Form
*
* @return int Nb of lines loaded, 0 if already loaded, <0 if ko
*/
function load_cache_demand_reason()
function loadCacheInputReason()
{
global $langs;
@ -2163,7 +2166,7 @@ class Form
$sql.= " FROM ".MAIN_DB_PREFIX.'c_input_reason';
$sql.= " WHERE active=1";
$sql.= " ORDER BY rowid";
dol_syslog(get_class($this)."::load_cache_demand_reason sql=".$sql,LOG_DEBUG);
dol_syslog(get_class($this)."::loadCacheInputReason sql=".$sql,LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -2193,19 +2196,20 @@ class Form
}
/**
* Return list of events that triggered an object creation
* Return list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...)
* List found into table c_input_reason loaded by loadCacheInputReason
*
* @param int $selected Id or code of type origin to select by default
* @param string $htmlname Nom de la zone select
* @param string $exclude To exclude a code value (Example: SRC_PROP)
* @param int $addempty Add an empty entry
* @return void
* @param int $selected Id or code of type origin to select by default
* @param string $htmlname Nom de la zone select
* @param string $exclude To exclude a code value (Example: SRC_PROP)
* @param int $addempty Add an empty entry
* @return void
*/
function select_demand_reason($selected='',$htmlname='demandreasonid',$exclude='',$addempty=0)
function selectInputReason($selected='',$htmlname='demandreasonid',$exclude='',$addempty=0)
{
global $langs,$user;
$this->load_cache_demand_reason();
$this->loadCacheInputReason();
print '<select class="flat" name="'.$htmlname.'">';
if ($addempty) print '<option value="0"'.(empty($selected)?' selected="selected"':'').'>&nbsp;</option>';
@ -2903,7 +2907,7 @@ class Form
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
$this->select_availability($selected,$htmlname,-1,$addempty);
$this->selectAvailabilityDelay($selected,$htmlname,-1,$addempty);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
@ -2921,7 +2925,8 @@ class Form
}
/**
* Show a select form to select origin
* Output HTML form to select list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...)
* List found into table c_input_reason loaded by loadCacheInputReason
*
* @param string $page Page
* @param string $selected Id condition pre-selectionne
@ -2929,7 +2934,7 @@ class Form
* @param int $addempty Add empty entry
* @return void
*/
function form_demand_reason($page, $selected='', $htmlname='demandreason', $addempty=0)
function formInputReason($page, $selected='', $htmlname='demandreason', $addempty=0)
{
global $langs;
if ($htmlname != "none")
@ -2939,7 +2944,7 @@ class Form
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
$this->select_demand_reason($selected,$htmlname,-1,$addempty);
$this->selectInputReason($selected,$htmlname,-1,$addempty);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
@ -2948,7 +2953,7 @@ class Form
{
if ($selected)
{
$this->load_cache_demand_reason();
$this->loadCacheInputReason();
foreach ($this->cache_demand_reason as $key => $val)
{
if ($val['id'] == $selected)
@ -2964,16 +2969,17 @@ class Form
}
/**
* Show a form to select a date
* Show a form + html select a date
*
* @param string $page Page
* @param string $selected Date preselected
* @param string $htmlname Name of input html field
* @param string $htmlname Html name of date input fields or 'none'
* @param int $displayhour Display hour selector
* @param int $displaymin Display minutes selector
* @return void
* @see select_date
*/
function form_date($page, $selected, $htmlname,$displayhour=0,$displaymin=0)
function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0)
{
global $langs;
@ -3106,13 +3112,13 @@ class Form
print '<tr><td class="nowrap">';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
{
if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,1,$langs,0,0,-1,$conf->currency)).': '; // If we want deposit to be substracted to payments only and not to total of final invoice
else print $langs->trans("CompanyHasCreditNote",price($amount,1,$langs,0,0,-1,$conf->currency)).': ';
if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; // If we want deposit to be substracted to payments only and not to total of final invoice
else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
}
else
{
if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,1,$langs,0,0,-1,$conf->currency)).': ';
else print $langs->trans("CompanyHasCreditNote",price($amount,1,$langs,0,0,-1,$conf->currency)).': ';
if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
}
$newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles
if ($filter) $newfilter.=' AND ('.$filter.')';
@ -3254,7 +3260,7 @@ class Form
* @param string $htmlname name of HTML select list
* @return void
*/
function selectcurrency($selected='',$htmlname='currency_id')
function selectCurrency($selected='',$htmlname='currency_id')
{
global $conf,$langs,$user;
@ -3486,13 +3492,13 @@ class Form
/**
* Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes
* Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes.
* Fields are preselected with :
* - set_time date (Local PHP server timestamps or date format YYYY-MM-DD or YYYY-MM-DD HH:MM)
* - local date of PHP server if set_time is ''
* - Empty (fields empty) if set_time is -1 (in this case, parameter empty must also have value 1)
* - set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM')
* - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
* - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)
*
* @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp)
* @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date.
* @param string $prefix Prefix for fields name
* @param int $h 1=Show also hours
* @param int $m 1=Show also minutes
@ -3504,6 +3510,7 @@ class Form
* @param int $disabled Disable input fields
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @return mixed Nothing or string if nooutput is 1
* @see form_date
*/
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowbutton=0, $nooutput=0, $disabled=0, $fullday='')
{
@ -3516,7 +3523,11 @@ class Form
if($m == '') $m=0;
if($empty == '') $empty=0;
if (! $set_time && $empty == 0) $set_time = dol_now('tzuser');
if ($set_time === '' && $empty == 0)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$set_time = dol_now('tzuser')-(getServerTimeZoneInt('now')*3600); // set_time must be relative to PHP server timezone
}
// Analysis of the pre-selection date
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/',$set_time,$reg))
@ -4014,9 +4025,10 @@ class Form
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
* @param string $morehtmlref Code html supplementaire a afficher apres ref
* @param string $moreparam More param to add in nav link url.
* @param int $nodbprefix Do not include DB prefix to forge table name
* @return tring Portion HTML avec ref + boutons nav
*/
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='')
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0)
{
global $langs,$conf;
@ -4025,7 +4037,8 @@ class Form
if (empty($fieldref)) $fieldref='ref';
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid);
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):'&nbsp;').'</a>':'';
$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):'&nbsp;').'</a>':'';
@ -4042,7 +4055,7 @@ class Form
if ($morehtml)
{
$ret.='</td><td class="nobordernopadding" align="right">'.$morehtml;
$ret.='</td><td class="paddingrightonly" align="right">'.$morehtml;
}
if ($shownav && ($previous_ref || $next_ref))
{

View File

@ -23,8 +23,8 @@
/**
* Classe permettant la generation de composants html
* Only common components are here.
* Class to manage HTML output components for orders
* Before adding component here, check they are not into common part Form.class.php
*/
class FormOrder
{
@ -45,9 +45,32 @@ class FormOrder
}
/**
* Return combo list of differents status of a orders
*
* @param string $selected Preselected value
* @param int $short Use short labels
* @param string $hmlname Name of HTML select element
* @return void
*/
function selectSupplierOrderStatus($selected='', $short=0, $hmlname='order_status')
{
print '<select class="flat" name="'.$hmlname.'">';
print '<option value="-1">&nbsp;</option>';
$statustohow=array(0,1,2,3,4,5,6,9); // 7 is same label than 6. 8 does not exist.
foreach($statustohow as $key)
{
print '<option value="'.$key.'"'.($selected == $key?' selected="selected"':'').'>';
print CommandeFournisseur::LibStatut($key,$short);
print '</option>';
}
print '</select>';
}
/**
* Return list of way to order
*
*
* @param string $selected Id of preselected order origin
* @param string $htmlname Name of HTML select list
* @param int $addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
@ -73,17 +96,18 @@ class FormOrder
/**
* Return list of way to order
* Return list of input method (mode used to receive order, like order received by email, fax, online)
* List found into table c_input_method
*
* @param string $selected Id of preselected input method
* @param string $htmlname Name of HTML select list
* @param int $addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @param int $addempty 0=list with no empty value, 1=list with empty value
* @return array Tableau des sources de commandes
*/
function select_methodes_commande($selected='',$htmlname='source_id',$addempty=0)
function selectInputMethod($selected='',$htmlname='source_id',$addempty=0)
{
global $conf,$langs;
$listemethodes=array();
$listofmethods=array();
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form=new Form($this->db);
@ -92,7 +116,7 @@ class FormOrder
$sql.= " FROM ".MAIN_DB_PREFIX."c_input_method";
$sql.= " WHERE active = 1";
dol_syslog(get_class($this)."::select_methodes_commande sql=".$sql);
dol_syslog(get_class($this)."::selectInputMethod sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
@ -101,7 +125,7 @@ class FormOrder
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$listemethodes[$obj->rowid] = $langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):$obj->label;
$listofmethods[$obj->rowid] = $langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):$obj->label;
$i++;
}
}
@ -111,10 +135,10 @@ class FormOrder
return -1;
}
print $form->selectarray($htmlname,$listemethodes,$selected,$addempty);
print $form->selectarray($htmlname,$listofmethods,$selected,$addempty);
return 1;
}
}
?>
?>

View File

@ -49,14 +49,14 @@ class FormPropal
* @param int $short Use short labels
* @return void
*/
function select_propal_statut($selected='',$short=0)
function selectProposalStatus($selected='',$short=0)
{
global $langs;
$sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
$sql .= " WHERE active = 1";
dol_syslog(get_class($this)."::select_propal_statut sql=".$sql);
dol_syslog(get_class($this)."::selectProposalStatus sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{

View File

@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
@ -31,42 +32,41 @@
*/
function bank_prepare_head($object)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/fiche.php?id='.$object->id;
$head[$h][1] = $langs->trans("AccountCard");
$head[$h][2] = 'bankname';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/compta/bank/fiche.php?id=' . $object->id;
$head[$h][1] = $langs->trans("AccountCard");
$head[$h][2] = 'bankname';
$h++;
if ($object->type == 0 || $object->type == 1)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/bankid_fr.php?id='.$object->id;
$head[$h][1] = $langs->trans("RIB");
$head[$h][2] = 'bankid';
$h++;
}
if ($object->type == 0 || $object->type == 1) {
$head[$h][0] = DOL_URL_ROOT . '/compta/bank/bankid_fr.php?id=' . $object->id;
$head[$h][1] = $langs->trans("RIB");
$head[$h][2] = 'bankid';
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/compta/bank/account.php?id=".$object->id;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/account.php?id=" . $object->id;
$head[$h][1] = $langs->trans("Transactions");
$head[$h][2] = 'journal';
$h++;
// if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
// {
$head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id;
$head[$h][1] = $langs->trans("PlannedTransactions");
$head[$h][2] = 'cash';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/treso.php?account=" . $object->id;
$head[$h][1] = $langs->trans("PlannedTransactions");
$head[$h][2] = 'cash';
$h++;
// }
$head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/annuel.php?account=" . $object->id;
$head[$h][1] = $langs->trans("IOMonthlyReporting");
$head[$h][2] = 'annual';
$h++;
$head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/graph.php?account=" . $object->id;
$head[$h][1] = $langs->trans("Graph");
$head[$h][2] = 'graph';
$h++;
@ -79,86 +79,90 @@ function bank_prepare_head($object)
$h++;
}
return $head;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank', 'remove');
return $head;
}
/**
* Check account number informations for a bank account
* Check account number informations for a bank account
*
* @param Account $account A bank account
* @return int True if informations are valid, false otherwise
* @param Account $account A bank account
* @return int True if informations are valid, false otherwise
*/
function checkBanForAccount($account)
{
$country_code=$account->getCountryCode();
$country_code = $account->getCountryCode();
// For compatibility between
// account of type CompanyBankAccount class (we use number, cle_rib)
// account of type Account class (we use num_compte, cle)
if (empty($account->number)) $account->number=$account->num_compte;
if (empty($account->cle)) $account->cle=$account->cle_rib;
// For compatibility between
// account of type CompanyBankAccount class (we use number, cle_rib)
// account of type Account class (we use num_compte, cle)
if (empty($account->number))
$account->number = $account->num_compte;
if (empty($account->cle))
$account->cle = $account->cle_rib;
dol_syslog("bank.lib::checkBanForAccount account->code_banque=".$account->code_banque." account->code_guichet=".$account->code_guichet." account->number=".$account->number." account->cle=".$account->cle." account->iban=".$account->iban." country_code=".$country_code, LOG_DEBUG);
dol_syslog("bank.lib::checkBanForAccount account->code_banque=" . $account->code_banque . " account->code_guichet=" . $account->code_guichet . " account->number=" . $account->number . " account->cle=" . $account->cle . " account->iban=" . $account->iban . " country_code=" . $country_code, LOG_DEBUG);
if ($country_code == 'FR') // France rules
{
$coef = array(62, 34, 3);
// Concatenation des differents codes.
$rib = strtolower(trim($account->code_banque).trim($account->code_guichet).trim($account->number).trim($account->cle));
// On remplace les eventuelles lettres par des chiffres.
//$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678"); //Ne marche pas
$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678923456789");
// Separation du rib en 3 groupes de 7 + 1 groupe de 2.
// Multiplication de chaque groupe par les coef du tableau
for ($i=0, $s=0; $i<3; $i++)
{
$code = substr($rib, 7 * $i, 7);
$s += (0 + $code) * $coef[$i] ;
}
// Soustraction du modulo 97 de $s a 97 pour obtenir la cle
$cle_rib = 97 - ($s % 97);
if ($cle_rib == $account->cle)
{
return true;
}
return false;
}
if ($country_code == 'BE') // Belgium rules
{
}
if ($country_code == 'ES') // Spanish rules
{
$CCC = strtolower(trim($account->number));
$rib = strtolower(trim($account->code_banque).trim($account->code_guichet));
$cle_rib=strtolower(checkES($rib,$CCC));
if ($cle_rib == strtolower($account->cle))
{
return true;
}
return false;
}
if ($country_code == 'AU') // Australian
{
if (strlen($account->code_banque) > 7) return false; // Sould be 6 but can be 123-456
else if (strlen($account->code_banque) < 6) return false; // Sould be 6
else return true;
if ($country_code == 'FR') { // France rules
$coef = array(62, 34, 3);
// Concatenation des differents codes.
$rib = strtolower(trim($account->code_banque) . trim($account->code_guichet) . trim($account->number) . trim($account->cle));
// On remplace les eventuelles lettres par des chiffres.
//$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678"); //Ne marche pas
$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz", "12345678912345678923456789");
// Separation du rib en 3 groupes de 7 + 1 groupe de 2.
// Multiplication de chaque groupe par les coef du tableau
for ($i = 0, $s = 0; $i < 3; $i++) {
$code = substr($rib, 7 * $i, 7);
$s += (0 + $code) * $coef[$i];
}
// Soustraction du modulo 97 de $s a 97 pour obtenir la cle
$cle_rib = 97 - ($s % 97);
if ($cle_rib == $account->cle) {
return true;
}
return false;
}
// No particular rule
// If account is CompanyBankAccount class, we use number
// If account is Account class, we use num_compte
if (empty($account->number))
{
return false;
}
if ($country_code == 'BE') { // Belgium rules
return true;
}
if ($country_code == 'ES') { // Spanish rules
$CCC = strtolower(trim($account->number));
$rib = strtolower(trim($account->code_banque) . trim($account->code_guichet));
$cle_rib = strtolower(checkES($rib, $CCC));
if ($cle_rib == strtolower($account->cle)) {
return true;
}
return false;
}
if ($country_code == 'AU') { // Australian
if (strlen($account->code_banque) > 7)
return false; // Sould be 6 but can be 123-456
else if (strlen($account->code_banque) < 6)
return false; // Sould be 6
else
return true;
}
// No particular rule
// If account is CompanyBankAccount class, we use number
// If account is Account class, we use num_compte
if (empty($account->number)) {
return false;
}
return true;
}
/**
* Returns the key for Spanish Banks Accounts
*
@ -166,60 +170,56 @@ function checkBanForAccount($account)
* @param string $InumCta InumCta
* @return string Key
*/
function checkES($IentOfi,$InumCta)
{
if (empty($IentOfi)||empty($InumCta)||strlen($IentOfi)!=8||strlen($InumCta)!=10)
{
$keycontrol ="";
return $keycontrol;
}
function checkES($IentOfi, $InumCta) {
if (empty($IentOfi) || empty($InumCta) || strlen($IentOfi) != 8 || strlen($InumCta) != 10) {
$keycontrol = "";
return $keycontrol;
}
$ccc= $IentOfi . $InumCta;
$numbers = "1234567890";
$ccc = $IentOfi . $InumCta;
$numbers = "1234567890";
$i = 0;
$i = 0;
while ($i<=strlen($ccc)-1)
{
if (strpos($numbers,substr($ccc,$i,1)) === false)
{
$keycontrol ="";
return $keycontrol;
}
$i++;
}
while ($i <= strlen($ccc) - 1) {
if (strpos($numbers, substr($ccc, $i, 1)) === false) {
$keycontrol = "";
return $keycontrol;
}
$i++;
}
$values = array(1,2,4,8,5,10,9,7,3,6);
$sum = 0;
$values = array(1, 2, 4, 8, 5, 10, 9, 7, 3, 6);
$sum = 0;
for($i=2; $i<10; $i++)
for ($i = 2; $i < 10; $i++) {
$sum += $values[$i] * substr($IentOfi, $i - 2, 1);
}
{
$sum += $values[$i] * substr($IentOfi, $i-2, 1);
}
$key = 11 - $sum % 11;
$key = 11-$sum%11;
if ($key == 10)
$key = 1;
if ($key == 11)
$key = 0;
if ($key==10) $key=1;
if ($key==11) $key=0;
$keycontrol = $key;
$keycontrol = $key;
$sum = 0;
$sum = 0;
for ($i = 0; $i < 11; $i++) {
$sum += $values[$i] * substr($InumCta, $i, 1);
}
for($i=0; $i<11; $i++)
$key = 11 - $sum % 11;
{
$sum += $values[$i] * substr($InumCta,$i, 1);
}
if ($key == 10)
$key = 1;
if ($key == 11)
$key = 0;
$key = 11-$sum%11;
if ($key==10) $key=1;
if ($key==11) $key=0;
$keycontrol .= $key;
return $keycontrol;
$keycontrol .= $key;
return $keycontrol;
}
?>

View File

@ -721,7 +721,15 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
if (!empty($obj->town)) $coords .= $obj->town;
if (!empty($obj->country_id)) $coords .= "<br>".$country_code['label'];
}
print '<a href="#" onclick="return copyToClipboard(\''.dol_escape_js($coords).'\',\''.dol_escape_js($langs->trans("HelpCopyToClipboard")).'\');">';
else if (!empty($object->address))
{
$coords .= dol_nl2br($object->address,1,true)."<br>";
if (!empty($object->zip)) $coords .= $object->zip.' ';
if (!empty($object->town)) $coords .= $object->town;
if (!empty($object->country_id)) $coords .= "<br>".$country_code['label'];
}
// hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
print '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($coords).'\',\''.dol_escape_js($langs->trans("HelpCopyToClipboard")).'\');">';
print img_picto($langs->trans("Address"), 'object_address.png');
print '</a>';
}
@ -733,7 +741,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '<td align="center">';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
print '<a class="hideonsmartphone" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
print img_object($langs->trans("Rendez-Vous"),"action_rdv");
print '</a> ';
}
@ -768,8 +776,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "<br>\n";
?>
<div id="dialog" title="<?php echo dol_escape_htmltag($langs->trans('Address')); ?>" style="display: none;">
</div>
<div id="dialog" title="<?php echo dol_escape_htmltag($langs->trans('Address')); ?>" style="display: none;"></div>
<?php
return $i;

View File

@ -510,6 +510,12 @@ function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
return -3;
}
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
if (empty($newmask)) // This should no happen
{
dol_syslog("Warning: dol_copy called with empty value for newmask and no default value defined", LOG_WARNING);
$newmask='0664';
}
@chmod($newpathofdestfile, octdec($newmask));
return 1;

View File

@ -1063,7 +1063,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
/**
* Return date for now. We should always use this function without parameters (that means GMT time)
* Return date for now. In mot cases, we use this function without parameters (that means GMT time).
*
* @param string $mode 'gmt' => we return GMT timestamp,
* 'tzserver' => we add the PHP server timezone
@ -1073,7 +1073,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
*/
function dol_now($mode='gmt')
{
// Note that gmmktime and mktime return same value (GMT) whithout parameters
// Note that gmmktime and mktime return same value (GMT) when used without parameters
//if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead
if ($mode == 'gmt') $ret=time(); // Time for now at greenwich.
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
@ -1088,7 +1088,7 @@ function dol_now($mode='gmt')
$tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time
$ret=dol_now('gmt')+($tzsecond*3600);
}*/
else if ($mode == 'tzuser') // Time for now with user timezone is added
else if ($mode == 'tzuser') // Time for now with user timezone added
{
//print 'eeee'.time().'-'.mktime().'-'.gmmktime();
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60;
@ -1162,7 +1162,7 @@ function dol_print_url($url,$target='_blank',$max=32)
* @param string $email EMail to show (only email, without 'Name of recipient' before)
* @param int $cid Id of contact if known
* @param int $socid Id of third party if known
* @param int $addlink 0=no link to create action
* @param int $addlink 0=no link, 1=email has a html email link (+ link to create action if constant AGENDA_ADDACTIONFOREMAIL is on)
* @param int $max Max number of characters to show
* @param int $showinvalid Show warning if syntax email is wrong
* @return string HTML Link
@ -2724,6 +2724,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou
if ($outlangs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$outlangs->transnoentitiesnoconv("SeparatorDecimal");
if ($outlangs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$outlangs->transnoentitiesnoconv("SeparatorThousand");
if ($thousand == 'None') $thousand='';
else if ($thousand == 'Space') $thousand=' ';
//print "outlangs=".$outlangs->defaultlang." amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>";
//print "amount=".$amount."-";
@ -2799,6 +2800,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
if ($langs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
if ($thousand == 'None') $thousand='';
elseif ($thousand == 'Space') $thousand=' ';
//print "amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>";
// Convert value to universal number format (no thousand separator, '.' as decimal separator)
@ -4490,6 +4492,34 @@ function printCommonFooter($zone='private')
}
/**
* Split a string with 2 keys into key array.
* For example: "A=1;B=2;C=2" is exploded into array('A'=>1,'B'=>2,'C'=>3)
*
* @param string $string String to explode
* @param string $delimiter Delimiter between each couple of data
* @param string $kv Delimiter between key and value
* @return array Array of data exploded
*/
function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
{
if ($a = explode($delimiter, $string))
{
foreach ($a as $s) { // each part
if ($s) {
if ($pos = strpos($s, $kv)) { // key/value delimiter
$ka[trim(substr($s, 0, $pos))] = trim(substr($s, $pos + strlen($kv)));
} else { // key delimiter not found
$ka[] = trim($s);
}
}
}
return $ka;
}
return array();
}
/**
* Convert an array with RGB value into hex RGB value
*

View File

@ -169,6 +169,11 @@ function member_stats_prepare_head($object)
$head[$h][1] = $langs->trans("Country");
$head[$h][2] = 'statscountry';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbyregion';
$head[$h][1] = $langs->trans("Region");
$head[$h][2] = 'statscregion';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbystate';
$head[$h][1] = $langs->trans("State");

View File

@ -129,9 +129,9 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
// Protection and encryption of pdf
if (empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->PDF_SECURITY_ENCRYPTION))
{
{
/* Permission supported by TCPDF
- print : Print the document;
- print : Print the document;
- modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
- copy : Copy or otherwise extract text and graphics from the document;
- annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
@ -146,8 +146,8 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
// For TCPDF, we specify permission we want to block
$pdfrights = array('modify','copy');
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
$pdfuserpass = ''; // Password for the end user
$pdfownerpass = NULL; // Password of the owner, created randomly if not defined
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
}
else
@ -161,8 +161,8 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
{
// Declare here a class to overwrite FPDI to add method writeHTMLCell
/**
* This class if a enhanced FPDI class that support method writeHTMLCell
*/
* This class if a enhanced FPDI class that support method writeHTMLCell
*/
class FPDI_DolExtended extends FPDI
{
/**
@ -259,7 +259,7 @@ function pdf_getPDFFontSize($outputlangs)
/**
* Return height to use for Logo onot PDF
* Return height to use for Logo onto PDF
*
* @param string $logo Full path to logo file to use
* @param bool $url Image with url (true or false)
@ -312,7 +312,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
{
// Tel
// Phone
if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->phone);
// Fax
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
@ -345,7 +345,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
{
// Tel
// Phone
if ($targetcontact->phone_pro) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->phone_pro);
// Fax
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
@ -363,7 +363,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
{
// Tel
// Phone
if ($targetcompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->phone);
// Fax
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
@ -411,7 +411,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
{
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($deliverycompany))."\n";
// Tel
// Phone
if ($deliverycompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($deliverycompany->phone);
// Fax
if ($deliverycompany->fax) $stringaddress .= ($stringaddress ? ($deliverycompany->phone ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($deliverycompany->fax);
@ -447,7 +447,7 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
* @param Translate $outputlangs Object lang
* @param int $h Height of PDF
* @param int $w Width of PDF
* @param string $unit Unit of height (mmn, pt, ...)
* @param string $unit Unit of height (mm, pt, ...)
* @param string $text Text to show
* @return void
*/
@ -783,7 +783,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$pdf->SetFont('','',7);
$pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
// The start of the bottom of this page footer is positioned according to # of lines
$freetextheight=0;
if ($line) // Free text
{
@ -901,7 +901,7 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
* @param int $posx Pos x
* @param int $posy Pos y
* @param int $hideref Hide reference
* @param int $hidedesc Hide description
* @param int $hidedesc Hide description
* @param int $issupplierline Is it a line for a supplier object ?
* @return void
*/
@ -1015,7 +1015,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
// If line linked to a product
if ($idprod)
{
// On ajoute la ref
// We add ref
if ($prodser->ref)
{
$prefix_prodserv = "";

View File

@ -342,12 +342,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Date start
print '<td align="center">';
print dol_print_date($lines[$i]->date_start,'day');
print dol_print_date($lines[$i]->date_start,'dayhour');
print '</td>';
// Date end
print '<td align="center">';
print dol_print_date($lines[$i]->date_end,'day');
print dol_print_date($lines[$i]->date_end,'dayhour');
print '</td>';
// Planned Workload (in working hours)
@ -500,12 +500,12 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
// Date start
print '<td align="center">';
print dol_print_date($lines[$i]->date_start,'day');
print dol_print_date($lines[$i]->date_start,'dayhour');
print '</td>';
// Date end
print '<td align="center">';
print dol_print_date($lines[$i]->date_end,'day');
print dol_print_date($lines[$i]->date_end,'dayhour');
print '</td>';
// Planned Workload

View File

@ -133,7 +133,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
// More parameters
$params = explode('&', $dbtablename);
$dbtablename=(! empty($params[0]) ? $params[0] : '');
$sharedelement=(! empty($params[1]) ? $params[1] : '');
$sharedelement=(! empty($params[1]) ? $params[1] : $dbtablename);
$listofmodules=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);

View File

@ -102,6 +102,7 @@ function tree_showpad(&$fulltree,$key,$silent=0)
* $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
* '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
* $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
* TODO Replace with jstree plugin instead of treeview plugin.
*
* @param array $tab Array of all elements
* @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>)

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* Core function to output top menu eldy
*
* @param DoliDB $db Database handler
* @param string $atarget Target
* @param string $atarget Target (Example: '' or '_top')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array &$menu Object Menu to return back list of menu entries
@ -443,7 +443,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"]));
// Show logo company
if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO))
if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO))
{
$mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
@ -1253,6 +1253,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! is_array($menu_array)) return 0;
// Show menu
$invert=empty($conf->global->MAIN_MENU_INVERT)?"":"invert";
if (empty($noout))
{
$alt=0; $blockvmenuopened=false;
@ -1268,11 +1269,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$blockvmenuopened=true;
if (($alt%2==0))
{
print '<div class="blockvmenuimpair">'."\n";
print '<div class="blockvmenuimpair'.$invert.'">'."\n";
}
else
{
print '<div class="blockvmenupair">'."\n";
print '<div class="blockvmenupair'.$invert.'">'."\n";
}
}
@ -1283,7 +1284,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
for ($j=0; $j < $tabul; $j++)
{
$tabstring.='&nbsp; &nbsp;';
$tabstring.='&nbsp; &nbsp; &nbsp;';
}
}

View File

@ -131,8 +131,18 @@ class MenuManager
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
$this->menu=new Menu();
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if (empty($conf->global->MAIN_MENU_INVERT))
{
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
}
else
{
$conf->global->MAIN_SHOW_LOGO=0;
if ($mode == 'top') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'left') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
}
if ($mode == 'jmobile')
{
$res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
@ -167,7 +177,7 @@ class MenuManager
// We add sub entry
print str_pad('',1).'<li data-role="list-dividerxxx" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'"';
//print ' data-ajax="false"';
//print ' data-ajax="false"';
print '>';
print str_pad('',12,'&nbsp;');
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation
@ -185,10 +195,10 @@ class MenuManager
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
if ($val2['level']==0) print str_pad('',$val2['level']+1).'<li'.($val2['level']==0?' data-role="list-dividerxxx"':'').' class="lilevel'.($val2['level']+1).' ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
else print str_pad('',$val2['level']+1).'<li class="lilevel'.($val2['level']+1).'">'; // ui-btn to highlight on clic
if ($relurl2)
if ($relurl2)
{
print '<a href="'.$relurl2.'"';
//print ' data-ajax="false"';
//print ' data-ajax="false"';
print '>';
}
print str_pad('',($val2['level']+1)*12,'&nbsp;');

View File

@ -222,7 +222,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
else
{
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt');
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
}
}
@ -232,34 +232,24 @@ class doc_generic_order_odt extends ModelePDFCommandes
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
$texte.= '<table><tr><td>';
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte.= '<textarea class="flat" cols="60" name="value1">';
$texte.=$conf->global->COMMANDE_ADDON_PDF_ODT_PATH;
$texte.= '</textarea>';
$texte.= '</td>';
$texte.= '<td align="center">&nbsp; ';
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';
$texte.= '</table>';
$texte.= '<br></div></div>';
// Scan directories
if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
$texte.= '</td>';
$texte.= '<td valign="top" rowspan="2">';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte.= '</td>';
$texte.= '</tr>';
/*$texte.= '<tr>';
$texte.= '<td align="center">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';*/
$texte.= '</table>';
$texte.= '</form>';

View File

@ -605,20 +605,6 @@ class pdf_einstein extends ModelePDFCommandes
$posy=$pdf->GetY()+1;
}
*/
/*if (! empty($object->date_livraison))
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','B', $default_font_size - 2);
$text=$outputlangs->transnoentities("DeliveryDate").':';
$pdf->MultiCell(80, 3, $text, 0, 'L', 0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$text=dol_print_date($object->date_livraison,'day','',$outputlangs);
$pdf->MultiCell(80, 3, $text, 0, 'L', 0);
$posy=$pdf->GetY()+1;
}*/
/* TODO
else if (! empty($object->availability_code))
{
@ -631,8 +617,8 @@ class pdf_einstein extends ModelePDFCommandes
$posy=$pdf->GetY()+1;
}*/
// Show shipping date
if ($object->date_livraison)
// Show planed date of delivery
if (! empty($object->date_livraison))
{
$outputlangs->load("sendings");
$pdf->SetFont('','B', $default_font_size - 2);

View File

@ -212,7 +212,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
else
{
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt');
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
}
}
@ -222,34 +222,24 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
$texte.= '<table><tr><td>';
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte.= '<textarea class="flat" cols="60" name="value1">';
$texte.=$conf->global->EXPEDITION_ADDON_PDF_ODT_PATH;
$texte.= '</textarea>';
$texte.= '</td>';
$texte.= '<td align="center">&nbsp; ';
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';
$texte.= '</table>';
$texte.= '<br></div></div>';
// Scan directories
if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
$texte.= '</td>';
$texte.= '<td valign="top" rowspan="2">';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte.= '</td>';
$texte.= '</tr>';
/*$texte.= '<tr>';
$texte.= '<td align="center">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';*/
$texte.= '</table>';
$texte.= '</form>';

View File

@ -223,7 +223,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$texte.= '<table class="nobordernopadding" width="100%">';
// List of directories area
$texte.= '<tr><td>';
$texte.= '<tr><td valign="middle">';
$texttitle=$langs->trans("ListOfDirectories");
$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->FACTURE_ADDON_PDF_ODT_PATH)));
$listoffiles=array();
@ -247,34 +247,24 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
$texte.= '<table><tr><td>';
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte.= '<textarea class="flat" cols="60" name="value1">';
$texte.=$conf->global->FACTURE_ADDON_PDF_ODT_PATH;
$texte.= '</textarea>';
$texte.= '</td>';
$texte.= '<td align="center">&nbsp; ';
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';
$texte.= '</table>';
$texte.= '<br></div></div>';
// Scan directories
if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
$texte.= '</td>';
$texte.= '<td valign="top" rowspan="2">';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte.= '</td>';
$texte.= '</tr>';
/*$texte.= '<tr>';
$texte.= '<td align="center">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';*/
$texte.= '</table>';
$texte.= '</form>';

View File

@ -178,7 +178,7 @@ class modFacture extends DolibarrModules
$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancyBuyCode');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product');

View File

@ -250,10 +250,10 @@ class modFournisseur extends DolibarrModules
$this->export_label[$r]='Factures fournisseurs et lignes de facture';
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("fournisseur","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -76,7 +76,7 @@ class modOpenSurvey extends DolibarrModules
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(4,1); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module
$this->need_dolibarr_version = array(3,4,0); // Minimum version of Dolibarr required by module
// Constants
$this->const = array(); // List of parameters
@ -121,7 +121,7 @@ class modOpenSurvey extends DolibarrModules
// Main menu entries
$this->menus = array(); // List of menus to add
$r=0;
/*
$this->menu[$r]=array( 'fk_menu'=>0, // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'top',
'titre'=>'Surveys',
@ -133,14 +133,14 @@ class modOpenSurvey extends DolibarrModules
'perms'=>'$user->rights->opensurvey->read',
'target'=>'',
'user'=>0);
$r++;
$r++;*/
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'Survey',
'mainmenu'=>'opensurvey',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey',
'url'=>'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey',
'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
'langs'=>'opensurvey',
'position'=>200,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
@ -149,10 +149,10 @@ class modOpenSurvey extends DolibarrModules
'user'=>0);
$r++;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'NewSurvey',
'mainmenu'=>'opensurvey',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey_new',
'url'=>'/opensurvey/wizard/index.php',
'langs'=>'opensurvey',
@ -163,10 +163,10 @@ class modOpenSurvey extends DolibarrModules
'user'=>0);
$r++;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'List',
'mainmenu'=>'opensurvey',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey_list',
'url'=>'/opensurvey/list.php',
'langs'=>'opensurvey',

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@ -184,12 +184,6 @@ class modProjet extends DolibarrModules
$this->export_permission[$r]=array(array("projet","export"));
$this->export_dependencies_array[$r]=array('task_time'=>'ppt.rowid');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'Status','p.description'=>"Description",
'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateStart",'pt.datee'=>"TaskDateEnd",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"PlannedWorkload",'pt.progress'=>"Progress",'pt.description'=>"TaskDescription",
'ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote");
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle',
's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text",
@ -198,15 +192,96 @@ class modProjet extends DolibarrModules
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'p.description'=>"project",
'pt.rowid'=>'projecttask','pt.dateo'=>"projecttask",'pt.datee'=>"projecttask",'pt.duration_effective'=>"projecttask",'pt.planned_workload'=>"projecttask",'pt.progress'=>"projecttask",'pt.description'=>"projecttask",
'ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time");
'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'p.description'=>"project");
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'societe as s)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON (p.rowid = pt.fk_projet)";
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON (pt.rowid = ptt.fk_task)";
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'Status','p.description'=>"Description");
// Add fields for project
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array());
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='project';
}
}
// End add extra fields
// Add fields for tasks
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateStart",'pt.datee'=>"TaskDateEnd",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"PlannedWorkload",'pt.progress'=>"Progress",'pt.description'=>"TaskDescription"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask','pt.dateo'=>"projecttask",'pt.datee'=>"projecttask",'pt.duration_effective'=>"projecttask",'pt.planned_workload'=>"projecttask",'pt.progress'=>"projecttask",'pt.description'=>"projecttask"));
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra2.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='projecttask';
}
}
// End add extra fields
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"));
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet";
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task,";
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' AND p.entity = '.$conf->entity;
@ -228,6 +303,47 @@ class modProjet extends DolibarrModules
// Permissions
$this->remove($options);
//ODT template for project
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/projects';
$dest=$dirodt.'/template_project.odt';
if (file_exists($src) && ! file_exists($dest))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_mkdir($dirodt);
$result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
return 0;
}
}
//ODT template for tasks
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/tasks';
$dest=$dirodt.'/template_task_summary.odt';
if (file_exists($src) && ! file_exists($dest))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_mkdir($dirodt);
$result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
return 0;
}
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")"
);
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','project',".$conf->entity.")",

View File

@ -322,7 +322,7 @@ class doc_generic_project_odt extends ModelePDFProjects
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
else
{
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt');
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
}
}
@ -332,34 +332,24 @@ class doc_generic_project_odt extends ModelePDFProjects
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
$texte.= '<table><tr><td>';
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte.= '<textarea class="flat" cols="60" name="value1">';
$texte.=$conf->global->PROJECT_ADDON_PDF_ODT_PATH;
$texte.= '</textarea>';
$texte.= '</td>';
$texte.= '<td align="center">&nbsp; ';
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';
$texte.= '</table>';
$texte.= '<br></div></div>';
// Scan directories
if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
$texte.= '</td>';
$texte.= '<td valign="top" rowspan="2">';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte.= '</td>';
$texte.= '</tr>';
/*$texte.= '<tr>';
$texte.= '<td align="center">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';*/
$texte.= '</table>';
$texte.= '</form>';
@ -851,46 +841,56 @@ class doc_generic_project_odt extends ModelePDFProjects
'propal'=>array(
'title'=>"ListProposalsAssociatedProject",
'class'=>'Propal',
'test'=>$conf->propal->enabled),
'table'=>'propal',
'test'=>$conf->propal->enabled && $user->rights->propale->lire),
'order'=>array(
'title'=>"ListOrdersAssociatedProject",
'class'=>'Commande',
'test'=>$conf->commande->enabled),
'table'=>'commande',
'test'=>$conf->commande->enabled && $user->rights->commande->lire),
'invoice'=>array(
'title'=>"ListInvoicesAssociatedProject",
'class'=>'Facture',
'test'=>$conf->facture->enabled),
'table'=>'facture',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'invoice_predefined'=>array(
'title'=>"ListPredefinedInvoicesAssociatedProject",
'class'=>'FactureRec',
'test'=>$conf->facture->enabled),
'table'=>'facture_rec',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'order_supplier'=>array(
'title'=>"ListSupplierOrdersAssociatedProject",
'table'=>'commande_fournisseur',
'class'=>'CommandeFournisseur',
'test'=>$conf->fournisseur->enabled),
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire),
'invoice_supplier'=>array(
'title'=>"ListSupplierInvoicesAssociatedProject",
'table'=>'facture_fourn',
'class'=>'FactureFournisseur',
'test'=>$conf->fournisseur->enabled),
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire),
'contract'=>array(
'title'=>"ListContractAssociatedProject",
'class'=>'Contrat',
'test'=>$conf->contrat->enabled),
'table'=>'contrat',
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
'intervention'=>array(
'title'=>"ListFichinterAssociatedProject",
'class'=>'Fichinter',
'table'=>'fichinter',
'disableamount'=>1,
'test'=>$conf->ficheinter->enabled),
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
'trip'=>array(
'title'=>"ListTripAssociatedProject",
'class'=>'Deplacement',
'table'=>'deplacement',
'disableamount'=>1,
'test'=>$conf->deplacement->enabled),
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
'agenda'=>array(
'title'=>"ListActionsAssociatedProject",
'class'=>'ActionComm',
'table'=>'actioncomm',
'disableamount'=>1,
'test'=>$conf->agenda->enabled)
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire)
);
//Insert reference
@ -901,11 +901,12 @@ class doc_generic_project_odt extends ModelePDFProjects
foreach ($listofreferent as $keyref => $valueref)
{
$title=$valueref['title'];
$tablename=$valueref['table'];
$classname=$valueref['class'];
$qualified=$valueref['test'];
if ($qualified)
{
$elementarray = $object->get_element_list($keyref);
$elementarray = $object->get_element_list($keyref, $tablename);
if (count($elementarray)>0 && is_array($elementarray))
{
$var=true;

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