diff --git a/ChangeLog b/ChangeLog index 3bac0d7f4f3..1f76a3d4351 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ For users: public votes - New: The box "balance of bank accounts" show all opened accounts. - New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE. +- New: Add warning if supplier payment is higher that due amount. TODO - New: Predefined product and free product use same form. diff --git a/build/debian/changelog b/build/debian/changelog index 213f8bc0400..bf65a5a43e3 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -10,7 +10,7 @@ dolibarr (3.5.0-3) unstable; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. - -- Laurent Destailleur (eldy) Mon, 30 Dec 2013 12:00:00 +0100 + -- Laurent Destailleur (eldy) Fri, 31 Jan 2014 12:00:00 +0100 dolibarr (3.4.2-3) unstable; urgency=low @@ -24,11 +24,11 @@ dolibarr (3.4.1-3) unstable; urgency=low [ Laurent Destailleur (eldy) ] * Maintenance release. - -- Laurent Destailleur (eldy) Mon, 22 Apr 2013 12:00:00 +0100 + -- Laurent Destailleur (eldy) Mon, 27 Apr 2013 12:00:00 +0100 dolibarr (3.4.0-3) unstable; urgency=low [ Laurent Destailleur (eldy) ] * Maintenance release. - -- Laurent Destailleur (eldy) Mon, 22 Apr 2013 12:00:00 +0100 + -- Laurent Destailleur (eldy) Mon, 22 Apr 2013 12:00:00 +0100 diff --git a/build/debian/control b/build/debian/control index 7a75e209870..a293319d453 100755 --- a/build/debian/control +++ b/build/debian/control @@ -1,40 +1,47 @@ Source: dolibarr -Maintainer: Laurent Destailleur (eldy) -Uploaders: Laurent Destailleur (eldy) -Standards-Version: 3.9.2 Section: web Priority: optional +Maintainer: Laurent Destailleur (eldy) +Uploaders: Laurent Destailleur (eldy) +Standards-Version: 3.9.4 Homepage: http://www.dolibarr.org -Build-Depends: debhelper (>= 7), po-debconf, dpatch +Build-Depends: debhelper (>= 9), po-debconf, dpatch Comments: This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version Package: dolibarr +Architecture: all Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5, - php5-mysql | php5-mysqli, - php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip, - libphp-adodb, - libnusoap-php, - libphp-pclzip, - libfpdi-php, libfpdf-tpl-php, php-fpdf, - libjs-jquery, libjs-jquery-ui, libjs-flot, ckeditor, - ttf-dejavu-core, + php5-cli, +# Required PHP extensions + 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, +# libphp-adodb, +# libnusoap-php, +# libphp-pclzip, +# Required javascript libraries +# libjs-jquery, libjs-jquery-ui, libjs-flot, ckeditor, +# Misc dependencies +# fonts-dejavu-core | ttf-dejavu-core, xdg-utils, mysql-server, ${misc:Depends}, ${perl:Depends} -Recommends: apache2 | lighttpd | httpd, mysql-client +Recommends: mysql-client, apache2 | lighttpd | httpd Suggests: www-browser -Architecture: all Description: Web based software to manage a small company or foundation Dolibarr ERP & CRM is an easy to use open source/free software for small and medium companies, foundations or freelances. It includes different features for Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) but also for different other activities. + . It's a web software you can install as a standalone program or on any web hosting provider to use it from anywhere with any web browser. . - Dolibarr was designed to be easy to use. Only features you need are + Dolibarr was designed to be easy to use. Only the features that you need are visible, depending on which modules were activated. + . Most common used modules are: . Customers, Suppliers or Prospects directory, diff --git a/build/debian/dolibarr.install b/build/debian/dolibarr.install index 106a3b7dcf8..72dff46ed15 100755 --- a/build/debian/dolibarr.install +++ b/build/debian/dolibarr.install @@ -6,7 +6,7 @@ debian/lighttpd/50-dolibarr.conf etc/lighttpd/conf-available/ debian/install.forced.php.install etc/dolibarr/ htdocs usr/share/dolibarr/ scripts usr/share/dolibarr/ -ChangeLog usr/share/doc/dolibarr/ +changelog usr/share/doc/dolibarr/ README usr/share/doc/dolibarr/ doc/install usr/share/doc/dolibarr/ doc/user usr/share/doc/dolibarr/ diff --git a/build/debian/dolibarr.postinst b/build/debian/dolibarr.postinst index 40fb4142c40..f45ab7680c4 100644 --- a/build/debian/dolibarr.postinst +++ b/build/debian/dolibarr.postinst @@ -13,6 +13,11 @@ set -e # # for details, see /usr/share/doc/packaging-manual/ +if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + # Needs to be run outside of functions to have access to parameters + . /usr/share/apache2/apache2-maintscript-helper +fi + setup_empty_conf() { echo Create empty file $config mkdir -p /etc/dolibarr @@ -37,20 +42,23 @@ enable_install_upgrade_wizard() { apache_install() { webserver=$1 - if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then - echo "Add link for Apache config file" - ln -s /etc/$webserver/conf-available/dolibarr.conf /etc/$webserver/conf.d/dolibarr.conf + if which a2enconf >/dev/null 2>&1 ;then + # a2enconf exists for ubuntu only + a2enconf dolibarr + else + if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then + echo "Add link for Apache config file" + ln -s /etc/$webserver/conf-available/dolibarr.conf /etc/$webserver/conf.d/dolibarr.conf + fi fi } lighttpd_install() { - if [ ! -f /etc/lighttpd/conf-available/50-dolibarr.conf ] ; then - if which lighty-enable-mod >/dev/null 2>&1 ; then - echo "Enable lighttpd link for dolibarr config file" - lighty-enable-mod dolibarr fastcgi-php - else - echo "Lighttpd not installed, skipping" - fi + if which lighty-enable-mod >/dev/null 2>&1 ; then + echo "Enable lighttpd link for dolibarr config file" + lighty-enable-mod dolibarr fastcgi-php + else + echo "Lighttpd not installed, skipping" fi } @@ -79,6 +87,12 @@ case "$1" in else echo This is not a first install fi + + # Apache 2 setup + if which a2enmod >/dev/null 2>&1 ;then + a2enmod alias + fi + apache_install lighttpd_install diff --git a/build/debian/dolibarr.postrm b/build/debian/dolibarr.postrm index 38ebf8399c2..fa16ed582f0 100644 --- a/build/debian/dolibarr.postrm +++ b/build/debian/dolibarr.postrm @@ -177,18 +177,19 @@ case "$1" in passopt="--password='"`echo "$dbadmpass" | sed -e "s/'/'"'"'"'"'"'"'/g"`"'" fi mysqlcmd="mysql $hostopt $passopt -u $dbadmin" - + mysqlcmdnopass="mysql $hostopt -u $dbadmin" + # Now run the drop user if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'localhost';\"" ; then echo postrm Database login $dbuser@localhost removed else - error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'localhost';\"" + error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'localhost';\"" echo postrm $error fi if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'%';\"" ; then echo postrm Database login $dbuser@% removed else - error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'%';\"" + error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'%';\"" echo postrm $error fi diff --git a/build/debian/install.forced.php.install b/build/debian/install.forced.php.install index f5b663b3f4c..370cb5353de 100755 --- a/build/debian/install.forced.php.install +++ b/build/debian/install.forced.php.install @@ -27,20 +27,20 @@ $force_install_lockinstall='444'; // Value to overwrite path to use shared libraries/fonts instead of embedded one. // If we enable/disable libraries declaration during install, we must also check they are -// not removed from package (see in rules file), -// declared into dependencies (see in control file) -$force_dolibarr_lib_TCPDF_PATH=''; -$force_dolibarr_lib_FPDF_PATH='/usr/share/php/fpdf'; -$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; -$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; -$force_dolibarr_lib_GEOIP_PATH=''; -$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_JQUERY='/javascript/jquery'; -$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; -$force_dolibarr_js_JQUERY_FLOT='/javascript/flot'; -$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; +// - not removed from package (see rm in rules file), +// - declared into dependencies (see Depends in control file) +//$force_dolibarr_lib_TCPDF_PATH=''; +//$force_dolibarr_lib_FPDF_PATH='/usr/share/php/fpdf'; +//$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; +//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; +//$force_dolibarr_lib_GEOIP_PATH=''; +//$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_JQUERY='/javascript/jquery'; +//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; +//$force_dolibarr_js_JQUERY_FLOT='/javascript/flot'; +//$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?> \ No newline at end of file diff --git a/build/debian/rules b/build/debian/rules index 2ab8af290c1..b1b7ca09aff 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -90,32 +90,33 @@ clean: rm -fr build/rpm rm -fr build/zip - # clean from all embedded libraries (we use package dependencies instead) - rm -fr htdocs/includes/adodbtime - rm -fr htdocs/includes/ckeditor + # clean from all PHP embedded libraries (we use package dependencies instead) +# rm -fr htdocs/includes/adodbtime # rm -fr htdocs/includes/fpdfi - rm -fr htdocs/includes/fonts - rm -fr htdocs/includes/geoip - rm -fr htdocs/includes/nusoap - rm -fr htdocs/includes/odtphp/zip/pclzip - rm -fr htdocs/includes/phpmailer - rm -fr htdocs/includes/jquery/css - rm -fr htdocs/includes/jquery/js - rm -fr htdocs/includes/jquery/plugins/flot - rm -fr htdocs/includes/jquery/plugins/jstree - rm -fr htdocs/includes/jquery/plugins/lightbox +# rm -fr htdocs/includes/geoip +# rm -fr htdocs/includes/nusoap +# rm -fr htdocs/includes/odtphp/zip/pclzip + # clean from all JS-CSS embedded libraries (we use package dependencies instead) +# rm -fr htdocs/includes/ckeditor +# rm -fr htdocs/includes/jquery/js +# rm -fr htdocs/includes/jquery/css +# rm -fr htdocs/includes/jquery/plugins/flot + # clean from all embedded fonts (we use package dependencies instead) +# rm -fr htdocs/includes/fonts + + # clean from useless files rm -fr htdocs/includes/jquery/plugins/multiselect rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip rm -fr htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33 rm -fr htdocs/includes/tcpdf/fonts/freefont-20100919 rm -fr htdocs/includes/tcpdf/fonts/utils - # clean from files to avoid warning of missing dependencies rm -fr htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.py - # Licence files are included into copyright file. - rm -fr htdocs/includes/phpexcel/license.txt + # Licence files are already included into copyright file. + rm -f htdocs/includes/jquery/plugins/flot/LICENSE.txt + rm -f htdocs/includes/phpexcel/license.txt rm -f htdocs/includes/tcpdf/LICENSE.TXT dh $@ diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index cba8e7df168..825f3047e27 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -46,7 +46,7 @@ $FILENAMETGZ="$PROJECT-$MAJOR.$MINOR.$BUILD"; $FILENAMEZIP="$PROJECT-$MAJOR.$MINOR.$BUILD"; $FILENAMEXZ="$PROJECT-$MAJOR.$MINOR.$BUILD"; $FILENAMERPM="$PROJECT-$MAJOR.$MINOR.$BUILD-$RPMSUBVERSION"; -$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${BUILD}"; +$FILENAMEDEB="see later"; $FILENAMEAPS="$PROJECT-$MAJOR.$MINOR.$BUILD.app"; $FILENAMEEXEDOLIWAMP="DoliWamp-$MAJOR.$MINOR.$BUILD"; if (-d "/usr/src/redhat") { $RPMDIR="/usr/src/redhat"; } # redhat @@ -365,6 +365,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 -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; @@ -613,15 +615,17 @@ if ($nboftargetok) { $newbuild =~ s/(dev|alpha)/1/gi; # dev $newbuild =~ s/beta/2/gi; # beta $newbuild =~ s/rc./3/gi; # rc - if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale - # now newbuild is 0-1 or 0-4 for example + if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale is same than rc + # now newbuild is 0-1 or 0-3 for example print "Version is $MAJOR.$MINOR.$newbuild\n"; $build = $newbuild; $build =~ s/-.*$//g; # now build is 0 for example # $build .= '+nmu1'; # now build is 0+nmu1 for example - + + $FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}"; + print "Remove target ${FILENAMEDEB}_all.deb...\n"; unlink("$NEWDESTI/${FILENAMEDEB}_all.deb"); print "Remove target ${FILENAMEDEB}.dsc...\n"; @@ -676,12 +680,14 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; # We remove embedded libraries or fonts (this is also inside rules file, target clean) - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/fonts`, - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/geoip`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/nusoap`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/odtphp/zip/pclzip`; - + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor`; + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/fonts`, + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/geoip`; + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/nusoap`; + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/odtphp/zip/pclzip`; + # Rename upstream changelog to match debian rules + $ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`; + # Prepare source package (init debian dir) print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; @@ -753,6 +759,8 @@ if ($nboftargetok) { chdir("$olddir"); + print "You can check package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n"; + # Move to final dir print "Move *_all.deb to $NEWDESTI\n"; $ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index e577f90b625..47a05684223 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -88,7 +88,7 @@ print '
'; // Show info setup module print img_picto('','puce').' '.$langs->trans("SetupDescription4",DOL_URL_ROOT.'/admin/modules.php?mainmenu=home'); -if (count($conf->modules) <= (empty($conf->global->MAIN_MINNB_MODULE)?1:$conf->global->MAIN_MINNB_MODULE)) // If only user module enabled +if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled { $langs->load("errors"); $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete")); @@ -97,6 +97,7 @@ if (count($conf->modules) <= (empty($conf->global->MAIN_MINNB_MODULE)?1:$conf->g print '
'; print '
'; print '
'; +print '
'; // Add hook to add information $reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 217b184f1d9..901b43a0d48 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -103,7 +103,6 @@ print "\n"; $var=!$var; print ''.$langs->trans("CashDeskThirdPartyForSell").''; print ''; -//print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,1); print $form->select_thirdparty($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',0,array(),1); print ''; if (! empty($conf->banque->enabled)) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 3b9d257314e..ce369effb49 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke @@ -21,8 +21,8 @@ /** * \file htdocs/compta/paiement.php - * \ingroup compta - * \brief Page to create a payment + * \ingroup facture + * \brief Payment page for customers invoices */ require '../main.inc.php'; @@ -34,7 +34,7 @@ $langs->load('companies'); $langs->load('bills'); $langs->load('banks'); -$action = GETPOST('action'); +$action = GETPOST('action','alpha'); $confirm = GETPOST('confirm'); $facid = GETPOST('facid','int'); @@ -66,40 +66,51 @@ if ($facid > 0) } // Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('paiementcard')); $parameters=array('socid'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks /* - * Action add_paiement et confirm_paiement + * Actions */ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes')) { $error = 0; - $datepaye = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $paiement_id = 0; - $totalpaiement = 0; + $totalpayment = 0; $atleastonepaymentnotnull = 0; - // Verifie si des paiements sont superieurs au montant facture + // Generate payment array and check if there is payment higher than invoice and payment date before invoice date + $tmpinvoice=new Facture($db); foreach ($_POST as $key => $value) { if (substr($key,0,7) == 'amount_') { $cursorfacid = substr($key,7); - $amounts[$cursorfacid] = price2num(trim($_POST[$key])); - $totalpaiement = $totalpaiement + $amounts[$cursorfacid]; + $amounts[$cursorfacid] = price2num(trim(GETPOST($key))); + $totalpayment = $totalpayment + $amounts[$cursorfacid]; if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++; - $tmpfacture=new Facture($db); - $tmpfacture->fetch($cursorfacid); - $amountsresttopay[$cursorfacid]=price2num($tmpfacture->total_ttc-$tmpfacture->getSommePaiement()); - if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) + $result=$tmpinvoice->fetch($cursorfacid); + if ($result <= 0) dol_print_error($db); + $amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement()); + if ($amounts[$cursorfacid]) { - $addwarning=1; - $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay"); + // Check amount + if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) + { + $addwarning=1; + $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay"); + } + // Check date + if ($datepaye && ($datepaye < $tmpinvoice->date)) + { + $langs->load("errors"); + $error++; + setEventMessage($langs->transnoentities("ErrorPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'errors'); + } } $formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]); @@ -109,7 +120,7 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye // Check parameters if (! GETPOST('paiementcode')) { - $fiche_erreur_message = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')).'
'; + setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors'); $error++; } @@ -118,20 +129,20 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye // If bank module is on, account is required to enter a payment if (GETPOST('accountid') <= 0) { - $fiche_erreur_message = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'
'; + setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors'); $error++; } } - if (empty($totalpaiement) && empty($atleastonepaymentnotnull)) + if (empty($totalpayment) && empty($atleastonepaymentnotnull)) { - $fiche_erreur_message = '
'.$langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')).'
'; + setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors'); $error++; } if (empty($datepaye)) { - $fiche_erreur_message = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')).'
'; + setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors'); $error++; } } @@ -155,7 +166,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes') { $error=0; - $datepaye = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $db->begin(); @@ -174,7 +185,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes') // Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement if (GETPOST('accountid') <= 0) { - $fiche_erreur_message = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors'); $error++; } } @@ -192,7 +203,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes') $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); if ($paiement_id < 0) { - $errmsg=$paiement->error; + setEventMessage($paiement->error, 'errors'); $error++; } } @@ -204,7 +215,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes') $result=$paiement->addPaymentToBank($user,'payment',$label,GETPOST('accountid'),GETPOST('chqemetteur'),GETPOST('chqbank')); if ($result < 0) { - $errmsg=$paiement->error; + setEventMessage($paiement->error, 'errors'); $error++; } } @@ -259,8 +270,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($facture->type == 2) $title.=$langs->trans("EnterPaymentDueToCustomer"); print_fiche_titre($title); - dol_htmloutput_errors($errmsg); - // Initialize data for confirmation (this is used because data can be change during confirmation) if ($action == 'add_paiement') { @@ -625,7 +634,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $db->free($resql); } else - { + { dol_print_error($db); } @@ -649,21 +658,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; } - - - // Message d'erreur - if ($fiche_erreur_message) - { - print $fiche_erreur_message; - } - // Form to confirm payment if ($action == 'add_paiement') { $preselectedchoice=$addwarning?'no':'yes'; print '
'; - $text=$langs->trans('ConfirmCustomerPayment',$totalpaiement,$langs->trans("Currency".$conf->currency)); + $text=$langs->trans('ConfirmCustomerPayment',$totalpayment,$langs->trans("Currency".$conf->currency)); if (GETPOST('closepaidinvoices')) { $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); @@ -728,10 +729,10 @@ if (! GETPOST('action')) print ''.dol_print_date($db->jdate($objp->dp))."\n"; print ''.$objp->paiement_type.' '.$objp->num_paiement."\n"; print ''.price($objp->amount).' '; - + $parameters=array(); $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook - + print ''; $i++; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0caa16a6271..49aff9b83c0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -667,7 +667,7 @@ class Form /** - * Return list of company for customer in Ajax if Ajax activated or go to select_thirparty_list + * Return HTML code to select a company. * * @param int $selected Preselected products * @param string $htmlname Name of HTML seletc field (must be unique in page) @@ -675,12 +675,14 @@ class Form * @param int $limit Limit on number of returned lines * @param array $ajaxoptions Options for ajax_autocompleter * @param int $forcecombo Force to use combo box - * @return void + * @return string Return select box for thirdparty. */ function select_thirdparty($selected='', $htmlname='productid', $filter='', $limit=20, $ajaxoptions=array(), $forcecombo=0) { global $langs,$conf; + $out=''; + /* TODO Use ajax autocompletion (not finished) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) { @@ -711,8 +713,10 @@ class Form } else {*/ - print $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0,$limit); + $out.=$this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0,$limit); //} + + return $out; } /** diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 041235682d2..cc5ca841c52 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -305,6 +305,7 @@ function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0) global $conf; if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works) + if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; /* Some properties for combobox: minLengthToAutocomplete: 2, diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 7c4f4c0c99b..b3983a0c5ab 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -132,7 +132,7 @@ function invoice_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name { $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 535b77a3ee3..46dca55fb3a 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -138,7 +138,7 @@ function order_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name { $head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 2e0da1e4ff6..8f5e61eecee 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -136,7 +136,7 @@ function propal_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name { $head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index c5205c47815..9010abbb50f 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref)) // Third party print "".$langs->trans("Supplier").""; - print ''.$object->client->getNomUrl(1,'compta').''; + print ''.$object->thirdparty->getNomUrl(1,'supplier').''; print ""; print ''; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 1cd4d982466..6c47f66ec7d 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -120,7 +120,7 @@ if ($object->id > 0) print "\n"; // Thirdparty - print ''.$langs->trans('Supplier').''.$object->thirdparty->getNomUrl(1).''; + print ''.$langs->trans('Supplier').''.$object->thirdparty->getNomUrl(1,'supplier').''; // Type print ''.$langs->trans('Type').''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index f8080142206..073ea94b40e 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1511,7 +1511,7 @@ else print ''; // Third party - print ''.$langs->trans('Supplier').''.$societe->getNomUrl(1); + print ''.$langs->trans('Supplier').''.$societe->getNomUrl(1,'supplier'); print '   ('.$langs->trans('OtherBills').')'; print ''; diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 942d06daa94..e3963a5f738 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -93,7 +93,7 @@ if ($object->id > 0) print "\n"; // Company - print ''.$langs->trans('Supplier').''.$object->thirdparty->getNomUrl(1).''; + print ''.$langs->trans('Supplier').''.$object->thirdparty->getNomUrl(1,'supplier').''; // Type print ''.$langs->trans('Type').''; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 8f3f2909832..18334fcf93c 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin @@ -35,8 +35,10 @@ $langs->load('companies'); $langs->load('bills'); $langs->load('banks'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm'); + $facid=GETPOST('facid','int'); -$action=GETPOST('action','alpha'); $socid=GETPOST('socid','int'); $sortfield = GETPOST("sortfield",'alpha'); @@ -62,58 +64,106 @@ if ($user->societe_id > 0) // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('paymentsupplier')); +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks /* * Actions */ -if ($action == 'add_paiement') +if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes')) { $error = 0; - $datepaye = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $paiement_id = 0; - $total = 0; + $totalpayment = 0; + $atleastonepaymentnotnull = 0; - // Genere tableau des montants amounts + // Generate payment array and check if there is payment higher than invoice and payment date before invoice date + $tmpinvoice=new FactureFournisseur($db); foreach ($_POST as $key => $value) { if (substr($key,0,7) == 'amount_') { - $other_facid = substr($key,7); - $amounts[$other_facid] = price2num(GETPOST($key)); - $total = $total + $amounts[$other_facid]; + $cursorfacid = substr($key,7); + $amounts[$cursorfacid] = price2num(trim(GETPOST($key))); + $totalpayment = $totalpayment + $amounts[$cursorfacid]; + if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++; + $result=$tmpinvoice->fetch($cursorfacid); + if ($result <= 0) dol_print_error($db); + $amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement()); + if ($amounts[$cursorfacid]) + { + // Check amount + if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) + { + $addwarning=1; + $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier"); + } + // Check date + if ($datepaye && ($datepaye < $tmpinvoice->date)) + { + $langs->load("errors"); + $error++; + setEventMessage($langs->transnoentities("ErrorPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'errors'); + } + } + + $formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]); } } - // Effectue les verifications des parametres + // Check parameters if ($_POST['paiementid'] <= 0) { - setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors'); + setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors'); $error++; } if (! empty($conf->banque->enabled)) { - // Si module bank actif, un compte est obligatoire lors de la saisie - // d'un paiement - if (! $_POST['accountid']) + // If bank module is on, account is required to enter a payment + if (GETPOST('accountid') <= 0) { - setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors'); + setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors'); $error++; } } - if ($total == 0) + if (empty($totalpayment) && empty($atleastonepaymentnotnull)) { - setEventMessage($langs->trans('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors'); + setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors'); $error++; } if (empty($datepaye)) { - setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors'); + setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors'); $error++; } +} + +/* + * Action add_paiement + */ +if ($action == 'add_paiement') +{ + if ($error) + { + $action = 'create'; + } + // Le reste propre a cette action s'affiche en bas de page. +} + + +/* + * Action confirm_paiement + */ +if ($action == 'confirm_paiement' && $confirm == 'yes') +{ + $error=0; + + $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); if (! $error) { @@ -174,6 +224,7 @@ if ($action == 'add_paiement') } + /* * View */ @@ -185,7 +236,7 @@ llxHeader(); $form=new Form($db); -if ($action == 'create' || $action == 'add_paiement') +if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paiement') { $object = new FactureFournisseur($db); $object->fetch($facid); @@ -212,7 +263,7 @@ if ($action == 'create' || $action == 'add_paiement') print_fiche_titre($langs->trans('DoPayment')); - print '
'; + print ''; print ''; print ''; print ''; @@ -298,13 +349,16 @@ if ($action == 'create' || $action == 'add_paiement') $objp = $db->fetch_object($resql); $var=!$var; print ''; - print ''.img_object($langs->trans('ShowBill'),'bill').' '.$objp->ref; - print ''; + print ''; + $invoicesupplierstatic->ref=$objp->ref; + $invoicesupplierstatic->id=$objp->facid; + print $invoicesupplierstatic->getNomUrl(1); + print ''; print ''.$objp->ref_supplier.''; if ($objp->df > 0 ) { print ''; - print dol_print_date($db->jdate($objp->df)).''; + print dol_print_date($db->jdate($objp->df), 'day').''; } else { @@ -343,10 +397,27 @@ if ($action == 'create' || $action == 'add_paiement') } } - // print ''; - print '

