Merge remote-tracking branch 'refs/remotes/Dolibarr/3.9' into 3.9

This commit is contained in:
fappels 2017-01-23 20:52:32 +01:00
commit fcf99c9bc2
173 changed files with 13892 additions and 8042 deletions

150
ChangeLog
View File

@ -12,6 +12,95 @@ Upgrading to any other version or any other database system is abolutely require
make a Dolibarr upgrade. make a Dolibarr upgrade.
***** ChangeLog for 3.9.4 compared to 3.9.3 *****
FIX: #2853
FIX: #3128
FIX: #4447
FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code
FIX: #5340
FIX: #5473
FIX: #5474 Country_id of "Don" object is still empty
FIX: #5534
FIX: #5535 bad dependency.
FIX: #5537 AJAX project search does not work properly
FIX: #5540 getFormMail is not registered as addReplace hook
FIX: #5544 Disabled Contact still appear in lists to send emails
FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them
FIX: #5568
FIX: #5594
FIX: #5629 PgSQL Interger string stylish error
FIX: #5651
FIX: #5660
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
FIX: #5907
FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
FIX: #6051
FIX: #6088
FIX: Can correct stock of lot using eatby or sell by date
FIX: Can make a movement on "out of sell" products
FIX: cannot update bank account on invoice if module order not activated
FIX: Can't create withdrawal document
FIX: delete contract extrafields on contract deletion
FIX: Direction of movement lost if an error occurs
FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
FIX: export extrafields must not include separe type
FIX: External user must not be able to edit its discounts
FIX: Failed to export contact categories with contact extra fields
FIX: header title in commercial area
FIX: HT and TTC price should always be displayed together
FIX: incoterms
FIX: incoterms do not output into crabe invoice PDF
FIX: in PgSQL no quote "word style" is permitted around column name
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
FIX: margin tab on customer card must filter on current entity invoices
FIX: missing column into SQL on thridparty list
FIX: only show projects of related third if external user
FIX: PgSQL Module Ressource list crash #5637
FIX: php Strict
FIX: Regression when deleting product
FIX: Security to restrict email sending was not efficient
FIX: tag for date rfc in odt substitution
FIX: Update intervention lline crash with PgSQL
FIX: update limit stock on product stock
FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15)
FIX: wrong test on dict.php
***** ChangeLog for 3.9.3 compared to 3.9.2 *****
FIX: #4383 $userid not defined
FIX: #4448 $filebonprev is not used, $this->filename now
FIX: #4455
FIX: #4749
FIX: #4756
FIX: #4828
FIX: #4926
FIX: #4964 buyprice in customer from shipping buyprice wasn't load in expedition::fetch_lines
FIX: #5004
FIX: #5068
FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option
FIX: #5338 use of not initialized var $aphour, $apmin, etc
FIX: #5343
FIX: #5380
FIX: #5383 bad object id on don delete
FIX: #5414
FIX: #5470 User of expense report in bank transactions page is not correct
FIX: a case of corrupted ODT by Word that insert <text:s> when it should not.
FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries
FIX: dasboard wrong for late invoice
FIX: duplicate jquery.js files
FIX: extrafield cloned on project clone
FIX: Failed to open file
FIX: Filter on opportunity amount and budget
FIX: form_confirm to delete payment on supplier invoice
FIX: javascript error with german-switzerland language
FIX: large expense note
FIX: Missing original .js file (license violation if sources are not provided)
FIX: Option strict mode compatibility
FIX: product stats all bloc module without enbaled test
FIX: receiving link never works
FIX: task ODT company object not correctly retrieved
FIX: Translate group perms as it is done into user perms
FIX: We must take the last recent defined price when using price level
***** ChangeLog for 3.9.2 compared to 3.9.1 ***** ***** ChangeLog for 3.9.2 compared to 3.9.1 *****
FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN
@ -277,6 +366,67 @@ This is list of hooks modified:
***** ChangeLog for 3.8.5 compared to 3.8.4 *****
FIX: #3815 Call to undefined function local_by_date().
FIX: #4424 Missing email of user popup in supplier orders area
FIX: #4442 Missing translation in Banks menu
FIX: #4448 $filebonprev is not used, $this->filename now
FIX: #4455
FIX: #4737 Bank transacion type selector translation is cropped
FIX: #4742 Able to delete a supplier invoice with a registered payment
FIX: #4743 UI glitch in project summary page
FIX: #4747 Missing UI background when registering a supplier invoice payment
FIX: #4748 Supplier invoice payment confirmation amount is not translated
FIX: #4749
FIX: #4756
FIX: #4766 VAT not shown in supplier invoice popup
FIX: #4809 - Duplicate functions with different content
FIX: #4851 Project selector in supplier invoices shows the project label twice
FIX: #4870
FIX: #5008 SQL error when editing the reference of a supplier invoice that already exists
FIX: #5048 Product supplier list display only one produc
FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option
FIX: #5203
FIX: #5207
FIX: #5338 use of not initialized var $aphour, $apmin, etc
FIX: #5380
FIX: #5383 bad object id on don delete
FIX: #5474 Country_id of "Don" object is still empty
FIX: Accountancy - 3.8 - Chart of accounts are limited on only one country
FIX: Bad include and param for project numbering module call
FIX: Box disabled because bugged
FIX: bug on email template
FIX: Can correct stock of lot using eatby or sell by date
FIX: Can make a movement on "out of sell" products
FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries
FIX: can't fetch by siret or siren because of first "if"
FIX: Check stock of product by warehouse if $entrepot_id defined on shippings
FIX: correct display of minimum buying price
FIX: Creation of thumb image for size "small" was not done.
FIX: Direction of movement lost if an error occurs
FIX: dont retrieve new buying price on margin display
FIX: Duplicate records into export
FIX: Email templates not compatible with Multicompany
FIX: end of select when no fournprice
FIX: finished parameters not used
FIX: hook on group card called but not initialized
FIX: It doesn't check if there is enough stock to update the lines of orders/invoices
FIX: large expense note
FIX: missing column when module was installed before standard integration
FIX: Missing database escaping on supplier price insert/update
FIX: Not filtering correctly when come from dashboard
FIX: PROPAL_MERGE_PDF with PRODUCT_USE_OLD_PATH
FIX: real min buying price
FIX: receiving link never works
FIX: same page added several times on mergepropal option
FIX: search on date into supplier invoice list dont work because of status -1
FIX: Search supplier ref on contract
FIX: SQL error function on getAvailableDiscounts function, on bill create mode if socid is empty
FIX: systematic rounding causes prices to be updated without reason
FIX: task ODT company object not correctly retrieved
FIX: Template email must take care of positino column
FIX: VAT rate can be negative. Example spain selling to morroco.
***** ChangeLog for 3.8.4 compared to 3.8.3 ***** ***** ChangeLog for 3.8.4 compared to 3.8.3 *****
FIX: #3694 FIX: #3694
FIX: #3798 #2519 Cron jobs would never be executed FIX: #3798 #2519 Cron jobs would never be executed

View File

@ -222,7 +222,13 @@ $dolibarr_main_prod='0';
# $dolibarr_main_limit_users='0'; # $dolibarr_main_limit_users='0';
# dolibarr_mailing_limit_sendbyweb # dolibarr_mailing_limit_sendbyweb
# Can set a limit for mailing send by web, can be used for a restricted mode. # Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
# Default value: 0 (use database value if exist) # Default value: 0 (use database value if exist)
# Examples: # Examples:
# $dolibarr_mailing_limit_sendbyweb='0'; # $dolibarr_mailing_limit_sendbyweb='0';
# dolibarr_mailing_limit_sendbycli
# Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
# Default value: 0 (use database value if exist)
# Examples:
# $dolibarr_mailing_limit_sendbycli='0';

View File

@ -1,2 +1 @@
README.md README.md
README-FR.md

View File

@ -2,4 +2,4 @@
version=3 version=3
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz #http://sf.net/dolibarr/dolibarr-(.+)\.tgz
http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.orig\.tar\.gz

View File