'.$langs->trans("ClosePaidInvoicesAutomatically"); - print '
'; - // print ''; + // Bouton Enregistrer + if ($action != 'add_paiement') + { + print '

'.$langs->trans("ClosePaidInvoicesAutomatically"); + print '
'; + } + + // Form to confirm payment + if ($action == 'add_paiement') + { + $preselectedchoice=$addwarning?'no':'yes'; + + print '
'; + $text=$langs->trans('ConfirmSupplierPayment',$totalpayment,$langs->trans("Currency".$conf->currency)); + if (GETPOST('closepaidinvoices')) + { + $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); + print ''; + } + $form->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('PayedSuppliersPayments'),$text,'confirm_paiement',$formquestion,$preselectedchoice); + } print '
'; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 7b553e0fcb2..4171fa5b675 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -64,6 +64,7 @@ ConfirmConvertToReduc=Do you want to convert this credit note or deposit into an SupplierPayments=Suppliers payments ReceivedPayments=Received payments ReceivedCustomersPayments=Payments received from customers +PayedSuppliersPayments=Payments payed to suppliers ReceivedCustomersPaymentsToValid=Received customers payments to validate PaymentsReportsForYear=Payments reports for %s PaymentsReports=Payments reports @@ -76,7 +77,8 @@ PaymentConditionsShort=Payment term PaymentAmount=Payment amount ValidatePayment=Validate payment PaymentHigherThanReminderToPay=Payment higher than reminder to pay -HelpPaymentHigherThanReminderToPay= Attention, the payment amount of one or more bills is higher than the rest to pay.
Edit your entry, otherwise confirm and think about creating a credit note of the excess received for each overpaid invoices. +HelpPaymentHigherThanReminderToPay=Attention, the payment amount of one or more bills is higher than the rest to pay.
Edit your entry, otherwise confirm and think about creating a credit note of the excess received for each overpaid invoices. +HelpPaymentHigherThanReminderToPaySupplier=Attention, the payment amount of one or more bills is higher than the rest to pay.
Edit your entry, otherwise confirm. ClassifyPaid=Classify 'Paid' ClassifyPaidPartially=Classify 'Paid partially' ClassifyCanceled=Classify 'Abandoned' @@ -166,6 +168,7 @@ ConfirmClassifyPaidPartiallyReasonOtherDesc=Use this choice if all other does no ConfirmClassifyAbandonReasonOther=Other ConfirmClassifyAbandonReasonOtherDesc=This choice will be used in all other cases. For example because you plan to create a replacing invoice. ConfirmCustomerPayment=Do you confirm this payment input for %s %s ? +ConfirmSupplierPayment=Do you confirm this payment input for %s %s ? ConfirmValidatePayment=Are you sure you want to validate this payment ? No change can be made once payment is validated. ValidateBill=Validate invoice UnvalidateBill=Unvalidate invoice diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index c466fa5df1c..5dd292aa10b 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -130,6 +130,7 @@ ErrorPHPNeedModule=Error, your PHP must have module %s installed to use t ErrorOpenIDSetupNotComplete=You setup Dolibarr config file to allow OpenID authentication, but URL of OpenID service is not defined into constant %s ErrorWarehouseMustDiffers=Source and target warehouses must differs ErrorBadFormat=Bad format! +ErrorPaymentDateLowerThanInvoiceDate=Payment date (%s) cant' be before invoice date (%s) for invoice %s. # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 98f8e79fd1c..9834959273c 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -68,33 +68,36 @@ if ($action == 'setcodecompta') } } -if ($action == 'COMPANY_USE_SEARCH_TO_SELECT') +if ($action == 'updateoptions') { - $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha'); - $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - -if ($action == 'CONTACT_USE_SEARCH_TO_SELECT') -{ - $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha'); - $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - if (! $error) + if (GETPOST('COMPANY_USE_SEARCH_TO_SELECT')) { - $mesg = "".$langs->trans("SetupSaved").""; + $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha'); + $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } - else + + if (GETPOST('CONTACT_USE_SEARCH_TO_SELECT')) { - $mesg = "".$langs->trans("Error").""; + $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha'); + $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } } @@ -698,6 +701,11 @@ print_titre($langs->trans("Other")); // Autres options $form=new Form($db); $var=true; + +print '
'; +print ''; +print ''; + print ''; print ''; print "\n"; @@ -706,9 +714,6 @@ print ''."\n"; // Utilisation formulaire Ajax sur choix societe $var=!$var; -print ''; -print ''; -print ''; print ""; print ''; if (! $conf->use_javascript_ajax) @@ -727,35 +732,13 @@ else ); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT",$arrval,$conf->global->COMPANY_USE_SEARCH_TO_SELECT); print '"; } print ''; -print ''; $var=!$var; print ""; -print ''; -if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) -{ - print ''; -} -else -{ - print ''; -} -print ''; - - -$var=!$var; -print ''; -print ''; -print ''; -print ""; print ''; if (! $conf->use_javascript_ajax) { @@ -773,11 +756,30 @@ else ); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT",$arrval,$conf->global->CONTACT_USE_SEARCH_TO_SELECT); print '"; } print ''; + +$var=!$var; +print ""; +print ''; +if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) +{ + print ''; +} +else +{ + print ''; +} +print ''; + + /* // COMPANY_USE_SEARCH_TO_SELECT $var=!$var; @@ -800,6 +802,7 @@ print ''; print '
".$langs->trans("Parameters")." 
'.$langs->trans("UseSearchToSelectCompany").''; - print ''; + print ''; print "
'.$langs->trans("AddRefInList").''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print '
'.$langs->trans("UseSearchToSelectContact").''; - print ''; + print ''; print "
'.$langs->trans("AddRefInList").''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print '
'; +print ''; dol_fiche_end();