@ -173,6 +173,7 @@ $build =~ s/-.*$//g;
# now build is 0+nmu1 for example # now build is 0+nmu1 for example
$FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}"; $FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}";
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}"; $FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}";
$FILENAMEDEBSHORT="${PROJECT}_${MAJOR}.${MINOR}.${build}";
my $copyalreadydone=0; my $copyalreadydone=0;
@ -388,10 +389,15 @@ if ($nboftargetok) {
{ {
print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
print 'Run git push -f --tags'."\n";
$ret=`git push -f --tags`;
} }
} }
else
{
print 'Run git push --tags'."\n"; print 'Run git push --tags'."\n";
$ret=`git push --tags`; $ret=`git push --tags`;
}
chdir("$olddir"); chdir("$olddir");
} }
@ -807,7 +813,7 @@ if ($nboftargetok) {
$ret=`$cmd`; $ret=`$cmd`;
print "Remove other files\n"; print "Remove other files\n";
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR.md`;
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`;
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`;
@ -1104,6 +1110,7 @@ if ($nboftargetok) {
%filestoscansf=( %filestoscansf=(
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$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_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', "$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
@ -1111,6 +1118,7 @@ if ($nboftargetok) {
%filestoscanstableasso=( %filestoscanstableasso=(
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard', "$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
"$DESTI/standard/$FILENAMETGZ.zip"=>'standard' "$DESTI/standard/$FILENAMETGZ.zip"=>'standard'
@ -1156,7 +1164,7 @@ if ($nboftargetok) {
print "\n"; print "\n";
if ($target eq 'SF') { if ($target eq 'SF' && $filestoscan{$file} ne 'none') {
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
} }
elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) { elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) {

View File

@ -31,8 +31,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-facture.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");

View File

@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View File

@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View File

@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");

View File

@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View File

@ -81,7 +81,7 @@ $extrafields = new ExtraFields($db);
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
'd.rowid'=>'Ref', 'd.rowid'=>'Ref',
//'d.ref'=>'Ref', 'd.login'=>'Login',
'd.lastname'=>'Lastname', 'd.lastname'=>'Lastname',
'd.firstname'=>'Firstname', 'd.firstname'=>'Firstname',
'd.societe'=>"Company", 'd.societe'=>"Company",

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com> * Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
@ -624,7 +624,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i=0; $i=0;
foreach ($listfieldinsert as $f => $value) foreach ($listfieldinsert as $f => $value)
{ {
if ($value == 'price' || preg_match('/^amount/i',$value) || preg_match('/^localtax/i',$value) || $value == 'taux') { if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
} }
else if ($value == 'entity') { else if ($value == 'entity') {
@ -672,7 +672,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i = 0; $i = 0;
foreach ($listfieldmodify as $field) foreach ($listfieldmodify as $field)
{ {
if ($field == 'price' || preg_match('/^amount/i',$field) || preg_match('/^localtax/i',$field) || $field == 'taux') { if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
} }
else if ($field == 'entity') { else if ($field == 'entity') {
@ -1290,20 +1290,7 @@ if ($id)
$valuetoshow = ''; $valuetoshow = '';
$align="center"; $align="center";
} }
else if ($fieldlist[$field]=='localtax1') { else if ($fieldlist[$field]=='taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
if ($obj->localtax1 == 0)
$valuetoshow = '';
$align="right";
}
else if ($fieldlist[$field]=='localtax2') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
if ($obj->localtax2 == 0)
$valuetoshow = '';
$align="right";
}
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
{
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
$align="right"; $align="right";
} }

View File

@ -167,7 +167,7 @@ if ($action == 'edit') // Edit
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Multilangual GUI // Multilingual GUI
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableMultilangInterface").'</td><td>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableMultilangInterface").'</td><td>';
print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1); print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1);
@ -181,7 +181,7 @@ if ($action == 'edit') // Edit
show_theme(null,1); show_theme(null,1);
print '<br>'; print '<br>';
// Liste des zone de recherche permanantes supportees // List of permanent supported search box
if (! empty($searchform)) if (! empty($searchform))
{ {
print '<table summary="search" class="noborder" width="100%">'; print '<table summary="search" class="noborder" width="100%">';

View File

@ -90,6 +90,7 @@ $configfileparameters=array(
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD', '?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator', 'separator',
'?dolibarr_mailing_limit_sendbyweb', '?dolibarr_mailing_limit_sendbyweb',
'?dolibarr_mailing_limit_sendbycli',
'?dolibarr_strict_mode' '?dolibarr_strict_mode'
); );
$configfilelib=array( $configfilelib=array(

View File

@ -284,6 +284,7 @@ $configfileparameters=array(
'separator4' => '', 'separator4' => '',
'dolibarr_main_prod' => 'Production mode (Hide all error messages)', 'dolibarr_main_prod' => 'Production mode (Hide all error messages)',
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page', '?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
'?dolibarr_strict_mode' => 'Strict mode is on/off', '?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_pdf_force_fpdf' => 'Force fpdf usage to generate PDF' '?dolibarr_pdf_force_fpdf' => 'Force fpdf usage to generate PDF'
); );

View File

@ -5,7 +5,7 @@
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -607,16 +607,18 @@ class Categorie extends CommonObject
if (!empty($objparent->fk_parent)) if (!empty($objparent->fk_parent))
{ {
$cat = new Categorie($this->db); $cat = new Categorie($this->db);
$cat->id=$objparent->fk_parent; $cat->id = $objparent->fk_parent;
$result=$cat->add_type($obj, $type); if (!$cat->containsObject($type, $obj->id)) {
$result = $cat->add_type($obj, $type);
if ($result < 0) if ($result < 0)
{ {
$this->error=$cat->error; $this->error = $cat->error;
$error++; $error++;
} }
} }
} }
} }
}
else else
{ {
$error++; $error++;

View File

@ -61,8 +61,14 @@ $originid=GETPOST('originid','int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$fulldayevent=GETPOST('fullday'); $fulldayevent=GETPOST('fullday');
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); $aphour = GETPOST('aphour');
$apmin = GETPOST('apmin');
$p2hour = GETPOST('p2hour');
$p2min = GETPOST('p2min');
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
// Security check // Security check
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
@ -92,7 +98,6 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('actioncard','globalcard')); $hookmanager->initHooks(array('actioncard','globalcard'));
/* /*
* Actions * Actions
*/ */
@ -781,7 +786,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Project").'</td><td>'; print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
if ($numproject==0) if ($numproject==0)
{ {
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';

View File

@ -69,7 +69,7 @@ if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db); if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db); if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
llxHeader(); llxHeader("",$langs->trans("CommercialArea"));
print load_fiche_titre($langs->trans("CommercialArea"),'','title_commercial.png'); print load_fiche_titre($langs->trans("CommercialArea"),'','title_commercial.png');
@ -341,7 +341,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16); print $companystatic->getNomUrl(1,'supplier',16);
print '</td>'; print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>'; print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
$i++; $i++;
@ -647,7 +647,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1, 'company', 44); print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n"; print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
@ -746,7 +746,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1, 'company', 44); print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n"; print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";

View File

@ -761,10 +761,12 @@ else
$sendingmode=$conf->global->MAIN_MAIL_SENDMODE; $sendingmode=$conf->global->MAIN_MAIL_SENDMODE;
if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function
// MAILING_NO_USING_PHPMAIL may be defined or not
// MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not.
if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
{ {
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
// You ensure that every user is using its own SMTP server. // You ensure that every user is using its own SMTP server when using the mass emailing module.
$linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails.php">'; $linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails.php">';
$linktoadminemailend='</a>'; $linktoadminemailend='</a>';
setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
@ -772,19 +774,27 @@ else
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
$_GET["action"]=''; $_GET["action"]='';
} }
else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1')
{ {
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings');
// on affiche donc juste un message if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings');
// The feature is forbidden from GUI, we show just message to use from command line.
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings'); setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it.
{
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant...
}
$_GET["action"]=''; $_GET["action"]='';
} }
else else
{ {
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings');
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings');
$text=''; $text='';
if ($conf->file->mailing_limit_sendbyweb == 0) if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0)
{ {
$text.=$langs->trans("MailingNeedCommand"); $text.=$langs->trans("MailingNeedCommand");
$text.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>'; $text.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';

View File

@ -429,7 +429,8 @@ class Propal extends CommonObject
$product_type=$product->type; $product_type=$product->type;
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) { if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) {
$this->error=$langs->trans('ErrorStockIsNotEnough'); $langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
@ -2733,20 +2734,33 @@ class Propal extends CommonObject
*/ */
function getNomUrl($withpicto=0,$option='', $get_params='') function getNomUrl($withpicto=0,$option='', $get_params='')
{ {
global $langs, $conf; global $langs, $conf, $user;
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowPropal") . '</u>'; $label = '';
if (! empty($this->ref))
$label.= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; if ($user->rights->propal->lire) {
if (! empty($this->ref_client)) $label .= '<u>'.$langs->trans("ShowPropal").'</u>';
$label.= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client; if (!empty($this->ref)) {
if (! empty($this->total_ht)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); }
if (! empty($this->total_tva)) if (!empty($this->ref_client)) {
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
if (! empty($this->total_ttc)) }
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1,
$conf->currency);
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1,
$conf->currency);
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1,
$conf->currency);
}
}
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') { if ($option == '') {
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;

View File

@ -10,6 +10,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -255,6 +256,7 @@ if ($result)
} }
$param='&socid='.$socid.'&viewstatut='.$viewstatut; $param='&socid='.$socid.'&viewstatut='.$viewstatut;
if ($sall) $param.='&sall='.$sall;
if ($month) $param.='&month='.$month; if ($month) $param.='&month='.$month;
if ($year) $param.='&year='.$year; if ($year) $param.='&year='.$year;
if ($search_ref) $param.='&search_ref=' .$search_ref; if ($search_ref) $param.='&search_ref=' .$search_ref;

View File

@ -130,7 +130,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
} }
} }
if ($action == 'setremise') if ($action == 'setremise' && $user->rights->societe->creer)
{ {
//if ($user->rights->societe->creer) //if ($user->rights->societe->creer)
//if ($user->rights->facture->creer) //if ($user->rights->facture->creer)
@ -257,9 +257,15 @@ if ($socid > 0)
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
if (! empty($user->fk_soc)) // No need to show this for external users
{
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>'; print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
}
print '</table>'; print '</table>';
if ($user->rights->societe->creer)
{
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
@ -275,11 +281,14 @@ if ($socid > 0)
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>'; print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
print "</table>"; print "</table>";
}
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
if ($user->rights->societe->creer)
{
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">'; print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
if (! empty($backtopage)) if (! empty($backtopage))
@ -288,6 +297,7 @@ if ($socid > 0)
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
} }
print '</div>'; print '</div>';
}
print '</form>'; print '</form>';
@ -414,7 +424,7 @@ if ($socid > 0)
print '<br>'; print '<br>';
/* /*
* Liste ristournes appliquees (=liees a une ligne de facture ou facture) * List discount consumed (=liees a une ligne de facture ou facture)
*/ */
// Remises liees a lignes de factures // Remises liees a lignes de factures

View File

@ -1242,7 +1242,8 @@ class Commande extends CommonOrder
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
{ {
$this->error=$langs->trans('ErrorStockIsNotEnough'); $langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return self::STOCK_NOT_ENOUGH_FOR_ORDER; return self::STOCK_NOT_ENOUGH_FOR_ORDER;
@ -2563,7 +2564,8 @@ class Commande extends CommonOrder
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
{ {
$this->error=$langs->trans('ErrorStockIsNotEnough'); $langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
unset($_POST['productid']); unset($_POST['productid']);
@ -3069,7 +3071,7 @@ class Commande extends CommonOrder
*/ */
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) function getNomUrl($withpicto=0,$option=0,$max=0,$short=0)
{ {
global $conf, $langs; global $conf, $langs, $user;
$result=''; $result='';
@ -3079,17 +3081,29 @@ class Commande extends CommonOrder
if ($short) return $url; if ($short) return $url;
$picto = 'order'; $picto = 'order';
$label = '<u>' . $langs->trans("ShowOrder") . '</u>'; $label = '';
if (! empty($this->ref))
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; if ($user->rights->commande->lire) {
if (! empty($this->ref_client)) $label = '<u>'.$langs->trans("ShowOrder").'</u>';
$label.= '<br><b>' . $langs->trans('RefCustomer') . ':</b> ' . $this->ref_client; if (!empty($this->ref)) {
if (! empty($this->total_ht)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); }
if (! empty($this->total_tva)) if (!empty($this->ref_client)) {
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
if (! empty($this->total_ttc)) }
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1,
$conf->currency);
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1,
$conf->currency);
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1,
$conf->currency);
}
}
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';

View File

@ -259,6 +259,7 @@ if ($resql)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); $title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$param=''; $param='';
if ($sall) $param.='&sall='.$sall;
if ($socid > 0) $param.='&socid='.$socid; if ($socid > 0) $param.='&socid='.$socid;
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut; if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
if ($orderday) $param.='&orderday='.$orderday; if ($orderday) $param.='&orderday='.$orderday;
@ -587,10 +588,13 @@ if ($resql)
print dol_print_date($db->jdate($objp->date_commande), 'day'); print dol_print_date($db->jdate($objp->date_commande), 'day');
print '</td>'; print '</td>';
if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE))
{
// Delivery date // Delivery date
print '<td align="center">'; print '<td align="center">';
print dol_print_date($db->jdate($objp->date_delivery), 'day'); print dol_print_date($db->jdate($objp->date_delivery), 'day');
print '</td>'; print '</td>';
}
// Amount HT // Amount HT
print '<td align="right" class="nowrap">'.price($objp->total_ht).'</td>'; print '<td align="right" class="nowrap">'.price($objp->total_ht).'</td>';

View File

@ -70,6 +70,11 @@ $date_end = dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endda
$date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server
$date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]); $date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('facture');
if ($action == 'create') if ($action == 'create')
{ {
if (is_array($selected) == false) if (is_array($selected) == false)
@ -174,6 +179,9 @@ if (($action == 'create' || $action == 'add') && !$error)
$object->remise_absolue = $_POST['remise_absolue']; $object->remise_absolue = $_POST['remise_absolue'];
$object->remise_percent = $_POST['remise_percent']; $object->remise_percent = $_POST['remise_percent'];
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
if ($_POST['origin'] && $_POST['originid']) if ($_POST['origin'] && $_POST['originid'])
{ {
$object->origin = $_POST['origin']; $object->origin = $_POST['origin'];
@ -464,6 +472,12 @@ if ($action == 'create' && !$error)
$parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"'); $parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
$object=new Facture($db);
print $object->showOptionals($extrafields,'edit');
}
// Modele PDF // Modele PDF
print '<tr><td>'.$langs->trans('Model').'</td>'; print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td>'; print '<td>';

View File

@ -36,10 +36,10 @@ $id=GETPOST('account');
$ref=GETPOST('ref'); $ref=GETPOST('ref');
// Security check // Security check
$fieldid = (! empty($ref)?$ref:$id); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
$fieldname = isset($ref)?'ref':'rowid'; $fieldtype = (! empty($ref) ? 'ref' :'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$fieldid,'bank_account','','',$fieldname); $result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype);
$year_start=GETPOST('year_start'); $year_start=GETPOST('year_start');
$year_current = strftime("%Y",time()); $year_current = strftime("%Y",time());
@ -146,7 +146,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("B
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($_GET["account"]) if (!empty($id))
{ {
if (! preg_match('/,/', $id)) if (! preg_match('/,/', $id))
{ {

View File

@ -66,7 +66,6 @@ if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
if (! empty($conf->margin->enabled)) if (! empty($conf->margin->enabled))
$langs->load('margins'); $langs->load('margins');
$sall = trim(GETPOST('sall'));
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
@ -3316,7 +3315,7 @@ else if ($id > 0 || ! empty($ref))
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
print '<td>'; print '<td>';
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon)) if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';

View File

@ -387,8 +387,8 @@ class Facture extends CommonInvoice
{ {
$newinvoiceline=$this->lines[$i]; $newinvoiceline=$this->lines[$i];
$newinvoiceline->fk_facture=$this->id; $newinvoiceline->fk_facture=$this->id;
$newinvoiceline->origin = $this->element; $newinvoiceline->origin = $this->element; // TODO This seems not used. Here we but origin 'facture' but after
$newinvoiceline->origin_id = $this->lines[$i]->id; $newinvoiceline->origin_id = $this->lines[$i]->id; // we put an id of object !
if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
{ {
// Reset fk_parent_line for no child products and special product // Reset fk_parent_line for no child products and special product
@ -2138,7 +2138,8 @@ class Facture extends CommonInvoice
$product_type=$product->type; $product_type=$product->type;
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) {
$this->error=$langs->trans('ErrorStockIsNotEnough'); $langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
@ -2177,27 +2178,32 @@ class Facture extends CommonInvoice
$this->line->fk_facture=$this->id; $this->line->fk_facture=$this->id;
$this->line->label=$label; // deprecated $this->line->label=$label; // deprecated
$this->line->desc=$desc; $this->line->desc=$desc;
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->tva_tx=$txtva; $this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1; $this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2; $this->line->localtax2_tx=$txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); // For credit note and if qty is negative, total is negative
$this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); // For credit note and if qty is negative, total is negative
$this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); // For credit note and if qty is negative, total is negative
$this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); // For credit note and if qty is negative, total is negative
$this->line->fk_product=$fk_product; $this->line->fk_product=$fk_product;
$this->line->product_type=$product_type; $this->line->product_type=$product_type;
$this->line->remise_percent=$remise_percent; $this->line->remise_percent=$remise_percent;
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start=$date_start; $this->line->date_start=$date_start;
$this->line->date_end=$date_end; $this->line->date_end=$date_end;
$this->line->ventil=$ventil; $this->line->ventil=$ventil;
$this->line->rang=$rangtouse; $this->line->rang=$rangtouse;
$this->line->info_bits=$info_bits; $this->line->info_bits=$info_bits;
$this->line->fk_remise_except=$fk_remise_except; $this->line->fk_remise_except=$fk_remise_except;
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= $total_tva;
$this->line->total_localtax1=$total_localtax1;
$this->line->total_localtax2=$total_localtax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
$this->line->special_code=$special_code; $this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line; $this->line->fk_parent_line=$fk_parent_line;
$this->line->origin=$origin; $this->line->origin=$origin;
@ -2343,7 +2349,8 @@ class Facture extends CommonInvoice
$product_type=$product->type; $product_type=$product->type;
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) {
$this->error=$langs->trans('ErrorStockIsNotEnough'); $langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
@ -3205,7 +3212,7 @@ class Facture extends CommonInvoice
$clause = " WHERE"; $clause = " WHERE";
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin"; $sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -3235,6 +3242,7 @@ class Facture extends CommonInvoice
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin); $generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin);
$generic_facture->statut = $obj->fk_statut;
$response->nbtodo++; $response->nbtodo++;

View File

@ -530,7 +530,7 @@ if ($search_user > 0)
} }
if (! $sall) if (! $sall)
{ {
$sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.total, f.tva, f.total_ttc,'; $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,';
$sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid, s.code_client, s.client'; $sql.= ' s.nom, s.rowid, s.code_client, s.client';
@ -568,6 +568,7 @@ if ($resql)
} }
$param='&socid='.$socid; $param='&socid='.$socid;
if ($sall) $param.='&sall='.$sall;
if ($day) $param.='&day='.$day; if ($day) $param.='&day='.$day;
if ($month) $param.='&month='.$month; if ($month) $param.='&month='.$month;
if ($year) $param.='&year=' .$year; if ($year) $param.='&year=' .$year;

View File

@ -824,7 +824,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
print '</tr>'; print '</tr>';
$total_ttc += $obj->total_ttc; $total_ttc += $obj->total_ttc;
$total += $obj->total; $total += $obj->total_ht;
$totalam += $obj->am; $totalam += $obj->am;
$var=!$var; $var=!$var;
$i++; $i++;

View File

@ -106,7 +106,7 @@ $fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services if ($calc==0 || $calc==1) // Calculate on invoice for goods and services
{ {
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec"); $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
@ -124,7 +124,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
$productsup=$langs->trans("Description"); $productsup=$langs->trans("Description");
$amountsup=$langs->trans("AmountHT"); $amountsup=$langs->trans("AmountHT");
} }
if ($conf->global->$calc==2) // Invoice for goods, payment for services if ($calc==2) // Invoice for goods, payment for services
{ {
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
$calcmode=$langs->trans("CalcModeLT2Debt"); $calcmode=$langs->trans("CalcModeLT2Debt");
@ -149,7 +149,7 @@ $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
$vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); $vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
// IRPF that the customer has retained me // IRPF that the customer has retained me
if($conf->global->$calc ==0 || $conf->global->$calc == 2) if($calc ==0 || $calc == 2)
{ {
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
@ -232,7 +232,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2)
} }
// IRPF I retained my supplier // IRPF I retained my supplier
if($conf->global->$calc ==0 || $conf->global->$calc == 1){ if($calc ==0 || $calc == 1){
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<td align="left">'.$langs->trans("Num")."</td>"; print '<td align="left">'.$langs->trans("Num")."</td>";
@ -309,7 +309,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
} }
} }
if($conf->global->$calc ==0){ if($calc ==0){
// Total to pay // Total to pay
print '<br><br>'; print '<br><br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -273,7 +273,8 @@ $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'"; $sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'";
$sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'"; $sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'";
$sql.= " AND localtaxtype=".$localTaxType; $sql.= " AND localtaxtype=".$localTaxType;
$sql.= " GROUP BY dm ASC"; $sql.= " GROUP BY dm";
$sql.= " ORDER BY dm ASC";
pt($db, $sql,$langs->trans("Year")." $y"); pt($db, $sql,$langs->trans("Year")." $y");

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -916,7 +916,10 @@ class BonPrelevement extends CommonObject
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT);
$this->filename = $conf->prelevement->dir_output.'/receipts/'.$ref.'.xml'; $dir=$conf->prelevement->dir_output.'/receipts';
if (! is_dir($dir)) dol_mkdir($dir);
$this->filename = $dir.'/'.$ref.'.xml';
// Create withdraw receipt in database // Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
@ -932,10 +935,6 @@ class BonPrelevement extends CommonObject
{ {
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
$this->id = $prev_id; $this->id = $prev_id;
$dir=$conf->prelevement->dir_output.'/receipts';
$file=$filebonprev;
if (! is_dir($dir)) dol_mkdir($dir);
} }
else else
{ {
@ -1031,7 +1030,7 @@ class BonPrelevement extends CommonObject
// Generation of SEPA file // Generation of SEPA file
$this->generate(); $this->generate();
} }
dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG); dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
} }
/* /*
@ -1559,7 +1558,7 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR =''; $XML_DEBITOR ='';
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf; $XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
$XML_DEBITOR .=' <PmtId>'.$CrLf; $XML_DEBITOR .=' <PmtId>'.$CrLf;
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.$row_facnumber.'-'.$Rowing).'</EndToEndId>'.$CrLf; $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' </PmtId>'.$CrLf; $XML_DEBITOR .=' </PmtId>'.$CrLf;
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf; $XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf; $XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
@ -1674,8 +1673,9 @@ class BonPrelevement extends CommonObject
* @return string String with SEPA Sender * @return string String with SEPA Sender
*/ */
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n') function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
{ // SEPA INITIALISATION {
global $confs; // SEPA INITIALISATION
global $conf;
$dateTime_YMD = dol_print_date($ladate, '%Y%m%d'); $dateTime_YMD = dol_print_date($ladate, '%Y%m%d');
$dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d'); $dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d');

View File

@ -141,7 +141,7 @@ if ($prev_id)
print price($row[0]); print price($row[0]);
print '</td><td align="right">'; print '</td><td align="right">';
print round($row[0]/$bon->amount*100,2)." %"; if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %";
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -262,9 +262,15 @@ $dolibarr_main_db_prefix='';
// $dolibarr_main_limit_users='0'; // $dolibarr_main_limit_users='0';
// dolibarr_mailing_limit_sendbyweb // dolibarr_mailing_limit_sendbyweb
// Can set a limit for mailing send by web. Can be used for a restricted mode. // Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
// Default value: 0 (use database value if exist) // Default value: '0' (no overwrite, use database value if exists)
// Examples: // Examples: '-1' (sending by web is forbidden)
// $dolibarr_mailing_limit_sendbyweb='0';
// dolibarr_mailing_limit_sendbycli
// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
// Default value: '0' (no overwrite, use database value if exists)
// Examples: '-1' (sending by cli is forbidden)
// $dolibarr_mailing_limit_sendbyweb='0'; // $dolibarr_mailing_limit_sendbyweb='0';
// dolibarr_strict_mode // dolibarr_strict_mode

View File

@ -364,6 +364,7 @@ if ($result)
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); $param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email);
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ); if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
if ($sall != '') $param.='&amp;sall='.urlencode($sall);
if ($search_lastname != '') $param.='&amp;search_lastname='.urlencode($search_lastname); if ($search_lastname != '') $param.='&amp;search_lastname='.urlencode($search_lastname);
if ($search_firstname != '') $param.='&amp;search_firstname='.urlencode($search_firstname); if ($search_firstname != '') $param.='&amp;search_firstname='.urlencode($search_firstname);
if ($search_zip != '') $param.='&amp;search_zip='.urlencode($search_zip); if ($search_zip != '') $param.='&amp;search_zip='.urlencode($search_zip);

View File

@ -1134,6 +1134,16 @@ class Contrat extends CommonObject
} }
} }
// Removed extrafields
if (! $error) {
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR);
}
}
if (! $error) if (! $error)
{ {
// We remove directory // We remove directory

View File

@ -6,6 +6,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop> * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -222,6 +223,7 @@ if ($resql)
$param.='&search_name='.$search_name; $param.='&search_name='.$search_name;
$param.='&search_ref_supplier='.$search_ref_supplier; $param.='&search_ref_supplier='.$search_ref_supplier;
$param.='&search_sale=' .$search_sale; $param.='&search_sale=' .$search_sale;
if ($sall != '') $param.='&sall='.$sall;
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);

View File

@ -313,7 +313,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $errors=$interface->errors;
} }
// End call of triggers // End call of triggers
@ -327,7 +327,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// This avoid sending mail twice if going out and then back to page // This avoid sending mail twice if going out and then back to page
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
setEventMessages($mesg, null, 'mesgs'); setEventMessages($mesg, null, 'mesgs');
if($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val); if ($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id); else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id);
exit; exit;
} }

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr> /* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juan José Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -79,7 +80,9 @@ class box_project extends ModeleBoxes
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut ";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
$sql.= " ORDER BY p.datec DESC"; $sql.= " ORDER BY p.datec DESC";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);

View File

@ -143,6 +143,8 @@ class CMailFile
$this->msgishtml = $msgishtml; $this->msgishtml = $msgishtml;
} }
if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html.
// Detect images // Detect images
if ($this->msgishtml) if ($this->msgishtml)
{ {
@ -366,7 +368,7 @@ class CMailFile
*/ */
function sendfile() function sendfile()
{ {
global $conf,$db; global $conf,$db,$langs;
$errorlevel=error_reporting(); $errorlevel=error_reporting();
error_reporting($errorlevel ^ E_WARNING); // Desactive warnings error_reporting($errorlevel ^ E_WARNING); // Desactive warnings
@ -389,6 +391,30 @@ class CMailFile
return $reshook; return $reshook;
} }
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10;
$tmparray = explode(',', $this->addr_to);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in to:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
$tmparray = explode(',', $this->addr_cc);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in cc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
$tmparray = explode(',', $this->addr_bcc);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in bcc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
// Action according to choosed sending method // Action according to choosed sending method
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{ {
@ -417,8 +443,6 @@ class CMailFile
} }
else else
{ {
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'), LOG_DEBUG);
$bounce = ''; // By default $bounce = ''; // By default
if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F))
{ {
@ -431,6 +455,7 @@ class CMailFile
{ {
$bounce .= ($bounce?' ':'').'-ba'; $bounce .= ($bounce?' ':'').'-ba';
} }
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG);
$this->message=stripslashes($this->message); $this->message=stripslashes($this->message);
@ -449,7 +474,8 @@ class CMailFile
{ {
$this->error.=" to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems $this->error.=" to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems
} }
$this->error.=".<br>Check your server logs and your firewalls setup"; $this->error.=".<br>";
$this->error.=$langs->trans("ErrorPhpMailDelivery");
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
} }
else else
@ -680,7 +706,7 @@ class CMailFile
global $conf; global $conf;
$out = ""; $out = "";
$host = dol_getprefix(); $host = dol_getprefix('email');
// Sender // Sender
//$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2; //$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2;
@ -798,8 +824,9 @@ class CMailFile
$strContent = preg_replace("/\r\n/si", "\n", $strContent); $strContent = preg_replace("/\r\n/si", "\n", $strContent);
} }
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged // Make RFC2045 Compliant, split lines
$strContent = rtrim(wordwrap($strContent)); //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
$strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content.
if ($this->msgishtml) if ($this->msgishtml)
{ {

View File

@ -59,6 +59,8 @@ abstract class CommonDocGenerator
{ {
global $conf; global $conf;
$logotouse=$conf->user->dir_output.'/'.get_exdir($user->id, 2, 0, 1, $user, 'user').'/'.$user->photo;
return array( return array(
'myuser_lastname'=>$user->lastname, 'myuser_lastname'=>$user->lastname,
'myuser_firstname'=>$user->firstname, 'myuser_firstname'=>$user->firstname,
@ -75,7 +77,7 @@ abstract class CommonDocGenerator
'myuser_fax'=>$user->office_fax, 'myuser_fax'=>$user->office_fax,
'myuser_mobile'=>$user->user_mobile, 'myuser_mobile'=>$user->user_mobile,
'myuser_email'=>$user->email, 'myuser_email'=>$user->email,
'myuser_logo'=>$user->photo, 'myuser_logo'=>$logotouse,
'myuser_job'=>$user->job, 'myuser_job'=>$user->job,
'myuser_web'=>'' // url not exist in $user object 'myuser_web'=>'' // url not exist in $user object
); );
@ -444,9 +446,9 @@ abstract class CommonDocGenerator
'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs), 'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs),
'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs), 'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs),
'line_date_start'=>$line->date_start, 'line_date_start'=>$line->date_start,
'line_date_start_rfc'=>dol_print_date($line->date_start,'rfc'), 'line_date_start_rfc'=>dol_print_date($line->date_start,'dayrfc'),
'line_date_end'=>$line->date_end, 'line_date_end'=>$line->date_end,
'line_date_end_rfc'=>dol_print_date($line->date_end,'rfc') 'line_date_end_rfc'=>dol_print_date($line->date_end,'dayrfc')
); );
// Retrieve extrafields // Retrieve extrafields

View File

@ -595,6 +595,10 @@ abstract class CommonObject
} }
} }
if(! empty($id_type_contact)) {
$datecreate = dol_now(); $datecreate = dol_now();
$this->db->begin(); $this->db->begin();
@ -604,7 +608,7 @@ abstract class CommonObject
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) "; $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ; $sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
$sql.= "'".$this->db->idate($datecreate)."'"; $sql.= "'".$this->db->idate($datecreate)."'";
$sql.= ", 4, '". $id_type_contact . "' "; $sql.= ", 4, ". $id_type_contact . " ";
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG); dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
@ -640,6 +644,8 @@ abstract class CommonObject
} }
} }
} }
return 1;
}
/** /**
* Copy contact from one element to current * Copy contact from one element to current

View File

@ -108,7 +108,7 @@ class DolEditor
// Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart. // Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
// Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ? // Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
$modulepart='fckeditor'; $modulepart='fckeditor';
$this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&file='; $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file=';
$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ; $this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ;
$this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false'); $this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false');

View File

@ -729,7 +729,7 @@ class ExtraFields
} }
elseif ($type == 'price') elseif ($type == 'price')
{ {
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency); $out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.price2num($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
} }
elseif ($type == 'double') elseif ($type == 'double')
{ {
@ -1232,7 +1232,14 @@ class ExtraFields
{ {
$sql.= ' as main'; $sql.= ' as main';
} }
if ($selectkey=='rowid' && empty($value)) {
$sql.= " WHERE ".$selectkey."=0";
} elseif ($selectkey=='rowid') {
$sql.= " WHERE ".$selectkey."=".$this->db->escape($value);
}else {
$sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
}
//$sql.= ' AND entity = '.$conf->entity; //$sql.= ' AND entity = '.$conf->entity;
dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG); dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG);

View File

@ -167,7 +167,8 @@ class HookManager
'printObjectLine', 'printObjectLine',
'printObjectSubLine', 'printObjectSubLine',
'createDictionaryFieldList', 'createDictionaryFieldList',
'editDictionaryFieldlist' 'editDictionaryFieldlist',
'getFormMail'
) )
)) $hooktype='addreplace'; )) $hooktype='addreplace';
// Deprecated hook types ('returnvalue') // Deprecated hook types ('returnvalue')

View File

@ -1896,8 +1896,8 @@ class Form
$sql.= " WHERE fk_product='".$objp->rowid."'"; $sql.= " WHERE fk_product='".$objp->rowid."'";
$sql.= " AND entity IN (".getEntity('productprice', 1).")"; $sql.= " AND entity IN (".getEntity('productprice', 1).")";
$sql.= " AND price_level=".$price_level; $sql.= " AND price_level=".$price_level;
$sql.= " ORDER BY date_price, rowid"; $sql.= " ORDER BY date_price DESC, rowid DESC";
$sql.= " DESC LIMIT 1"; $sql.= " LIMIT 1";
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG); dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
$result2 = $this->db->query($sql); $result2 = $this->db->query($sql);

View File

@ -6,6 +6,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com> * Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -720,9 +721,6 @@ class FormFile
if ($modulepart == 'export') { if ($modulepart == 'export') {
$relativepath = $file["name"]; $relativepath = $file["name"];
} }
if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') {
$relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"];
}
// Show file name with link to download // Show file name with link to download
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'"'; $out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'"';

View File

@ -140,8 +140,8 @@ class FormProjets
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
if (!empty($filterkey)) { if (!empty($filterkey)) {
$sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"'; $sql .= " AND p.title LIKE '%".$this->db->escape($filterkey)."%'";
$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"'; $sql .= " OR p.ref LIKE '%".$this->db->escape($filterkey)."%'";
} }
$sql.= " ORDER BY p.ref ASC"; $sql.= " ORDER BY p.ref ASC";

View File

@ -1126,6 +1126,8 @@ class SMTPs
$host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@tcp://@i','',$host); // Remove prefix
$host=preg_replace('@ssl://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix
$host=dol_getprefix('email').'-'.$host;
//NOTE: Message-ID should probably contain the username of the user who sent the msg //NOTE: Message-ID should probably contain the username of the user who sent the msg
$_header .= 'Subject: ' . $this->getSubject() . "\r\n"; $_header .= 'Subject: ' . $this->getSubject() . "\r\n";
$_header .= 'Date: ' . date("r") . "\r\n"; $_header .= 'Date: ' . date("r") . "\r\n";
@ -1186,7 +1188,9 @@ class SMTPs
// Make RFC821 Compliant, replace bare linefeeds // Make RFC821 Compliant, replace bare linefeeds
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent); $strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent);
$strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // Make RFC2045 Compliant
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
$strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content.
$this->_msgContent[$strType] = array(); $this->_msgContent[$strType] = array();

View File

@ -1093,7 +1093,7 @@ class DoliDBPgsql extends DoliDB
*/ */
function DDLDropField($table,$field_name) function DDLDropField($table,$field_name)
{ {
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; $sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
dol_syslog($sql,LOG_DEBUG); dol_syslog($sql,LOG_DEBUG);
if (! $this->query($sql)) if (! $this->query($sql))
{ {

View File

@ -15,6 +15,7 @@ if ($resql) // This can fail when class is used on old database (during migra
{ {
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
if ($obj->type!='separate') {
$fieldname=$keyforaliasextra.'.'.$obj->name; $fieldname=$keyforaliasextra.'.'.$obj->name;
$fieldlabel=ucfirst($obj->label); $fieldlabel=ucfirst($obj->label);
$typeFilter="Text"; $typeFilter="Text";
@ -46,5 +47,6 @@ if ($resql) // This can fail when class is used on old database (during migra
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter; $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]=$keyforelement; $this->export_entities_array[$r][$fieldname]=$keyforelement;
} }
}
} }
// End add axtra fields // End add axtra fields

View File

@ -44,7 +44,8 @@ $Config['Enabled'] = true ;
// Path to user files relative to the document root. // Path to user files relative to the document root.
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ; $extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&entity='.$extEntity.'&file=' ;
// Fill the following value it you prefer to specify the absolute path for the // Fill the following value it you prefer to specify the absolute path for the
// user files directory. Useful if you are using a virtual directory, symbolic // user files directory. Useful if you are using a virtual directory, symbolic

View File

@ -1012,6 +1012,9 @@ function getParameterByName(name, valueifnotfound)
} }
})(); })();
// Another solution, easier, to build a javascript rounding function
function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); }
/** /**
* Function similar to PHP price2num() * Function similar to PHP price2num()
@ -1032,6 +1035,7 @@ function price2numjs(amount) {
if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
$thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); $thousand = $langs->transnoentitiesnoconv("SeparatorThousand");
} }
if ($thousand == 'Space') $thousand=' ';
print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript
?> ?>
@ -1050,11 +1054,15 @@ function price2numjs(amount) {
if (nbdec > rounding) rounding = nbdec; if (nbdec > rounding) rounding = nbdec;
// If rounding higher than max shown // If rounding higher than max shown
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown; if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
if (thousand != ',' && thousand != '.') amount = amount.replace(',', '.'); if (thousand != ',' && thousand != '.') amount = amount.replace(',', '.');
amount = amount.replace(' ', ''); // To avoid spaces amount = amount.replace(' ', ''); // To avoid spaces
amount = amount.replace(thousand, ''); // Replace of thousand before replace of dec to avoid pb if thousand is . amount = amount.replace(thousand, ''); // Replace of thousand before replace of dec to avoid pb if thousand is .
amount = amount.replace(dec, '.'); amount = amount.replace(dec, '.');
//console.log("amount before="+amount+" rouding="+rounding)
return Math.round10(amount, rounding); var res = Math.round10(amount, - rounding);
// Other solution is
// var res = dolroundjs(amount, rounding)
console.log("res="+res)
return res;
} }

View File

@ -79,7 +79,9 @@ function societe_prepare_head(Societe $object)
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
{ {
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
} }

View File

@ -7,7 +7,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
@ -286,10 +286,20 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
* This prefix is unique for instance and avoid conflict between multi-instances, * This prefix is unique for instance and avoid conflict between multi-instances,
* even when having two instances with one root dir or two instances in virtual servers * even when having two instances with one root dir or two instances in virtual servers
* *
* @param string $mode '' or 'email'
* @return string A calculated prefix * @return string A calculated prefix
*/ */
function dol_getprefix() function dol_getprefix($mode='')
{ {
global $conf;
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email
if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID))
{
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"];
}
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
{ {
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
@ -3320,7 +3330,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
* @param float $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example * @param float $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example
* @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2)
* @param Societe $thirdparty_buyer Object of buying third party * @param Societe $thirdparty_buyer Object of buying third party
* @param Societe $thirdparty_seller Object of selling third party * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined)
* @param int $vatnpr If vat rate is NPR or not * @param int $vatnpr If vat rate is NPR or not
* @return mixed 0 if not found, localtax rate if found * @return mixed 0 if not found, localtax rate if found
* @see get_default_tva * @see get_default_tva
@ -3336,7 +3346,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
$vatratecleaned = $vatrate; $vatratecleaned = $vatrate;
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)" if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
{ {
$vatratecleaned = $reg[1]; $vatratecleaned = trim($reg[1]);
$vatratecode = $reg[2]; $vatratecode = $reg[2];
} }
@ -3350,7 +3360,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
{ {
if ($local == 1) if ($local == 1)
{ {
if (! $mysoc->localtax1_assuj) return 0; if (! $mysoc->localtax1_assuj || (string) $vatratecleaned == "0") return 0;
if ($thirdparty_seller->id == $mysoc->id) if ($thirdparty_seller->id == $mysoc->id)
{ {
if (! $thirdparty_buyer->localtax1_assuj) return 0; if (! $thirdparty_buyer->localtax1_assuj) return 0;
@ -3363,7 +3373,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local == 2) if ($local == 2)
{ {
if (! $mysoc->localtax2_assuj) return 0; if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0;
if ($thirdparty_seller->id == $mysoc->id) if ($thirdparty_seller->id == $mysoc->id)
{ {
if (! $thirdparty_buyer->localtax2_assuj) return 0; if (! $thirdparty_buyer->localtax2_assuj) return 0;
@ -3379,18 +3389,15 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0; if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0;
if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0; if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
} }
//if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0);
// Do not enabled this. We want localtax that match the vat rate. // For some country MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY is forced to on.
// If we forced a vat, we must also force local tax if (in_array($mysoc->country_code, array('ES')))
/*
if (is_object($thirdparty_buyer))
{ {
if ($thirdparty_seller->country_code != $thirdparty_buyer->country_code) return 0; $conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1;
}*/ }
// Search local taxes // Search local taxes
if ($mysoc->country_code == 'ES' || ! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY))
{ {
if ($local==1) if ($local==1)
{ {
@ -5079,7 +5086,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg)) if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
{ {
$substitutionarray=array(); $substitutionarray=array();
complete_substitutions_array($substitutionarray,$langs,$object); complete_substitutions_array($substitutionarray,$langs,$object,array('needforkey'=>$values[2]));
$label=make_substitutions($reg[1], $substitutionarray); $label=make_substitutions($reg[1], $substitutionarray);
} }
else $label=$langs->trans($values[2]); else $label=$langs->trans($values[2]);
@ -5099,7 +5106,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg)) if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
{ {
$substitutionarray=array(); $substitutionarray=array();
complete_substitutions_array($substitutionarray,$langs,$object); complete_substitutions_array($substitutionarray,$langs,$object,array('needforkey'=>$values[2]));
$label=make_substitutions($reg[1], $substitutionarray); $label=make_substitutions($reg[1], $substitutionarray);
} }
else $label=$langs->trans($values[2]); else $label=$langs->trans($values[2]);
@ -5195,7 +5202,7 @@ function printCommonFooter($zone='private')
print 'window.console && console.log("'; print 'window.console && console.log("';
if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - '; if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - ';
print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off'); print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off');
if ($micro_start_time) if (! empty($micro_start_time)) // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in global variable.
{ {
$micro_end_time = microtime(true); $micro_end_time = microtime(true);
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms'; print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';

View File

@ -1493,6 +1493,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
/** /**
* This function evaluates a string that should be a valid IPv4 * This function evaluates a string that should be a valid IPv4
* Note: For ip 169.254.0.0, it returns 0 with some PHP (5.6.24) and 2 with some minor patchs of PHP (5.6.25). See https://github.com/php/php-src/pull/1954.
* *
* @param string $ip IP Address * @param string $ip IP Address
* @return int 0 if not valid or reserved range, 1 if valid and public IP, 2 if valid and private range IP * @return int 0 if not valid or reserved range, 1 if valid and public IP, 2 if valid and private range IP

View File

@ -318,15 +318,15 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
else else
{ {
for ($page=$start_page; $page <= $end_page; ++$page) { for ($page=$start_page; $page <= $end_page; ++$page) {
$this->setPage($page); $pdf->setPage($page);
if ($page == $start_page) { if ($page == $start_page) {
// first page // first page
$height = $this->h - $start_y - $this->bMargin; $height = $pdf->h - $start_y - $pdf->bMargin;
} elseif ($page == $end_page) { } elseif ($page == $end_page) {
// last page // last page
$height = $end_y - $this->tMargin; $height = $end_y - $pdf->tMargin;
} else { } else {
$height = $this->h - $this->tMargin - $this->bMargin; $height = $pdf->h - $pdf->tMargin - $pdf->bMargin;
} }
} }
} }
@ -1430,7 +1430,10 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
*/ */
function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
{ {
global $hookmanager; global $hookmanager,$conf;
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$result=''; $result='';
$reshook=0; $reshook=0;
@ -1447,7 +1450,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
} }
if (empty($reshook)) if (empty($reshook))
{ {
if (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); if (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * (($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100), 0, $outputlangs);
} }
return $result; return $result;
} }
@ -1751,7 +1754,10 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
*/ */
function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
{ {
global $hookmanager; global $hookmanager,$conf;
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$reshook=0; $reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
@ -1771,7 +1777,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
{ {
return $outputlangs->transnoentities("Option"); return $outputlangs->transnoentities("Option");
} }
if (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); if (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * ($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
} }
return $result; return $result;
} }

View File

@ -305,6 +305,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$expedition->id=$objp->sendingid; $expedition->id=$objp->sendingid;
$expedition->fetchObjectLinked($expedition->id,$expedition->element); $expedition->fetchObjectLinked($expedition->id,$expedition->element);
//var_dump($expedition->linkedObjects); //var_dump($expedition->linkedObjects);
$receiving=''; $receiving='';
if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link

View File

@ -87,11 +87,11 @@ abstract class ModeleNumRefBarCode
/** /**
* Return next value available * Return next value available
* *
* @param Societe $objsoc Object thirdparty * @param Societe $objproduct Object Product
* @param int $type Type * @param int $type Type
* @return string Value * @return string Value
*/ */
function getNextValue($objsoc=0,$type=-1) function getNextValue($objproduct,$type='')
{ {
global $langs; global $langs;
return $langs->trans("Function_getNextValue_InModuleNotWorking"); return $langs->trans("Function_getNextValue_InModuleNotWorking");

View File

@ -110,8 +110,8 @@ class pdf_einstein extends ModelePDFCommandes
{ {
$this->posxtva=99; $this->posxtva=99;
$this->posxup=114; $this->posxup=114;
$this->posxqty=133; $this->posxqty=130;
$this->posxunit=150; $this->posxunit=147;
} }
else else
{ {

View File

@ -100,6 +100,7 @@ class pdf_merou extends ModelePdfExpedition
$outputlangs->load("propal"); $outputlangs->load("propal");
$outputlangs->load("deliveries"); $outputlangs->load("deliveries");
$outputlangs->load("sendings"); $outputlangs->load("sendings");
$outputlangs->load("productbatch");
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {

View File

@ -110,6 +110,7 @@ class pdf_rouget extends ModelePdfExpedition
$outputlangs->load("propal"); $outputlangs->load("propal");
$outputlangs->load("deliveries"); $outputlangs->load("deliveries");
$outputlangs->load("sendings"); $outputlangs->load("sendings");
$outputlangs->load("productbatch");
$nblignes = count($object->lines); $nblignes = count($object->lines);

View File

@ -299,9 +299,11 @@ class pdf_standard extends ModeleExpenseReport
$showpricebeforepagebreak=1; $showpricebeforepagebreak=1;
$pdf->SetFont('','', $default_font_size - 1);
// Accountancy piece // Accountancy piece
$pdf->SetXY($this->posxpiece, $curY); $pdf->SetXY($this->posxpiece, $curY);
$pdf->MultiCell($this->posxcomment-$this->posxpiece-0.8, 4, $piece_comptable, 0, 'C'); $pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
// Comments // Comments
$pdf->SetXY($this->posxcomment, $curY); $pdf->SetXY($this->posxcomment, $curY);
@ -537,7 +539,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetFont('','B', $default_font_size + 4); $pdf->SetFont('','B', $default_font_size + 4);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx,6,$langs->trans("ExpenseReport"), 0, 'L'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx,6,$langs->trans("ExpenseReport"), 0, 'R');
$pdf->SetFont('','', $default_font_size -1); $pdf->SetFont('','', $default_font_size -1);
@ -545,19 +547,19 @@ class pdf_standard extends ModeleExpenseReport
$posy+=8; $posy+=8;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'L'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'R');
// Date start period // Date start period
$posy+=5; $posy+=5;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outpulangs):''), '', 'L'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outpulangs):''), '', 'R');
// Date end period // Date end period
$posy+=5; $posy+=5;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outpulangs):''), '', 'L'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outpulangs):''), '', 'R');
// Status Expense Report // Status Expense Report
$posy+=6; $posy+=6;

View File

@ -120,8 +120,8 @@ class pdf_crabe extends ModelePDFFactures
{ {
$this->posxtva=99; $this->posxtva=99;
$this->posxup=114; $this->posxup=114;
$this->posxqty=133; $this->posxqty=130;
$this->posxunit=150; $this->posxunit=147;
} }
else else
{ {
@ -337,6 +337,11 @@ class pdf_crabe extends ModelePDFFactures
$height_incoterms = 0; $height_incoterms = 0;
if ($conf->incoterm->enabled) if ($conf->incoterm->enabled)
{ {
if (is_object($object->thirdparty))
{
$object->fk_incoterms=$object->thirdparty->fk_incoterms;
$object->location_incoterms=$object->thirdparty->location_incoterms;
}
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) if ($desc_incoterms)
{ {
@ -539,13 +544,16 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($this->postotalht, $curY); $pdf->SetXY($this->postotalht, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$prev_progress = $object->lines[$i]->get_prev_progress($object->id); $prev_progress = $object->lines[$i]->get_prev_progress($object->id);
if ($prev_progress > 0) // Compute progress from previous situation if ($prev_progress > 0) // Compute progress from previous situation
{ {
$tvaligne = $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
} else { } else {
$tvaligne = $object->lines[$i]->total_tva; $tvaligne = $sign * $object->lines[$i]->total_tva;
} }
$localtax1ligne=$object->lines[$i]->total_localtax1; $localtax1ligne=$object->lines[$i]->total_localtax1;

View File

@ -504,6 +504,10 @@ class ImportCsv extends ModeleImports
} }
if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null"
} }
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric')
{
$newval = price2num($newval);
}
//print 'Val to use as insert is '.$newval.'<br>'; //print 'Val to use as insert is '.$newval.'<br>';
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -302,6 +302,7 @@ class modCategorie extends DolibarrModules
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category',1).')'; $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category',1).')';
$this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories

View File

@ -69,7 +69,7 @@ class modProductBatch extends DolibarrModules
$this->config_page_url = array(); $this->config_page_url = array();
// Dependencies // Dependencies
$this->depends = array("modProduct","modStock","modExpedition","modSupplier"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order). $this->depends = array("modProduct","modStock","modExpedition","modFournisseur"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order).
$this->requiredby = array(); // List of modules id to disable if this one is disabled $this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(5,0); // Minimum version of PHP required by module $this->phpmin = array(5,0); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module

View File

@ -405,7 +405,8 @@ class modSociete extends DolibarrModules
's.code_client'=>array('rule'=>'getcustomercodeifauto'), 's.code_client'=>array('rule'=>'getcustomercodeifauto'),
's.code_fournisseur'=>array('rule'=>'getsuppliercodeifauto'), 's.code_fournisseur'=>array('rule'=>'getsuppliercodeifauto'),
's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifauto'), 's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifauto'),
's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto') 's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto'),
's.capital'=>array('rule'=>'numeric')
); );
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');

View File

@ -415,6 +415,7 @@ class doc_generic_task_odt extends ModelePDFTask
} }
$project= new Project($this->db); $project= new Project($this->db);
$project->fetch($object->fk_project); $project->fetch($object->fk_project);
$project->fetch_thirdparty();
$dir = $conf->projet->dir_output. "/" . $project->ref. "/"; $dir = $conf->projet->dir_output. "/" . $project->ref. "/";
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
@ -449,7 +450,7 @@ class doc_generic_task_odt extends ModelePDFTask
dol_mkdir($conf->projet->dir_temp); dol_mkdir($conf->projet->dir_temp);
$socobject=$object->thirdparty; $socobject=$project->thirdparty;
// Make substitution // Make substitution
$substitutionarray=array( $substitutionarray=array(

View File

@ -108,8 +108,8 @@ class pdf_azur extends ModelePDFPropales
{ {
$this->posxtva=99; $this->posxtva=99;
$this->posxup=114; $this->posxup=114;
$this->posxqty=133; $this->posxqty=130;
$this->posxunit=150; $this->posxunit=147;
} }
else else
{ {

View File

@ -102,8 +102,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if($conf->global->PRODUCT_USE_UNITS) { if($conf->global->PRODUCT_USE_UNITS) {
$this->posxtva=99; $this->posxtva=99;
$this->posxup=114; $this->posxup=114;
$this->posxqty=133; $this->posxqty=130;
$this->posxunit=150; $this->posxunit=147;
} }
//if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images

View File

@ -111,8 +111,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{ {
$this->posxtva=99; $this->posxtva=99;
$this->posxup=114; $this->posxup=114;
$this->posxqty=133; $this->posxqty=130;
$this->posxunit=150; $this->posxunit=147;
} else { } else {
$this->posxtva=112; $this->posxtva=112;
$this->posxup=126; $this->posxup=126;
@ -211,7 +211,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$hookmanager->initHooks(array('pdfgeneration')); $hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action; global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$nblignes = count($object->lines); $nblignes = count($object->lines);

View File

@ -99,7 +99,7 @@ $coldisplay=-1; // We remove first td
$doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%'); $doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%');
$doleditor->Create(); $doleditor->Create();
} else { } else {
print '<textarea id="desc" class="flat" name="desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>'; print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';
} }
?> ?>
</td> </td>

View File

@ -1023,11 +1023,9 @@ class Cronjob extends CommonObject
} }
if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
} }
}
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG); dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG);
// Update with result // Update with result
$this->lastoutput=''; $this->lastoutput='';
if (is_array($output_arr) && count($output_arr)>0) if (is_array($output_arr) && count($output_arr)>0)
@ -1038,6 +1036,8 @@ class Cronjob extends CommonObject
} }
} }
$this->lastresult=$retval; $this->lastresult=$retval;
}
$this->datelastresult=dol_now(); $this->datelastresult=dol_now();
$result = $this->update($user); $result = $this->update($user);
if ($result < 0) if ($result < 0)

View File

@ -712,7 +712,7 @@ if (! empty($id) && $action != 'edit')
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
} }
if (($object->statut == 0 || $object->statut == 1) && $remaintopay == 0 && $object->paye == 0) if (($object->statut == 0 || $object->statut == 1) && $remaintopay == 0 && $object->paid == 0)
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>"; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
} }
@ -739,9 +739,9 @@ if (! empty($id) && $action != 'edit')
// Delete // Delete
if ($user->rights->don->supprimer) if ($user->rights->don->supprimer)
{ {
if ($don->statut == -1 || $don->statut == 0) if ($object->statut == -1 || $object->statut == 0)
{ {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$don->id.'&action=delete">'.$langs->trans("Delete")."</a></div>"; print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
} }
else else
{ {

View File

@ -4,6 +4,7 @@
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -633,7 +634,7 @@ class Don extends CommonObject
$this->town = $obj->town; $this->town = $obj->town;
$this->zip = $obj->zip; $this->zip = $obj->zip;
$this->town = $obj->town; $this->town = $obj->town;
$this->country_id = $obj->country_id; $this->country_id = $obj->fk_country;
$this->country_code = $obj->country_code; $this->country_code = $obj->country_code;
$this->country = $obj->country; $this->country = $obj->country;
$this->country_olddata= $obj->country_olddata; // deprecated $this->country_olddata= $obj->country_olddata; // deprecated

View File

@ -874,7 +874,8 @@ class Expedition extends CommonObject
$product_type=$product->type; $product_type=$product->type;
if ($product_type == 0 && $product_stock < $qty) if ($product_type == 0 && $product_stock < $qty)
{ {
$this->error=$langs->trans('ErrorStockIsNotEnough'); $langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
@ -930,7 +931,8 @@ class Expedition extends CommonObject
if ($prod_batch->qty < $linebatch->dluo_qty) if ($prod_batch->qty < $linebatch->dluo_qty)
{ {
$this->errors[] = $langs->trans('ErrorStockIsNotEnough'); $langs->load("errors");
$this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product);
dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR); dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
@ -1264,7 +1266,7 @@ class Expedition extends CommonObject
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked"; $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked";
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent"; $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
@ -1334,6 +1336,8 @@ class Expedition extends CommonObject
$line->volume = $obj->volume; $line->volume = $obj->volume;
$line->volume_units = $obj->volume_units; $line->volume_units = $obj->volume_units;
$line->pa_ht = $obj->pa_ht;
// For invoicing // For invoicing
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0 $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -124,6 +125,7 @@ if ($resql)
$expedition = new Expedition($db); $expedition = new Expedition($db);
$param=""; $param="";
if ($sall) $param.= "&amp;sall=".$sall;
if ($search_ref_exp) $param.= "&amp;search_ref_exp=".$search_ref_exp; if ($search_ref_exp) $param.= "&amp;search_ref_exp=".$search_ref_exp;
if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv; if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv;
if ($search_company) $param.= "&amp;search_company=".$search_company; if ($search_company) $param.= "&amp;search_company=".$search_company;

View File

@ -1768,6 +1768,7 @@ class ExpenseReportLine
// Clean parameters // Clean parameters
$this->comments=trim($this->comments); $this->comments=trim($this->comments);
$this->vatrate = price2num($this->vatrate); $this->vatrate = price2num($this->vatrate);
$this->value_unit = price2num($this->value_unit);
$this->db->begin(); $this->db->begin();

View File

@ -193,6 +193,7 @@ if ($resql)
$i = 0; $i = 0;
$param=""; $param="";
if ($sall) $param.="&sall=".$sall;
if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_user) $param.="&search_user=".$search_user; if ($search_user) $param.="&search_user=".$search_user;
if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht; if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht;

View File

@ -57,6 +57,9 @@ if ($action == 'add_payment')
exit; exit;
} }
$expensereport = new ExpenseReport($db);
$expensereport->fetch($chid);
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
if (! $_POST["fk_typepayment"] > 0) if (! $_POST["fk_typepayment"] > 0)
@ -85,8 +88,7 @@ if ($action == 'add_payment')
{ {
if (substr($key,0,7) == 'amount_') if (substr($key,0,7) == 'amount_')
{ {
$other_chid = substr($key,7); $amounts[$expensereport->fk_user_author] = price2num($_POST[$key]);
$amounts[$other_chid] = price2num($_POST[$key]);
$total += price2num($_POST[$key]); $total += price2num($_POST[$key]);
} }
} }

View File

@ -1202,7 +1202,7 @@ class FichinterLigne extends CommonObjectLine
// Mise a jour ligne en base // Mise a jour ligne en base
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET";
$sql.= " description='".$this->db->escape($this->desc)."'"; $sql.= " description='".$this->db->escape($this->desc)."'";
$sql.= ",date=".$this->db->idate($this->datei); $sql.= ",date='".$this->db->idate($this->datei)."'";
$sql.= ",duree=".$this->duration; $sql.= ",duree=".$this->duration;
$sql.= ",rang='".$this->rang."'"; $sql.= ",rang='".$this->rang."'";
$sql.= " WHERE rowid = ".$this->rowid; $sql.= " WHERE rowid = ".$this->rowid;

View File

@ -139,6 +139,7 @@ if ($result)
$num = $db->num_rows($result); $num = $db->num_rows($result);
$urlparam=''; $urlparam='';
if ($sall) $urlparam.="&sall=".$sall;
if ($socid) $urlparam.="&socid=".$socid; if ($socid) $urlparam.="&socid=".$socid;
if ($search_ref) $urlparam.="&search_ref=".urlencode($search_ref); if ($search_ref) $urlparam.="&search_ref=".urlencode($search_ref);
if ($search_company) $urlparam.="&search_company=".urlencode($search_company); if ($search_company) $urlparam.="&search_company=".urlencode($search_company);

View File

@ -31,7 +31,7 @@
*/ */
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.2'); if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.5');
if (! defined('EURO')) define('EURO',chr(128)); if (! defined('EURO')) define('EURO',chr(128));
@ -122,6 +122,7 @@ if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0;
if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0; if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0;
if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0; if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
if (empty($dolibarr_mailing_limit_sendbycli)) $dolibarr_mailing_limit_sendbycli=0;
if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode
// TODO Multicompany Remove this. Useless. // TODO Multicompany Remove this. Useless.
if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0; if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0;

View File

@ -379,6 +379,17 @@ if ($object->id > 0)
} }
// TODO move to DAO class // TODO move to DAO class
$sql = "SELECT count(p.rowid) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
$sql.= " WHERE p.fk_soc =".$object->id;
$sql.= " AND p.entity =".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$object_count = $db->fetch_object($resql);
$num = $object_count->total;
}
$sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc"; $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
$sql.= " WHERE p.fk_soc =".$object->id; $sql.= " WHERE p.fk_soc =".$object->id;
@ -389,7 +400,6 @@ if ($object->id > 0)
if ($resql) if ($resql)
{ {
$i = 0 ; $i = 0 ;
$num = $db->num_rows($resql);
if ($num > 0) if ($num > 0)
{ {
@ -405,7 +415,7 @@ if ($object->id > 0)
} }
$var = True; $var = True;
while ($i < $num && $i <= $MAXLIST) while ($i < $num && $i < $MAXLIST)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;

View File

@ -254,6 +254,8 @@ class CommandeFournisseur extends CommonOrder
$this->fetchObjectLinked(); $this->fetchObjectLinked();
$this->lines=array();
$sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description,"; $sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description,";
$sql.= " l.qty,"; $sql.= " l.qty,";
$sql.= " l.tva_tx, l.remise_percent, l.subprice,"; $sql.= " l.tva_tx, l.remise_percent, l.subprice,";
@ -313,7 +315,7 @@ class CommandeFournisseur extends CommonOrder
$line->date_end = $this->db->jdate($objp->date_end); $line->date_end = $this->db->jdate($objp->date_end);
$line->fk_unit = $objp->fk_unit; $line->fk_unit = $objp->fk_unit;
$this->special_line = $objp->special_line; $this->special_code = $objp->special_code;
$this->fk_parent_line = $objp->fk_parent_line; $this->fk_parent_line = $objp->fk_parent_line;
$this->rang = $objp->rang; $this->rang = $objp->rang;
@ -991,6 +993,8 @@ class CommandeFournisseur extends CommonOrder
$this->date_commande = $this->db->idate($date); $this->date_commande = $this->db->idate($date);
$result = 1; $result = 1;
$this->log($user, 3, $date, $comment); $this->log($user, 3, $date, $comment);
$this->date_commande = $date;
$this->methode_commande = $methode;
} }
else else
{ {

View File

@ -5,6 +5,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -174,7 +175,7 @@ if (GETPOST('statut', 'alpha') !== '')
$sql .= " AND cf.fk_statut IN (".GETPOST('statut', 'alpha').")"; $sql .= " AND cf.fk_statut IN (".GETPOST('statut', 'alpha').")";
} }
if ($billed !== '') if ($billed !== '' && $billed >= 0)
{ {
$sql .= " AND cf.billed = ".$billed; $sql .= " AND cf.billed = ".$billed;
} }
@ -208,6 +209,7 @@ if ($resql)
$i = 0; $i = 0;
$param=""; $param="";
if ($sall) $param.="&search_all=".$sall;
if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_company) $param.="&search_company=".$search_company; if ($search_company) $param.="&search_company=".$search_company;
if ($search_user) $param.="&search_user=".$search_user; if ($search_user) $param.="&search_user=".$search_user;
@ -215,7 +217,7 @@ if ($resql)
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp; if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
if ($socid) $param.="&socid=".$socid; if ($socid) $param.="&socid=".$socid;
if ($search_status >= 0) $param.="&search_status=".$search_status; if ($search_status >= 0) $param.="&search_status=".$search_status;
if ($billed != '') $param.="billed=".$billed; if ($billed != '') $param.="&billed=".$billed;
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);

View File

@ -71,6 +71,11 @@ $date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_e
$date_starty = dol_mktime(0, 0, 0, $_REQUEST["date_start_delymonth"], $_REQUEST["date_start_delyday"], $_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_starty = dol_mktime(0, 0, 0, $_REQUEST["date_start_delymonth"], $_REQUEST["date_start_delyday"], $_REQUEST["date_start_delyyear"]); // Date for local PHP server
$date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["date_end_delyday"], $_REQUEST["date_end_delyyear"]); $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["date_end_delyday"], $_REQUEST["date_end_delyyear"]);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('facture_fourn');
if ($action == 'create') { if ($action == 'create') {
if (is_array($selected) == false) { if (is_array($selected) == false) {
$mesgs = array ( $mesgs = array (
@ -160,6 +165,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
if (empty($object->date_echeance)) if (empty($object->date_echeance))
$object->date_echeance = $object->calculate_date_lim_reglement(); $object->date_echeance = $object->calculate_date_lim_reglement();
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
if ($_POST['origin'] && $_POST['originid']) { if ($_POST['origin'] && $_POST['originid']) {
$object->linked_objects = $orders_id; $object->linked_objects = $orders_id;
$id = $object->create($user); $id = $object->create($user);
@ -360,6 +368,12 @@ if ($action == 'create' && !$error) {
); );
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
$object=new FactureFournisseur($db);
print $object->showOptionals($extrafields,'edit');
}
// Modele PDF // Modele PDF
print '<tr><td>' . $langs->trans('Model') . '</td>'; print '<tr><td>' . $langs->trans('Model') . '</td>';
print '<td>'; print '<td>';

View File

@ -292,14 +292,17 @@ if (empty($reshook))
} }
// Delete payment // Delete payment
elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) elseif ($action == 'confirm_delete_paiement' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer)
{ {
$object->fetch($id); $object->fetch($id);
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0) if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0)
{ {
$paiementfourn = new PaiementFourn($db); $paiementfourn = new PaiementFourn($db);
$result=$paiementfourn->fetch(GETPOST('paiement_id')); $result=$paiementfourn->fetch(GETPOST('paiement_id'));
if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found if ($result > 0) {
$result=$paiementfourn->delete(); // If fetch ok and found
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
}
if ($result < 0) { if ($result < 0) {
setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors'); setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors');
} }
@ -1725,6 +1728,12 @@ else
{ {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1);
}
if ($action == 'deletepaiement')
{
$payment_id = GETPOST('paiement_id');
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 0, 1);
} }
// Confirmation to delete line // Confirmation to delete line

View File

@ -296,6 +296,7 @@ if ($resql)
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder);
if (empty($conf->global->SUPPLIER_INVOICE_HIDE_REF_SUPPLIER)) print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"ref_supplier","",$param,"",$sortfield,$sortorder); if (empty($conf->global->SUPPLIER_INVOICE_HIDE_REF_SUPPLIER)) print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"ref_supplier","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef,fac.rowid","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef,fac.rowid","",$param,'align="center"',$sortfield,$sortorder);
@ -380,7 +381,8 @@ if ($resql)
print $facturestatic->getNomUrl(1); print $facturestatic->getNomUrl(1);
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir); $subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
print "</td>\n"; print "</td>\n";
// Ref supplier // Ref supplier

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,7 @@ class Odf
public $userdefined=array(); public $userdefined=array();
const PIXEL_TO_CM = 0.026458333; const PIXEL_TO_CM = 0.026458333;
/** /**
* Class constructor * Class constructor
* *
@ -107,6 +108,7 @@ class Odf
copy($filename, $this->tmpfile); copy($filename, $this->tmpfile);
// Clean file to have tags for line corrected
$this->_moveRowSegments(); $this->_moveRowSegments();
} }
@ -201,7 +203,9 @@ class Odf
public function phpEval() public function phpEval()
{ {
preg_match_all('/[\{\<]\?(php)?\s+(?P<content>.+)\?[\}\>]/iU',$this->contentXml, $matches); // detecting all {?php code ?} or <?php code ? > preg_match_all('/[\{\<]\?(php)?\s+(?P<content>.+)\?[\}\>]/iU',$this->contentXml, $matches); // detecting all {?php code ?} or <?php code ? >
for ($i=0;$i < count($matches['content']);$i++) { $nbfound=count($matches['content']);
for ($i=0; $i < $nbfound; $i++)
{
try { try {
$ob_output = ''; // flush the output for each code. This var will be filled in by the eval($code) and output buffering : any print or echo or output will be redirected into this variable $ob_output = ''; // flush the output for each code. This var will be filled in by the eval($code) and output buffering : any print or echo or output will be redirected into this variable
$code = $matches['content'][$i]; $code = $matches['content'][$i];
@ -247,12 +251,17 @@ IMG;
/** /**
* Move segment tags for lines of tables * Move segment tags for lines of tables
* Called automatically within the constructor * This function is called automatically within the constructor, so this->contentXml is clean before any other thing
* *
* @return void * @return void
*/ */
private function _moveRowSegments() private function _moveRowSegments()
{ {
// Replace BEGIN<text:s/>xxx into BEGIN xxx
$this->contentXml = preg_replace('/\[!--\sBEGIN<text:s[^>]>(row.[\S]*)\s--\]/sm', '[!-- BEGIN \\1 --]', $this->contentXml);
// Replace END<text:s/>xxx into END xxx
$this->contentXml = preg_replace('/\[!--\sEND<text:s[^>]>(row.[\S]*)\s--\]/sm', '[!-- END \\1 --]', $this->contentXml);
// Search all possible rows in the document // Search all possible rows in the document
$reg1 = "#<table:table-row[^>]*>(.*)</table:table-row>#smU"; $reg1 = "#<table:table-row[^>]*>(.*)</table:table-row>#smU";
preg_match_all($reg1, $this->contentXml, $matches); preg_match_all($reg1, $this->contentXml, $matches);
@ -333,7 +342,7 @@ IMG;
/** /**
* Add the merged segment to the document * Add the merged segment to the document
* *
* @param Segment $segment * @param Segment $segment Segment
* @throws OdfException * @throws OdfException
* @return odf * @return odf
*/ */
@ -383,7 +392,7 @@ IMG;
/** /**
* Declare a segment in order to use it in a loop * Declare a segment in order to use it in a loop
* *
* @param string $segment * @param string $segment Segment
* @throws OdfException * @throws OdfException
* @return Segment * @return Segment
*/ */
@ -395,7 +404,7 @@ IMG;
// $reg = "#\[!--\sBEGIN\s$segment\s--\]<\/text:p>(.*)<text:p\s.*>\[!--\sEND\s$segment\s--\]#sm"; // $reg = "#\[!--\sBEGIN\s$segment\s--\]<\/text:p>(.*)<text:p\s.*>\[!--\sEND\s$segment\s--\]#sm";
$reg = "#\[!--\sBEGIN\s$segment\s--\](.*)\[!--\sEND\s$segment\s--\]#sm"; $reg = "#\[!--\sBEGIN\s$segment\s--\](.*)\[!--\sEND\s$segment\s--\]#sm";
if (preg_match($reg, html_entity_decode($this->contentXml), $m) == 0) { if (preg_match($reg, html_entity_decode($this->contentXml), $m) == 0) {
throw new OdfException("'$segment' segment not found in the document"); throw new OdfException("'".$segment."' segment not found in the document. The tag [!-- BEGIN xxx --] or [!-- END xxx --] is not present into content file.");
} }
$this->segments[$segment] = new Segment($segment, $m[1], $this); $this->segments[$segment] = new Segment($segment, $m[1], $this);
return $this->segments[$segment]; return $this->segments[$segment];
@ -674,9 +683,9 @@ IMG;
/** /**
* return the value present on odt in [valuename][/valuename] * return the value present on odt in [valuename][/valuename]
*
* @param string $value name balise in the template * @param string $value name balise in the template
* @return string the value inside the balise * @return string the value inside the balise
*
*/ */
public function getvalue($valuename) public function getvalue($valuename)
{ {
@ -688,4 +697,3 @@ IMG;
} }
?>

View File

@ -22,7 +22,7 @@
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); insert into llx_const (name, value, type, note, visible, entity) values (__ENCRYPT('MAIN_ENABLE_LOG_TO_HTML')__,__ENCRYPT('0')__,'chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0);
-- Was done into a 3.8 fix, so we must do it also in 3.9 -- Was done into a 3.8 fix, so we must do it also in 3.9
@ -61,7 +61,7 @@ update llx_opensurvey_sondage set format = 'D' where format = 'D+';
update llx_opensurvey_sondage set format = 'A' where format = 'A+'; update llx_opensurvey_sondage set format = 'A' where format = 'A+';
INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0); INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_SIZE_SHORTLISTE_LIMIT')__,__ENCRYPT('4')__,'chaine','Longueur maximum des listes courtes (fiche client)',0);
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);

View File

@ -63,10 +63,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH RO
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_advtargetemailing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplierdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
@ -96,7 +92,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_documents FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_m();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
@ -128,7 +124,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_donation FOR
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_expensereport FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_expensereport FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_loan FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_loan FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printer_ipp FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_batch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_batch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
@ -155,8 +150,9 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_rib FOR EACH
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_stock_mouvement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_stock_mouvement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_time_basket FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_supplier_proposal FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_timebasket_counter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_supplier_proposal_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_supplier_proposaldet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_tva FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_tva FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@ -73,6 +73,12 @@ $actiondone=1;
print '<h3>'.$langs->trans("Repair").'</h3>'; print '<h3>'.$langs->trans("Repair").'</h3>';
print 'Option restore_thirdparties_logos is '.(GETPOST('restore_thirdparties_logos')?GETPOST('restore_thirdparties_logos'):'0').'<br>'."\n";
print 'Option clean_linked_elements is '.(GETPOST('clean_linked_elements')?GETPOST('clean_linked_elements'):'0').'<br>'."\n";
print 'Option clean_orphelin_dir (1 or confirmed) is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'<br>'."\n";
print 'Option clean_product_stock_batch (1 or confirmed) is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'<br>'."\n";
print '<br>';
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">'; print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
$error=0; $error=0;
@ -196,7 +202,8 @@ if ($ok)
} }
// sync_extrafields: Search list of fields declared and list of fields created into databases and create fields missing // sync_extrafields: Search list of fields declared and list of fields created into databases, then create fields missing
if ($ok) if ($ok)
{ {
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
@ -204,6 +211,7 @@ if ($ok)
'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture', 'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture',
'commande_fournisseur'=>'commande_fournisseur', 'actioncomm'=>'actioncomm', 'commande_fournisseur'=>'commande_fournisseur', 'actioncomm'=>'actioncomm',
'adherent_type'=>'adherent_type','user'=>'user','projet'=>'projet', 'projet_task'=>'projet_task'); 'adherent_type'=>'adherent_type','user'=>'user','projet'=>'projet', 'projet_task'=>'projet_task');
print '<tr><td colspan="2"><br>Check fields into extra table structure match table of definition. If not add column into table</td></tr>';
foreach($listofmodulesextra as $tablename => $elementtype) foreach($listofmodulesextra as $tablename => $elementtype)
{ {
// Get list of fields // Get list of fields
@ -292,6 +300,8 @@ if ($ok && GETPOST('restore_thirdparties_logos'))
//$exts=array('gif','png','jpg'); //$exts=array('gif','png','jpg');
$ext=''; $ext='';
print '<tr><td colspan="2"><br>';
//foreach($exts as $ext) //foreach($exts as $ext)
//{ //{
$sql="SELECT s.rowid, s.nom as name, s.logo FROM ".MAIN_DB_PREFIX."societe as s ORDER BY s.nom"; $sql="SELECT s.rowid, s.nom as name, s.logo FROM ".MAIN_DB_PREFIX."societe as s ORDER BY s.nom";
@ -353,6 +363,8 @@ if ($ok && GETPOST('restore_thirdparties_logos'))
$ok=0; $ok=0;
dol_print_error($db); dol_print_error($db);
} }
print '</td></tr>';
//} //}
} }
@ -360,23 +372,24 @@ if ($ok && GETPOST('restore_thirdparties_logos'))
// clean_linked_elements: Check and clean linked elements // clean_linked_elements: Check and clean linked elements
if ($ok && GETPOST('clean_linked_elements')) if ($ok && GETPOST('clean_linked_elements'))
{ {
print '<tr><td colspan="2"><br>Check table of linked elements and delete orphelins links</td></tr>';
// propal => order // propal => order
print "</td><td>".checkLinkedElements('propal', 'commande')."</td></tr>\n"; print '<tr><td colspan="2">'.checkLinkedElements('propal', 'commande')."</td></tr>\n";
// propal => invoice // propal => invoice
print "</td><td>".checkLinkedElements('propal', 'facture')."</td></tr>\n"; print '<tr><td colspan="2">'.checkLinkedElements('propal', 'facture')."</td></tr>\n";
// order => invoice // order => invoice
print "</td><td>".checkLinkedElements('commande', 'facture')."</td></tr>\n"; print '<tr><td colspan="2">'.checkLinkedElements('commande', 'facture')."</td></tr>\n";
// order => shipping // order => shipping
print "</td><td>".checkLinkedElements('commande', 'shipping')."</td></tr>\n"; print '<tr><td colspan="2">'.checkLinkedElements('commande', 'shipping')."</td></tr>\n";
// shipping => delivery // shipping => delivery
print "</td><td>".checkLinkedElements('shipping', 'delivery')."</td></tr>\n"; print '<tr><td colspan="2">'.checkLinkedElements('shipping', 'delivery')."</td></tr>\n";
// order_supplier => invoice_supplier // order_supplier => invoice_supplier
print "</td><td>".checkLinkedElements('order_supplier', 'invoice_supplier')."</td></tr>\n"; print '<tr><td colspan="2">'.checkLinkedElements('order_supplier', 'invoice_supplier')."</td></tr>\n";
} }
@ -399,11 +412,16 @@ if ($ok && GETPOST('clean_orphelin_dir'))
if (empty($upload_dir)) continue; if (empty($upload_dir)) continue;
print '<tr><td colspan="2">Clean orphelins files into files '.$upload_dir.'</td></tr>'; print '<tr><td colspan="2"><br>Clean orphelins files into files '.$upload_dir.'</td></tr>';
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview\.png)$','^temp$','^payments$','^CVS$','^thumbs$'),'',SORT_DESC,1); $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview\.png)$','^temp$','^payments$','^CVS$','^thumbs$'),'',SORT_DESC,1,true);
// To show ref or specific information according to view to show (defined by $module) // To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'company')
{
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$object_instance=new Societe($db);
}
if ($modulepart == 'invoice') if ($modulepart == 'invoice')
{ {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -460,7 +478,7 @@ if ($ok && GETPOST('clean_orphelin_dir'))
preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1];
} }
if ($modulepart == 'invoice_supplier') { if ($modulepart == 'invoice_supplier') {
preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=empty($reg[1])?'':$reg[1];
} }
if ($modulepart == 'propal') { if ($modulepart == 'propal') {
preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1];
@ -488,7 +506,7 @@ if ($ok && GETPOST('clean_orphelin_dir'))
// Clean of orphelins directories are done into repair.php // Clean of orphelins directories are done into repair.php
print '<tr><td colspan="2">'; print '<tr><td colspan="2">';
print 'Delete orphelins file '.$file['fullname'].'<br>'; print 'Delete orphelins file '.$file['fullname'].'<br>';
if (GETPOST('purge') == 2) if (GETPOST('clean_orphelin_dir') == 'confirmed')
{ {
dol_delete_file($file['fullname'],1,1,1); dol_delete_file($file['fullname'],1,1,1);
dol_delete_dir(dirname($file['fullname']),1); dol_delete_dir(dirname($file['fullname']),1);
@ -502,6 +520,107 @@ if ($ok && GETPOST('clean_orphelin_dir'))
} }
} }
// clean_linked_elements: Check and clean linked elements
if ($ok && GETPOST('clean_product_stock_batch'))
{
print '<tr><td colspan="2"><br>Clean table product_batch</td></tr>';
$sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
$sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
$sql.=" AND p.tobatch = 1";
$sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
$sql.=" HAVING reel != SUM(pb.qty)";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
$i = 0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
print '<tr><td>'.$obj->rowid.'-'.$obj->ref.'-'.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' != '.$obj->reelbatch;
// Fix
if ($obj->reel != $obj->reelbatch)
{
$methodtofix='updatestock';
if ($methodtofix == 'updatebatch')
{
// Method 1
print ' -> Insert qty '.($obj->reel - $obj->reelbatch).' with lot 000000 linked to fk_product_stock='.$obj->psrowid;
if (GETPOST('clean_product_stock_batch') == 'confirmed')
{
$sql2 ="INSERT INTO ".MAIN_DB_PREFIX."product_batch(fk_product_stock, batch, qty)";
$sql2.="VALUES(".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")";
$resql2=$db->query($sql2);
if (! $resql2)
{
// TODO If it fails, we must make update
//$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_batch";
//$sql2.=" SET ".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")";
//$sql2.=" WHERE fk_product_stock = ".$obj->psrowid"
}
}
}
if ($methodtofix == 'updatestock')
{
// Method 2
print ' -> Update qty of stock with qty = '.$obj->reelbatch.' for ps.rowid = '.$obj->psrowid;
if (GETPOST('clean_product_stock_batch') == 'confirmed')
{
$error=0;
$db->begin();
$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_stock";
$sql2.=" SET reel = ".$obj->reelbatch." WHERE rowid = ".$obj->psrowid;
$resql2=$db->query($sql2);
if ($resql2)
{
// We update product stock, so we must update product.stock too.
$sql3='UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid)';
$resql3=$db->query($sql3);
if (! $resql3)
{
$error++;
dol_print_error($db);
}
}
else
{
$error++;
dol_print_error($db);
}
if (!$error) $db->commit();
else $db->rollback();
}
}
}
print'</td></tr>';
$i++;
}
}
}
else
{
dol_print_error($db);
}
}
print '</table>'; print '</table>';
@ -512,7 +631,7 @@ if (empty($actiondone))
} }
print '<div class="center"><a href="../index.php?mainmenu=home'.(isset($_POST["login"])?'&username='.urlencode($_POST["login"]):'').'">'; print '<div class="center" style="padding-top: 10px"><a href="../index.php?mainmenu=home'.(isset($_POST["login"])?'&username='.urlencode($_POST["login"]):'').'">';
print $langs->trans("GoToDolibarr"); print $langs->trans("GoToDolibarr");
print '</a></div>'; print '</a></div>';

View File

@ -564,6 +564,8 @@ Module59000Name=Margins
Module59000Desc=Module to manage margins Module59000Desc=Module to manage margins
Module60000Name=Commissions Module60000Name=Commissions
Module60000Desc=Module to manage commissions Module60000Desc=Module to manage commissions
Module63000Name=Resources
Module63000Desc=Manage resources (printers, cars, room, ...) you can then share into events
Permission11=Read customer invoices Permission11=Read customer invoices
Permission12=Create/modify customer invoices Permission12=Create/modify customer invoices
Permission13=Unvalidate customer invoices Permission13=Unvalidate customer invoices

View File

@ -432,3 +432,4 @@ MergeThirdparties=Merge third parties
ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one. ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one.
ThirdpartiesMergeSuccess=Thirdparties have been merged ThirdpartiesMergeSuccess=Thirdparties have been merged
ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted. ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted.
NewCustomerSupplierCodeProposed=New customer or supplier proposed on duplicate code

View File

@ -173,6 +173,14 @@ ErrorOppStatusRequiredIfAmount=You set an estimated amount for this opportunity/
ErrorBadDefinitionOfMenuArrayInModuleDescriptor=Bad Definition Of Menu Array In Module Descriptor (bad value for key fk_menu) ErrorBadDefinitionOfMenuArrayInModuleDescriptor=Bad Definition Of Menu Array In Module Descriptor (bad value for key fk_menu)
ErrorSavingChanges=An error has ocurred when saving the changes ErrorSavingChanges=An error has ocurred when saving the changes
ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship
ErrorFileMustHaveFormat=File must have format %s
ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled.
ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enough for product %s to add it into a new order.
ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enough for product %s to add it into a new invoice.
ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s to add it into a new shipment.
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal.
ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information.
# Warnings # Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.

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