From a8052d8ea48f1ad9622c82e95b39b4f01ee9bd10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Dec 2014 19:05:22 +0100 Subject: [PATCH 01/18] Fixed: Several fix in color management (function at wrong place, mark param that are deprecated, convertion of value to get correct format in all situation) --- htdocs/adherents/stats/geo.php | 3 +- htdocs/core/class/html.formother.class.php | 8 ++--- htdocs/core/lib/functions.lib.php | 13 -------- htdocs/core/lib/functions2.lib.php | 39 ++++++++++++++++++++++ htdocs/theme/eldy/style.css.php | 13 ++++---- 5 files changed, 52 insertions(+), 24 deletions(-) diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 736f6ef0140..938e3e172b2 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -23,6 +23,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $graphwidth=DolGraph::getDefaultGraphSizeForStats('width',700); @@ -69,7 +70,7 @@ dol_mkdir($dir); if ($mode) { - // Define sql + // Define sql if ($mode == 'memberbycountry') { $label=$langs->trans("Country"); diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 1ed76cddd9b..c7f953dbbfc 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -560,13 +560,13 @@ class FormOther * * @param string $set_color Pre-selected color * @param string $prefix Name of HTML field - * @param string $form_name Name of form + * @param string $form_name Deprecated. Not used. * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @return void * @deprecated */ - function select_color($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='') + function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='') { print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors); } @@ -576,13 +576,13 @@ class FormOther * * @param string $set_color Pre-selected color * @param string $prefix Name of HTML field - * @param string $form_name Name of form + * @param string $form_name Deprecated. Not used. * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @param string $morecss Add css style into input field * @return void */ - function selectColor($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='', $morecss='') + function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='') { global $langs,$conf; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a7cb3bbee73..a48b7e3caff 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4835,19 +4835,6 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=') } -/** - * Convert an array with RGB value into hex RGB value - * - * @param array $arraycolor Array - * @param string $colorifnotfound Color code to return if entry not defined - * @return string RGB hex value (without # before). For example: FF00FF - */ -function colorArrayToHex($arraycolor,$colorifnotfound='888888') -{ - if (! is_array($arraycolor)) return $colorifnotfound; - return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]); -} - /** * Set focus onto field with selector * diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 4702fe69e99..246af863d12 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1836,3 +1836,42 @@ function fetchObjectByElement($element_id,$element_type) { } return 0; } + + +/** + * Convert an array with RGB value into hex RGB value + * + * @param array $arraycolor Array + * @param string $colorifnotfound Color code to return if entry not defined + * @return string RGB hex value (without # before). For example: FF00FF + * @see Make the opposite of colorStringToArray + */ +function colorArrayToHex($arraycolor,$colorifnotfound='888888') +{ + if (! is_array($arraycolor)) return $colorifnotfound; + return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]); +} + + +/** + * Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255) + * + * @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255') + * @param string $colorifnotfound Color code to return if entry not defined + * @return string RGB hex value (without # before). For example: FF00FF + * @see Make the opposite of colorArrayToHex + */ +function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88)) +{ + if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is + $tmp=preg_match('/^([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg); + if (! $tmp) + { + $tmp=explode(',',$stringcolor); + if (count($tmp) < 3) return $colorifnotfound; + return $tmp; + } + return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3])); +} + + diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c4d933d4940..99d5495ef58 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -38,6 +38,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); session_cache_limiter(FALSE); require_once '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); @@ -131,12 +132,8 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) $conf->global->THEME_ELDY_LINEIMPAIR2='255,255,255'; $conf->global->THEME_ELDY_LINEIMPAIRHOVER='238,246,252'; $conf->global->THEME_ELDY_TEXT='50,50,130'; - /*if ($dol_use_jmobile) - { - $conf->global->THEME_ELDY_BACKTABCARD1='245,245,245'; // topmenu - $conf->global->THEME_ELDY_BACKTABCARD2='245,245,245'; - $conf->global->THEME_ELDY_BACKTABACTIVE='245,245,245'; - }*/ + $conf->global->THEME_ELDY_FONT_SIZE1='12'; + $conf->global->THEME_ELDY_FONT_SIZE2='11'; } $colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); @@ -167,6 +164,10 @@ if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf-> $colorbacklinepairhover=''; } +// Format color value to match expected format (may be 'FFFFFF' or '255,255,255') +$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); +$colorbacktabcard2=join(',',colorStringToArray($colorbacktabcard2)); + // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); From 5f8919c857b16df0aec7505e2d89652cc25fca70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Dec 2014 23:59:33 +0100 Subject: [PATCH 02/18] Update translation --- htdocs/comm/action/card.php | 4 ++-- htdocs/langs/en_US/agenda.lang | 1 + htdocs/langs/fr_FR/agenda.lang | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 60fb20206b7..8a2c602a3f0 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -902,7 +902,7 @@ if ($id > 0) } // Assigned to - print ''.$langs->trans("ActionAffectedTo").''; + print ''.$langs->trans("ActionAssignedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { @@ -1072,7 +1072,7 @@ if ($id > 0) } // Assigned to - print ''.$langs->trans("ActionAffectedTo").''; + print ''.$langs->trans("ActionAssignedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 5781d5e3ac0..1cc01ec2e7b 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -29,6 +29,7 @@ ActionsToDoBy=Events assigned to ActionsDoneBy=Events done by ActionsForUser=Events for user ActionsForUsersGroup=Events for all users of group +ActionAssignedTo=Event assigned to AllMyActions= All my events/tasks AllActions= All events/tasks ViewList=List view diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index be2e6083aa6..a4e5e7e0a03 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -29,6 +29,7 @@ ActionsToDoBy=Événements affectés à ActionsDoneBy=Événements réalisés par ActionsForUser=Evénements de l'utilisateur ActionsForUsersGroup=Evénements de tous les utilisateurs du groupe +ActionAssignedTo=Événement assigné à AllMyActions= Tous mes événements AllActions= Tous les événements ViewList=Vue liste From cf641194a1730c0edd97361535d218293b05b5d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Dec 2014 00:02:43 +0100 Subject: [PATCH 03/18] Fix: CRLF --- dev/translation/strip_language_file.php | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/dev/translation/strip_language_file.php b/dev/translation/strip_language_file.php index d6c45d9f249..42a70c8c1a6 100755 --- a/dev/translation/strip_language_file.php +++ b/dev/translation/strip_language_file.php @@ -1,20 +1,20 @@ #!/usr/bin/php - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * Copyright (C) 2014 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * * ----- * @@ -270,8 +270,8 @@ foreach($filesToProcess as $fileToProcess) print "Output can be found at $output.\n"; - print "To rename all .delta files, you can do\n"; - print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n"; + print "To rename all .delta files, you can do\n"; + print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n"; } From 63f2bfed24123dfde67150566a82916c99666330 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Dec 2014 11:19:16 +0100 Subject: [PATCH 04/18] Fixed: Maxi debug of withdrawal module. --- htdocs/admin/prelevement.php | 4 +- htdocs/compta/facture/class/facture.class.php | 25 ++++-- htdocs/compta/facture/prelevement.php | 77 ++++++++++++------- .../class/bonprelevement.class.php | 16 ++-- .../class/ligneprelevement.class.php | 6 +- htdocs/compta/prelevement/create.php | 21 +++-- htdocs/compta/prelevement/fiche-stat.php | 3 +- htdocs/compta/prelevement/ligne.php | 2 +- htdocs/compta/prelevement/lignes.php | 8 +- htdocs/compta/prelevement/stats.php | 4 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/withdrawals.lang | 3 +- htdocs/societe/rib.php | 20 +++-- 13 files changed, 124 insertions(+), 67 deletions(-) diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 6094bb7e4f1..3bff5c29118 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2005-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * @@ -153,7 +153,7 @@ print $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEME print ''; // ICS -print ''.$langs->trans("ICS").''; +print ''.$langs->trans("ICS").''; print ''; print ''; print ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b924b059bfd..cd8ba3b06a1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2837,6 +2837,8 @@ class Facture extends CommonInvoice */ function demande_prelevement($user) { + $error=0; + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); if ($this->statut > 0 && $this->paye == 0) @@ -2882,21 +2884,32 @@ class Facture extends CommonInvoice $sql .= ",'".$bac->cle_rib."')"; dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); - if ($this->db->query($sql)) + $resql=$this->db->query($sql); + if (! $resql) { - return 1; - } - else - { $this->error=$this->db->lasterror(); dol_syslog(get_class($this).'::demandeprelevement Erreur'); - return -1; + $error++; } + + if (! $error) + { + // Force payment mode of invoice to withdraw + $payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement'); + if ($payment_mode_id > 0) + { + $result=$this->setPaymentMethods($payment_mode_id); + } + } + + if ($error) return -1; + return 1; } else { $this->error="A request already exists"; dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours'); + return 0; } } else diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 48ca10afd2d..1b4f440b461 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -58,6 +58,7 @@ if ($id > 0 || ! empty($ref)) } } + /* * Actions */ @@ -69,14 +70,14 @@ if ($action == "new") $result = $object->demande_prelevement($user); if ($result > 0) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; + setEventMessage($langs->trans("RecordSaved")); } else { setEventMessage($object->error, 'errors'); } } + $action=''; } if ($action == "delete") @@ -307,6 +308,31 @@ if ($object->id > 0) print ''; print ''; + // Conditions de reglement + print ''; + print ''; + if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('PaymentConditionsShort'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print ''; + if ($object->type != Facture::TYPE_CREDIT_NOTE) + { + if ($action == 'editconditions') + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); + } + else + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); + } + } + else + { + print ' '; + } + print ''; + // Date payment term print ''; print ''; - // Conditions de reglement - print ''; - - // Mode de reglement + // Payment mode print ''; + print ''; print ''; print ''; } @@ -475,10 +481,10 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) } // IBAN - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; ; $total += $obj->reel; if (price2num($obj->pmp)) $totalwithpmp += $obj->reel; - $totalvalue = $totalvalue + price2num($obj->pmp*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product - $totalvaluesell = $totalvaluesell + price2num($product->price*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product + $totalvalue = $totalvalue + ($obj->pmp*$obj->reel); // Ditto : Show PMP from movement or from product + $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); // Ditto : Show PMP from movement or from product //Batch Detail if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) { @@ -670,7 +673,7 @@ else dol_print_error($db); print ''; print ''; print ''; // Value purchase print ''; + print ''; // Total PMP - print ''; - $totalvalue+=price2num($objp->pmp*$objp->value,'MT'); + print ''; + $totalvalue+=price2num($objp->ppmp*$objp->value,'MT'); // Price sell min if (empty($conf->global->PRODUIT_MULTIPRICES)) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index c55466ebdb1..c85c501fa58 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -52,7 +52,7 @@ $year = strftime("%Y",time()); */ $sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,"; -$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index e7be28b96bd..616e91d1924 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -125,7 +125,7 @@ if ($action == "correct_stock" && ! $cancel) $product = new Product($db); $result=$product->fetch($id); } - if ($product->hasbatch()) + if ($product->hasbatch()) { $d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); $d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); @@ -140,7 +140,7 @@ if ($action == "correct_stock" && ! $cancel) $d_sellby, GETPOST('batch_number') ); // We do not change value of stock for a correction - } + } else { $result=$product->correct_stock( @@ -633,9 +633,9 @@ if ($resql) print ''; print ''; // PMP - print ''; // Ditto : Show PMP from movement or from product + print ''; // Ditto : Show PMP from movement or from product // Value purchase - print ''; // Ditto : Show PMP from movement or from product + print ''; // Ditto : Show PMP from movement or from product // Sell price print ''; ; $total += $obj->reel; - if (price2num($obj->pmp)) $totalwithpmp += $obj->reel; - $totalvalue = $totalvalue + ($obj->pmp*$obj->reel); // Ditto : Show PMP from movement or from product + if (price2num($product->pmp)) $totalwithpmp += $obj->reel; + $totalvalue = $totalvalue + ($product->pmp*$obj->reel); // Ditto : Show PMP from movement or from product $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); // Ditto : Show PMP from movement or from product //Batch Detail - if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) + if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) { $details=Productbatch::findAll($db,$obj->product_stock_id); if ($details<0) dol_print_error($db); - foreach ($details as $pdluo) + foreach ($details as $pdluo) { print "\n".''; print ''; @@ -670,14 +670,15 @@ if ($resql) } } else dol_print_error($db); + print ''; print ''; print ''; // Value purchase print ''; print ''; print "
'; @@ -333,32 +359,7 @@ if ($object->id > 0) } print '
'; - print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; - print '
'; - if ($object->type != Facture::TYPE_CREDIT_NOTE) - { - if ($action == 'editconditions') - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); - } - else - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); - } - } - else - { - print ' '; - } - print '
'; print ''; + // Bank Account + print '"; + print ''; + // Montants print ''; print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 47ac4d1a390..5da94a28b76 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -56,7 +56,9 @@ class BonPrelevement extends CommonObject var $statut; // 0-Wait, 1-Trans, 2-Done var $labelstatut=array(); + var $invoice_in_error=array(); + /** * Constructor * @@ -835,7 +837,7 @@ class BonPrelevement extends CommonObject else { dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR); - $facture_errors[$fac[0]]="Error on default bank number RIB/IBAN for thirdparty reported by function verif() ".$fact->socid." ".$soc->name; + $this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->name; } } else @@ -1814,21 +1816,21 @@ class BonPrelevement extends CommonObject if ($mode == 1) { - if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0').' '.$langs->trans($this->labelstatut[$statut]); - if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]); + if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]); + if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3').' '.$langs->trans($this->labelstatut[$statut]); if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]); } if ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0'); - if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); + if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); + if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3'); if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6'); } if ($mode == 3) { - if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut0'); - if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); + if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); + if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3'); if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut6'); } } diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 9c4bf96e8b3..581fb3152af 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -138,20 +138,20 @@ class LignePrelevement if ($mode == 1) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); + if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); } if ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); + if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4'); if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); } if ($mode == 3) { - if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); + if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4'); if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut8'); } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 0326e4922f1..e4cb4b65c30 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -70,6 +70,10 @@ if ($action == 'create') if ($result == 0) { $mesg='
'.$langs->trans("NoInvoiceCouldBeWithdrawed").'
'; + foreach($bprev->invoice_in_error as $key => $val) + { + $mesg.=$val."
\n"; + } } } @@ -179,6 +183,7 @@ if ($resql) print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -190,16 +195,22 @@ if ($resql) { $obj = $db->fetch_object($resql); $var=!$var; - print ''; + print ''; + // Thirdparty print ''; + // RIB + print ''; + // Amount print ''; @@ -211,7 +222,7 @@ if ($resql) $i++; } } - else print ''; + else print ''; print "
'; print $langs->trans('PaymentMode'); @@ -376,6 +377,26 @@ if ($object->id > 0) } print '
'; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon)) + print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + print '
'; + if ($action == 'editbankaccount') + { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } + else + { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print "
'.$langs->trans('AmountHT').''.price($object->total_ht).'
'.$langs->trans("Invoice").''.$langs->trans("ThirdParty").''.$langs->trans("RIB").''.$langs->trans("AmountTTC").''.$langs->trans("DateRequest").'
'; + print '
'; $invoicestatic->id=$obj->rowid; $invoicestatic->ref=$obj->facnumber; print $invoicestatic->getNomUrl(1,'withdraw'); print ''; - $thirdpartystatic->id=$obj->socid; - $thirdpartystatic->name=$obj->name; - print $thirdpartystatic->getNomUrl(1,'customer'); + $thirdpartystatic->fetch($obj->socid); + print $thirdpartystatic->getNomUrl(1,'card'); print ''; + print $thirdpartystatic->display_rib(); + print ''; print price($obj->total_ttc,0,$langs,0,0,-1,$conf->currency); print '
'.$langs->trans("None").'
'.$langs->trans("None").'
"; print "
\n"; } diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 37b6c708b96..0e9174ef034 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -106,7 +106,6 @@ if ($prev_id) /* * Stats - * */ $ligne=new LignePrelevement($db,$user); @@ -121,6 +120,8 @@ if ($prev_id) $num = $db->num_rows($resql); $i = 0; + print_fiche_titre($langs->trans("StatisticsByLineStatus"),'',''); + print"\n\n"; print ''; print ''; diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index f1617979645..3e7cb5b6bd7 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -134,7 +134,7 @@ if ($id) print '
'; print ''; + print $bon->getNomUrl(1).''; print ''; print ''; print ''; diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php index 1e96e9276d8..c4724824f36 100644 --- a/htdocs/compta/prelevement/lignes.php +++ b/htdocs/compta/prelevement/lignes.php @@ -124,8 +124,6 @@ $pagenext = $page + 1; /* * Liste des lignes de prelevement - * - * */ $sql = "SELECT pl.rowid, pl.statut, pl.amount"; $sql.= ", s.rowid as socid, s.nom as name"; @@ -175,7 +173,11 @@ if ($result) print substr('000000'.$obj->rowid, -6); print ''; - print '\n"; + $thirdparty=new Societe($db); + $thirdparty->fetch($obj->socid); + print '\n"; print '\n"; diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 2c8607a9a56..c3667f8b69f 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -21,7 +21,7 @@ /** * \file htdocs/compta/prelevement/stats.php * \ingroup prelevement - * \brief Page de stats des prelevements + * \brief Page with statistics on withdrawals */ require('../../main.inc.php'); @@ -96,7 +96,7 @@ if ($resql) print ''; print ''; - $var=True; + $var=false; while ($i < $num) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 29664483d18..e0c1a9152e6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -444,7 +444,7 @@ Module55Desc=Barcode management Module56Name=Telephony Module56Desc=Telephony integration Module57Name=Standing orders -Module57Desc=Standing orders and withdrawal management +Module57Desc=Standing orders and withdrawal management. Also includes generation of SEPA file for european countries. Module58Name=ClickToDial Module58Desc=Integration of a ClickToDial system (Asterisk, ...) Module59Name=Bookmark4u diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index fd4305bbd0b..a0f8078fb18 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -79,10 +79,11 @@ CreditDate=Credit on WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported) ShowWithdraw=Show Withdraw IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one withdrawal payment not yet processed, it won't be set as paid to allow prior withdrawal management. -DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once it is complete, you can type the payment to close the invoice. +DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once donee, go into menu Bank->Withdrawal to manage the standing order. When standing order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null. WithdrawalFile=Withdrawal file SetToStatusSent=Set to status "File Sent" ThisWillAlsoAddPaymentOnInvoice=This will also apply payments to invoices and will classify them as "Paid" +StatisticsByLineStatus=Statistics by status of lines ### Notifications InfoCreditSubject=Payment of standing order %s by the bank diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 01d82ac0867..ab14d757f6f 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine * @@ -185,6 +185,7 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') } } + /* * View */ @@ -317,8 +318,13 @@ if ($socid && $action != 'edit' && $action != "create") print '
'.$langs->trans("RIBControlError").'
'; } - print "
"; + print "
"; + + /* + * List of bank accounts + */ + print_titre($langs->trans("AllRIB")); $rib_list = $soc->get_all_rib(); @@ -339,7 +345,7 @@ if ($socid && $action != 'edit' && $action != "create") foreach ($rib_list as $rib) { - print "
"; + print ""; // Label print ''; // Bank name @@ -382,7 +388,7 @@ if ($socid && $action != 'edit' && $action != "create") } if (count($rib_list) == 0) { - print ''; + print ''; } print '
'.$langs->trans("WithdrawalsReceipts").''; - print ''.$lipre->bon_ref.'
'.$langs->trans("Date").''.dol_print_date($bon->datec,'day').'
'.$langs->trans("Amount").''.price($lipre->amount).'
'.$langs->trans("Status").''.$lipre->LibStatut($lipre->statut,1).'
'.$obj->name."'; + print $thirdparty->getNomUrl(1); + print "'.price($obj->amount)."'.$langs->trans("Status").''.$langs->trans("Number").'%'.$langs->trans("Amount").'%
'.$rib->label.'
'.$langs->trans("NoBANRecord").'
'.$langs->trans("NoBANRecord").'
'; @@ -458,7 +464,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) if ($val == 'AccountNumber') { - print '
'.$langs->trans("BankAccountNumber").''.$langs->trans("BankAccountNumber").'
'.$langs->trans("IBAN").'
'.$langs->trans("IBAN").'
'.$langs->trans("BIC").'
'.$langs->trans("BIC").'
'.$langs->trans("BankAccountDomiciliation").''; From 6a70af2b67ab26b4baa538d9efd7269d72f522e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Dec 2014 14:03:10 +0100 Subject: [PATCH 05/18] Fixed: bug into produc batch management --- htdocs/core/modules/modProductBatch.class.php | 2 +- .../stock/class/mouvementstock.class.php | 41 ++++++++++++++----- htdocs/product/stock/product.php | 33 ++++++++------- 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index 6eb358aa99d..4dd7d0a81ae 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -49,7 +49,7 @@ class modProductBatch extends DolibarrModules $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Batch number, eat-by and sell-by date management module"; - $this->rights_class = 'stock'; + $this->rights_class = 'productbatch'; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 9e508f41461..24ca13da355 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -163,21 +163,40 @@ class MouvementStock extends CommonObject { $newpmp=0; $newpmpwarehouse=0; - // Note: PMP is calculated on stock input only (type = 0 or 3). If type == 0 or 3, qty should be > 0. + // Note: PMP is calculated on stock input only (type of movement = 0 or 3). If type == 0 or 3, qty should be > 0. // Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input) if (($type == 0 || $type == 3) && $price > 0) { + // If we will change PMP for the warehouse we edit and the product, we must first check/clean that PMP is defined + // on every stock entry with old value (so global updated value will match recalculated value from product_stock) + $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock SET pmp = ".($oldpmp?$oldpmp:'0'); + $sql.= " WHERE pmp = 0 AND fk_product = ".$fk_product; + dol_syslog(get_class($this)."::_create", LOG_DEBUG); + $resql=$this->db->query($sql); + if (! $resql) + { + $this->error=$this->db->lasterror(); + $error = -4; + } + $oldqtytouse=($oldqty >= 0?$oldqty:0); // We make a test on oldpmp>0 to avoid to use normal rule on old data with no pmp field defined if ($oldpmp > 0) $newpmp=price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU'); - else $newpmp=$price; - $oldqtywarehousetouse=($oldqtywarehouse >= 0?$oldqtywarehouse:0); + else + { + $newpmp=$price; // For this product, PMP was not yet set. We will set it later. + } + $oldqtywarehousetouse=$oldqtywarehouse; if ($oldpmpwarehouse > 0) $newpmpwarehouse=price2num((($oldqtywarehousetouse * $oldpmpwarehouse) + ($qty * $price)) / ($oldqtywarehousetouse + $qty), 'MU'); else $newpmpwarehouse=$price; - //print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." "; - //print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse; - //exit; + /*print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." "; + print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse; + exit;*/ + } + else if ($type == 1 || $type == 2) + { + // After a stock decrease, we don't change value of PMP for product. } else { @@ -207,14 +226,17 @@ class MouvementStock extends CommonObject { $this->error=$this->db->lasterror(); $error = -3; - } else if(empty($fk_product_stock)){ + } + else if(empty($fk_product_stock)) + { $fk_product_stock = $this->db->last_insert_id(MAIN_DB_PREFIX."product_stock"); } - } + } // Update detail stock for sell-by date - if (($product->hasbatch()) && (! $error) && (! $skip_sellby)){ + if (($product->hasbatch()) && (! $error) && (! $skip_sellby)) + { $param_batch=array('fk_product_stock' =>$fk_product_stock, 'eatby'=>$eatby,'sellby'=>$sellby,'batchnumber'=>$batch); $result=$this->_create_batch($param_batch, $qty); if ($result<0) $error++; @@ -245,7 +267,6 @@ class MouvementStock extends CommonObject if ($movestock && ! $error) { - $this->product_id = $fk_product; $this->entrepot_id = $entrepot_id; $this->qty = $qty; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f6dfe3150b1..e7be28b96bd 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -122,10 +122,11 @@ if ($action == "correct_stock" && ! $cancel) if (is_numeric(GETPOST("nbpiece")) && $id) { if (empty($product)) { - $product = new Product($db); - $result=$product->fetch($id); + $product = new Product($db); + $result=$product->fetch($id); } - if ($product->hasbatch()) { + if ($product->hasbatch()) + { $d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); $d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $result=$product->correct_stock_batch( @@ -139,15 +140,17 @@ if ($action == "correct_stock" && ! $cancel) $d_sellby, GETPOST('batch_number') ); // We do not change value of stock for a correction - } else { - $result=$product->correct_stock( - $user, - GETPOST("id_entrepot"), - GETPOST("nbpiece"), - GETPOST("mouvement"), - GETPOST("label"), - $priceunit - ); // We do not change value of stock for a correction + } + else + { + $result=$product->correct_stock( + $user, + GETPOST("id_entrepot"), + GETPOST("nbpiece"), + GETPOST("mouvement"), + GETPOST("label"), + $priceunit + ); // We do not change value of stock for a correction } if ($result > 0) @@ -645,8 +648,8 @@ if ($resql) print '
'.$langs->trans("Total").':'.$total.''; -print ($totalwithpmp?price($totalvalue/$totalwithpmp):' '); +print ($totalwithpmp?price(price2num(price2num($totalvalue,'MT')/$totalwithpmp,'MT')):' '); // This value may have rounding errors print ''; From 9be99b298783d796228f26cc29e670e91473d8c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Dec 2014 14:27:02 +0100 Subject: [PATCH 06/18] Fixed: We must use PMP of product. Not warehouse. --- htdocs/install/mysql/tables/llx_entrepot.sql | 2 +- .../mysql/tables/llx_product_stock.sql | 2 +- htdocs/product/stock/card.php | 16 +++++++------- htdocs/product/stock/list.php | 2 +- htdocs/product/stock/product.php | 21 ++++++++++--------- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_entrepot.sql b/htdocs/install/mysql/tables/llx_entrepot.sql index 1c49ac293f8..9e9bfc9c26f 100644 --- a/htdocs/install/mysql/tables/llx_entrepot.sql +++ b/htdocs/install/mysql/tables/llx_entrepot.sql @@ -33,7 +33,7 @@ create table llx_entrepot fk_departement integer, fk_pays integer DEFAULT 0, statut tinyint DEFAULT 1, -- 1 open, 0 close - valo_pmp float(12,4), -- valoristaion du stock en PMP + valo_pmp float(12,4), -- PMP value for this warehouse (deprecated. No sens for a warehouse) fk_user_author integer, import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_stock.sql b/htdocs/install/mysql/tables/llx_product_stock.sql index 5d550aadb6d..99d7d27fb77 100644 --- a/htdocs/install/mysql/tables/llx_product_stock.sql +++ b/htdocs/install/mysql/tables/llx_product_stock.sql @@ -25,7 +25,7 @@ create table llx_product_stock fk_product integer NOT NULL, fk_entrepot integer NOT NULL, reel real, -- physical stock - pmp double(24,8) default 0 NOT NULL, -- PMP value for product in this warehouse + pmp double(24,8) default 0 NOT NULL, -- PMP value for product in this warehouse (deprecated. no sens for warehouse) import_key varchar(14) -- Import key )ENGINE=innodb; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 2a7f64ee475..39b778536b5 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -73,13 +73,13 @@ if ($action == 'add' && $user->rights->stock->creer) $object->town = GETPOST("town"); $object->country_id = GETPOST("country_id"); - if (! empty($object->libelle)) + if (! empty($object->libelle)) { $id = $object->create($user); if ($id > 0) { setEventMessage($langs->trans("RecordSaved")); - + if (! empty($backtopage)) { header("Location: ".$backtopage); @@ -180,9 +180,9 @@ if ($action == 'create') print ''; print ''; print ''; - + dol_fiche_head(); - + print ''; // Ref @@ -225,7 +225,7 @@ if ($action == 'create') print '
'; dol_fiche_end(); - + print '
'; print ''; @@ -445,10 +445,10 @@ else $totalunit+=$objp->value; // Price buy PMP - print '
'.price(price2num($objp->pmp,'MU')).''.price(price2num($objp->ppmp,'MU')).''.price(price2num($objp->pmp*$objp->value,'MT')).''.price(price2num($objp->ppmp*$objp->value,'MT')).''.$entrepotstatic->getNomUrl(1).''.$obj->reel.($obj->reel<0?' '.img_warning():'').''.(price2num($obj->pmp)?price2num($obj->pmp,'MU'):'').''.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').''.(price2num($obj->pmp)?price(price2num($obj->pmp*$obj->reel,'MT')):'').''.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1); @@ -647,15 +647,15 @@ if ($resql) else print $langs->trans("Variable"); print '
'.$pdluo->batch.'
'.$langs->trans("Total").':'.$total.''; -print ($totalwithpmp?price(price2num(price2num($totalvalue,'MT')/$totalwithpmp,'MT')):' '); // This value may have rounding errors +print ($totalwithpmp?price(price2num($totalvalue/$totalwithpmp,'MU')):' '); // This value may have rounding errors print ''; -print price(price2num($totalvalue,'MT'),1); +print $totalvalue?price(price2num($totalvalue,'MT'),1):' '; print ''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print ($total?price($totalvaluesell/$total,1):' '); From 7834a9b0995e5920f67db8acc4dac982d49244c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Dec 2014 00:51:57 +0100 Subject: [PATCH 07/18] Add hidden constant to solve bug of too low size to see products label. --- htdocs/core/class/html.form.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 272798a6f65..771a79cd95b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1678,6 +1678,8 @@ class Form $outqty=1; $outdiscount=0; + $maxlengtharticle=(empty($conf->global->PRODUCT_MAX_LENGTH_COMBO)?48:$conf->global->PRODUCT_MAX_LENGTH_COMBO); + $label=$objp->label; if (! empty($objp->label_translated)) $label=$objp->label_translated; if (! empty($filterkey) && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','$1',$label,1); @@ -1697,11 +1699,11 @@ class Form else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"'; } $opt.= '>'; - $opt.= $objp->ref.' - '.dol_trunc($label,32).' - '; + $opt.= $objp->ref.' - '.dol_trunc($label,$maxlengtharticle).' - '; $objRef = $objp->ref; if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','$1',$objRef,1); - $outval.=$objRef.' - '.dol_trunc($label,32).' - '; + $outval.=$objRef.' - '.dol_trunc($label,$maxlengtharticle).' - '; $found=0; From cd6c72b14286d5c195f10626fb87e17d96ffa21a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Dec 2014 20:03:39 +0100 Subject: [PATCH 08/18] Fixed: Update of time consumed --- htdocs/projet/class/task.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3e6219afb40..5acdbbadddf 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -791,7 +791,7 @@ class Task extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; $sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'"; - $sql.= ", progress = " . $this->progress; + if (isset($this->progress)) $sql.= ", progress = " . $this->progress; // Do not overwrite value if not provided $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); @@ -803,7 +803,7 @@ class Task extends CommonObject } $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time"; - $sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; + $sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; // set average hour rate of user $sql.= " WHERE rowid = ".$tasktime_id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); From 99e5715f287f2702e4c8fdf30e77e80570e9107f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Dec 2014 20:09:48 +0100 Subject: [PATCH 09/18] Fixed: Length too small to see fullname. --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 15a5cf8b8ed..0b0c452020c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1795,7 +1795,7 @@ class User extends CommonObject $result.=($lien.img_object($langs->trans("ShowUser"),'user').$lienfin); if ($withpicto != 2) $result.=' '; } - $result.=$lien.$this->getFullName($langs,'','',16).$lienfin; + $result.=$lien.$this->getFullName($langs,'','',24).$lienfin; return $result; } From b681885542d778185fb356a908e59ca4df9220a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Dec 2014 21:14:59 +0100 Subject: [PATCH 10/18] Fixed: Bad url link --- htdocs/fourn/commande/orderstoinvoice.php | 140 +++++++++++----------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 6c5ce8aa11c..3397b18a30b 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -73,7 +73,7 @@ $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST[" if ($action == 'create') { if (is_array($selected) == false) { $mesgs = array ( - '
' . $langs->trans('Error_OrderNotChecked') . '
' + '
' . $langs->trans('Error_OrderNotChecked') . '
' ); } else { $origin = GETPOST('origin'); @@ -91,11 +91,11 @@ $hookmanager->initHooks(array('orderstoinvoicesupplier')); */ if (($action == 'create' || $action == 'add') && empty($mesgs)) { - + require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - + $langs->load('bills'); $langs->load('products'); $langs->load('main'); @@ -103,7 +103,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { $orders_id = $_GET['orders_to_invoice']; $n = count($orders_id); $i = 0; - + $originid = $orders_id[0]; $_GET['originid'] = $orders_id[0]; } @@ -111,30 +111,30 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { $orders_id = $_POST['orders_to_invoice']; $nn = count($orders_id); $ii = 0; - + $originid = $orders_id[0]; $_POST['originid'] = $orders_id[0]; } - + $projectid = GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0; $lineid = GETPOST('lineid', 'int'); $userid = GETPOST('userid', 'int'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref') : GETPOST('search_ref'); - + // Security check if ($user->societe_id) $socid = $user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); - + $usehm = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE; $object = new FactureFournisseur($db); - + // Insert new invoice in database if ($action == 'add' && $user->rights->fournisseur->facture->creer) { $object->socid = GETPOST('socid'); $db->begin(); $error = 0; - + // Standard or deposit or proforma invoice $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { @@ -154,17 +154,17 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { $projectid = GETPOST('projectid'); if ($projectid > 0) $object->fk_project = $projectid; - + // Auto calculation of date due if not filled by user if (empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement(); - + if ($_POST['origin'] && $_POST['originid']) { $object->origin = $_POST['origin']; $object->origin_id = $orders_id[$ii]; $object->linked_objects = $orders_id; $id = $object->create($user); - + if ($id > 0) { foreach ( $orders_id as $origin => $origin_id ) { $origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id); @@ -180,14 +180,14 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { $sql .= ", " . $id; $sql .= ", '" . $object->element . "'"; $sql .= ")"; - + if ($db->query($sql)) { $db->commit(); } else { $db->rollback(); } } - + while ( $ii < $nn ) { $objectsrc = new CommandeFournisseur($db); dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); @@ -202,10 +202,10 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { $num = count($lines); for($i = 0; $i < $num; $i ++) { $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); - + $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); - + // Dates // TODO mutualiser $date_start = $lines[$i]->date_debut_prevue; @@ -218,14 +218,14 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { $date_end = $lines[$i]->date_fin_reel; if ($lines[$i]->date_end) $date_end = $lines[$i]->date_end; - + // Reset fk_parent_line for no child products and special product if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, 'HT', $product_type); - + if ($result > 0) { $lineid = $result; } else { @@ -250,11 +250,11 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { } } } - + // End of object creation, we show it if ($id > 0 && ! $error) { $db->commit(); - header('Location: ' . DOL_URL_ROOT . '/fourn/facture/fiche.php?facid=' . $id); + header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id); exit(); } else { $db->rollback(); @@ -277,10 +277,10 @@ $companystatic = new Societe($db); // Mode creation if ($action == 'create' && empty($mesgs)) { - + llxHeader(); print_fiche_titre($langs->trans('NewBill')); - + $soc = new Societe($db); if ($socid) $res = $soc->fetch($socid); @@ -289,7 +289,7 @@ if ($action == 'create' && empty($mesgs)) { $mode_reglement_id = $soc->mode_reglement_id; } $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : ''; - + print '
'; print ''; print ''; @@ -300,21 +300,21 @@ if ($action == 'create' && empty($mesgs)) { print ''; print ''; print ''; - + // Ref print ''; - + // Ref supplier print ''; print ''; - + // Third party print ''; print '' . "\n"; - + // Date invoice print ''; } - + $objectsrc = new CommandeFournisseur($db); $listoforders = array (); foreach ( $selected as $sel ) { @@ -345,30 +345,30 @@ if ($action == 'create' && empty($mesgs)) { $listoforders[] = $objectsrc->ref; } } - + // Other attributes $parameters = array ( 'objectsrc' => $objectsrc, 'idsrc' => $listoforders, - 'colspan' => ' colspan="3"' + 'colspan' => ' colspan="3"' ); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - + // Modele PDF print ''; print '"; - + // Public note print ''; print ''; print ''; // Private note if (empty($user->societe_id)) { @@ -376,22 +376,22 @@ if ($action == 'create' && empty($mesgs)) { print ''; print ''; } - + print '
' . $langs->trans('Ref') . '' . $langs->trans('Draft') . '
' . $langs->trans('RefSupplier') . '
' . $langs->trans('Customer') . ''; print $soc->getNomUrl(1); print ''; print '
' . $langs->trans('Date') . ''; $html->select_date('', '', '', '', '', "add", 1, 1); @@ -330,13 +330,13 @@ if ($action == 'create' && empty($mesgs)) { // Project if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); - + $langs->load('projects'); print '
' . $langs->trans('Project') . ''; $formproject->select_projects($soc->id, $projectid, 'projectid'); print '
' . $langs->trans('Model') . ''; $liste = ModelePDFSuppliersInvoices::liste_modeles($db); print $html->selectarray('model', $liste, $conf->global->INVOICE_SUPPLIER_ADDON_PDF); print "
' . $langs->trans('NotePublic') . ''; print '
' . $langs->trans('NotePrivate') . ''; print '
'; - + while ( $i < $n ) { print ''; - + $i ++; } - + // Button "Create Draft" print '
'; print "
\n"; - + print '
\n"; } @@ -411,7 +411,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { }); entity; $sql .= ' AND c.fk_soc = s.rowid'; - + // Show orders with status validated, shipping started and delivered (well any order we can bill) $sql .= " AND c.fk_statut IN (5)"; - + // Find order that are not already invoiced $sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')"; - + if ($socid) $sql .= ' AND s.rowid = ' . $socid; if (! $user->rights->societe->client->voir && ! $socid) @@ -437,20 +437,20 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { if ($sall) { $sql .= " AND (c.ref LIKE '%" . $db->escape($sall) . "%' OR c.note LIKE '%" . $db->escape($sall) . "%')"; } - + // Date filter if ($date_start && $date_end) $sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "' AND c.date_commande <= '" . $db->idate($date_end) . "'"; if ($date_starty && $date_endy) $sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "' AND c.date_livraison <= '" . $db->idate($date_endy) . "'"; - + if (! empty($sref_client)) { $sql .= ' AND c.ref_supplier LIKE \'%' . $db->escape($sref_client) . '%\''; } $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder; dol_syslog('fourn/commande/ordertoinvoice.php sql=' . $sql); $resql = $db->query($sql); - + if ($resql) { if ($socid) { $soc = new Societe($db); @@ -463,14 +463,14 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { $i = 0; $period = $html->select_date($date_start, 'date_start', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_end, 'date_end', 0, 0, 1, '', 1, 0, 1); $periodely = $html->select_date($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0, 1); - + if (! empty($socid)) { // Company $companystatic->id = $socid; $companystatic->nom = $soc->nom; print '

' . $companystatic->getNomUrl(1, 'customer') . '

'; } - + print ''; print ''; print_liste_field_titre($langs->trans('Ref'), 'orderstoinvoice.php', 'c.ref', '', '&socid=' . $socid, '', $sortfield, $sortorder); @@ -480,7 +480,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { print_liste_field_titre($langs->trans('Status'), '', '', '', '', 'align="right"'); print_liste_field_titre($langs->trans('GenerateBill'), '', '', '', '', 'align="center"'); print ''; - + // Lignes des champs de filtre print ''; print ''; @@ -492,48 +492,48 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { // print ''; - + // DATE DELIVERY print ''; - + // SEARCH BUTTON print ''; - + print ''; print ''; - + print ''; $var = True; $generic_commande = new CommandeFournisseur($db); - + while ( $i < $num ) { $objp = $db->fetch_object($resql); $var = ! $var; print ''; print ''; - + print ''; - + // Order date print ''; - + // Delivery date print ''; - + // Statut print ''; - + // Checkbox print ''; - + print ''; - + $total = $total + $objp->price; $subtotal = $subtotal + $objp->price; $i ++; } print '
'; print ''; print ''; - + // DATE ORDER print ''; print $period; print ''; print $periodely; print ''; print ''; - + // ALL/NONE print ''; if ($conf->use_javascript_ajax) print '' . $langs->trans("All") . ' / ' . $langs->trans("None") . ''; print '
'; - + $generic_commande->id = $objp->rowid; $generic_commande->ref = $objp->ref; - + print ''; print ''; - + print '
'; print $generic_commande->getNomUrl(1, $objp->fk_statut); print ''; $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); @@ -541,35 +541,35 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); print '
'; print '
' . $objp->ref_supplier . ''; print dol_print_date($db->jdate($objp->date_commande), 'day'); print ''; print dol_print_date($db->jdate($objp->date_livraison), 'day'); print '' . $generic_commande->LibStatut($objp->fk_statut, 5) . ''; print ''; print '
'; - + /* * Boutons actions */ From 67cf3cb99b203c0e01444f6870f74e18418387a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Dec 2014 10:13:44 +0100 Subject: [PATCH 11/18] Fixed: BIC/SWIFT and IBAN must be at same level --- htdocs/core/lib/pdf.lib.php | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 15cb2f87b0b..bf2e5f2c218 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -492,7 +492,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) * @param int $curx X * @param int $cury Y * @param Account $account Bank account object - * @param int $onlynumber Output only number + * @param int $onlynumber Output only number (bank+desk+key+number according to country, but without name of bank and domiciliation) * @param int $default_font_size Default font size * @return float The Y PDF position */ @@ -513,10 +513,14 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $outputlangs->load("banks"); + // Use correct name of bank id according to country + $bickey="BICNumber"; + if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; + // Get format of bank account according to its country $usedetailedbban=$account->useDetailedBBAN(); - //$onlynumber=0; $usedetailedbban=0; // For tests + $onlynumber=0; $usedetailedbban=1; // For tests if ($usedetailedbban) { $savcurx=$curx; @@ -529,27 +533,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $cury+=3; } - // Use correct name of bank id according to country - $ibankey="IBANNumber"; - if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; - if (! empty($account->iban)) - { - $ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban); - $ibanDisplay = ""; - - for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++){ - $ibanDisplay .= $ibanDisplay_temp[$i]; - if($i%4 == 3 && $i > 0){ - $ibanDisplay .= " "; - } - } - - $pdf->SetFont('','B',$default_font_size - 3); - $pdf->SetXY($curx, $cury); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0); - $cury+=3; - } - if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+8); if ($usedetailedbban == 1) @@ -612,7 +595,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default } $curx=$savcurx; - $cury+=10; + $cury+=9; } else { @@ -629,10 +612,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default if ($diffsizecontent <= 2) $cury+=1; } - // Use correct name of bank id according to country - $bickey="BICNumber"; - if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; - $pdf->SetFont('','',$default_font_size - $diffsizecontent); if (empty($onlynumber) && ! empty($account->domiciliation)) @@ -647,8 +626,29 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default } else if (! $usedetailedbban) $cury+=1; + // Use correct name of bank id according to country + $ibankey="IBANNumber"; + if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; + if (! empty($account->iban)) + { + $ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban); + $ibanDisplay = ""; + + for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++) + { + $ibanDisplay .= $ibanDisplay_temp[$i]; + if($i%4 == 3 && $i > 0) $ibanDisplay .= " "; + } + + $pdf->SetFont('','B',$default_font_size - 3); + $pdf->SetXY($curx, $cury); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0); + $cury+=3; + } + if (! empty($account->bic)) { + $pdf->SetFont('','B',$default_font_size - 3); $pdf->SetXY($curx, $cury); $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0); } From a4e0de0d8a121d2005590c6517322035e0669644 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Dec 2014 13:12:05 +0100 Subject: [PATCH 12/18] Fixed: Contract must use serpis if no config set Fixed: Missing fetch_thirdparty. --- htdocs/contrat/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index dfdf0e95a87..8456b3e54b9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -538,7 +538,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer) } $ret = $object->fetch($id); // Reload to get new records - + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } @@ -847,7 +847,7 @@ $formfile = new FormFile($db); $objectlignestatic=new ContratLigne($db); // Load object modContract -$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive'); +$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_serpis'); if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module)-4); @@ -1043,6 +1043,8 @@ else if ($object->id > 0) { + $object->fetch_thirdparty(); + $result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed if ($result < 0) dol_print_error($db,$object->error); From c0473f0246b50b0661ee951ad922382c854e3af2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Dec 2014 13:13:11 +0100 Subject: [PATCH 13/18] Fixed: when transvers_mode is on, a user is not linked to a dedicated environment (always entity 1), so we should not show info not reliable with this mode. --- htdocs/user/index.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/htdocs/user/index.php b/htdocs/user/index.php index ac1ebc9e1c5..5d0b0ac77e4 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -114,6 +114,10 @@ if ($result) print_liste_field_titre($langs->trans("LastName"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_societe",$param,"","",$sortfield,$sortorder); + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) + { + print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder); + } print_liste_field_titre($langs->trans("DateCreation"),$_SERVER['PHP_SELF'],"u.datec",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u2.login",$param,"",'align="center"',$sortfield,$sortorder); @@ -165,9 +169,20 @@ if ($result) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } - // Multicompany enabled - else if (! empty($conf->multicompany->enabled)) + else if ($obj->ldap_sid) { + print $langs->trans("DomainUser"); + } + else + { + print $langs->trans("InternalUser"); + } + print ''; + + // Multicompany enabled + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) + { + print ''; if (! $obj->entity) { print $langs->trans("AllEntities"); @@ -181,16 +196,8 @@ if ($result) print $mc->label; } } + print ''; } - else if ($obj->ldap_sid) - { - print $langs->trans("DomainUser"); - } - else - { - print $langs->trans("InternalUser"); - } - print ''; // Date creation print ''.dol_print_date($db->jdate($obj->datec),"dayhour").''; From 036914756bf7ae0d1aebccd839b0ae4de4a19de0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Dec 2014 14:15:40 +0100 Subject: [PATCH 14/18] Fixed: option CONTRACT_SUPPORT_PRODUCTS not correctly supported --- htdocs/contrat/card.php | 13 +++++++++---- htdocs/langs/en_US/contracts.lang | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 8456b3e54b9..e4a8c644615 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2014 Juanjo Menent @@ -273,7 +273,7 @@ if ($action == 'add' && $user->rights->contrat->creer) { $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - if ($product_type == 1) { //only services // TODO Exclude also deee + if ($product_type == 1 || (! empty($conf->global->CONTRACT_SUPPORT_PRODUCTS) && in_array($product_type, array(0,1)))) { // TODO Exclude also deee // service prédéfini if ($lines[$i]->fk_product > 0) { @@ -1020,13 +1020,18 @@ if ($action == 'create') print "\n"; + print '
'; + if (is_object($objectsrc)) { print ''; print ''; - } - print '
'; + if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) + { + print '
'.$langs->trans("Note").': '.$langs->trans("OnlyLinesWithTypeServiceAreUsed"); + } + } print "\n"; diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index 06c05e520fa..57ba3bb15d8 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -91,6 +91,7 @@ ListOfServicesToExpire=List of Services to expire NoteListOfYourExpiredServices=This list contains only services of contracts for third parties you are linked to as a sale representative. StandardContractsTemplate=Standard contracts template ContactNameAndSignature=For %s, name and signature: +OnlyLinesWithTypeServiceAreUsed=Only lines with type "Service" will be cloned. ##### Types de contacts ##### TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract From 03cfff66ea518cf26c64bd82382ed7df942d645c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Dec 2014 14:26:34 +0100 Subject: [PATCH 15/18] Fixed: no form into table --- htdocs/admin/contract.php | 55 ++++++++++++++------------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 2abb2b5acad..6905156990b 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -182,30 +182,15 @@ else if ($action == 'setmod') dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'set_CONTRACT_FREE_TEXT') +else if ($action == 'set_other') { $freetext= GETPOST('CONTRACT_FREE_TEXT','alpha'); - $res = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessage($langs->trans("SetupSaved")); - } - else - { - setEventMessage($langs->trans("Error"),'errors'); - } -} - -else if ($action == 'set_CONTRACT_DRAFT_WATERMARK') -{ $draft= GETPOST('CONTRACT_DRAFT_WATERMARK','alpha'); + $res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; + if (! $res1 > 0 || ! $res2 > 0) $error++; if (! $error) { @@ -217,6 +202,7 @@ else if ($action == 'set_CONTRACT_DRAFT_WATERMARK') } } + /* * View */ @@ -506,44 +492,43 @@ print "
"; * */ +print '
'; +print ''; +print ''; + print_titre($langs->trans("OtherOptions")); print ''; print ''; print ''; print ''; -print "\n"; print "\n"; $var=true; $var=! $var; -print ''; -print ''; -print ''; print '\n"; +print ''."\n"; print ''; //Use draft Watermark $var=!$var; -print ""; -print ''; -print ""; print '\n"; -print ''; +print ''."\n"; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; print $langs->trans("FreeLegalTextOnContracts").' ('.$langs->trans("AddCRIfTooLong").')
'; print ''; -print '
'; -print ''; -print "
'; print $langs->trans("WatermarkOnDraftContractCards").'
'; print ''; -print '
'; -print ''; -print "
'; -print '
'; +print '
'; +print ''; +print '
'; + +print ''; + +dol_fiche_end(); -$db->close(); llxFooter(); + +$db->close(); From c994fbe44dac72910267345b5f92e5e3d8bda39d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Dec 2014 14:31:47 +0100 Subject: [PATCH 16/18] Fixed: Bad style --- htdocs/core/class/html.formfile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cf06894dde5..1ef5045c845 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -855,7 +855,7 @@ class FormFile } if ($nboffiles == 0) { - print ''; + print ''; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print ''; @@ -1043,7 +1043,7 @@ class FormFile if (count($filearray) == 0) { - print ''; + print ''; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print ''; @@ -1210,7 +1210,7 @@ class FormFile } if ($nboflinks == 0) { - print ''; + print ''; print $langs->trans("NoLinkFound"); print ''; } From 627e344c78f325cec1c15f4ad4787a2b91f54b0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Dec 2014 14:43:14 +0100 Subject: [PATCH 17/18] Documentation of external link. --- htdocs/admin/modules.php | 7 +++++++ htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 8 insertions(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 9ce93a6bc26..df9632761dd 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -525,6 +525,13 @@ else print ''.$url.''; print ''; + $var=!$var; + print "\n"; + $url='http://partners.dolibarr.org'; + print ''; + print ''.$langs->trans("DoliPartnersDesc").''; + print ''.$url.''; + print ''; print "\n"; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e0c1a9152e6..f0dd8219f06 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -208,6 +208,7 @@ ModulesJobDesc=Business modules provide simple predefined setup of Dolibarr for ModulesMarketPlaceDesc=You can find more modules to download on external web sites on the Internet... ModulesMarketPlaces=More modules... DoliStoreDesc=DoliStore, the official market place for Dolibarr ERP/CRM external modules +DoliPartnersDesc=List with some companies that can provide/develop on-demand modules or features (Note: any Open Source company knowning PHP language can provide you specific development) WebSiteDesc=Web site providers you can search to find more modules... URL=Link BoxesAvailable=Boxes available From 3ee2ced22abeb5993149e95f89d6c23203bc59c0 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 13 Dec 2014 01:28:23 +0100 Subject: [PATCH 18/18] Trad: Update es_ES from transifex --- htdocs/langs/es_ES/admin.lang | 7 ++++--- htdocs/langs/es_ES/printipp.lang | 5 +++++ htdocs/langs/es_ES/productbatch.lang | 3 ++- htdocs/langs/es_ES/projects.lang | 2 ++ htdocs/langs/es_ES/resource.lang | 2 -- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 2deac3d4278..a5e4ab1fdfa 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -475,8 +475,8 @@ Module320Name=Hilos RSS Module320Desc=Adición de hilos de información RSS en las pantallas Dolibarr Module330Name=Marcadores Module330Desc=Gestión de marcadores -Module400Name=Proyectos/Oportunidades -Module400Desc=Gestión de proyectos o oportunidades. Puede asignar otros elementos (facturas, pedidos, presupuestos, intervenciones, etc.) a los proyectos +Module400Name=Proyectos/Oportunidades/Leads +Module400Desc=Gestión de proyectos, oportunidades o leads, Puede asignar cualquier elemento (factura, pedido, presupuesto, intervención, etc.) a un proyecto y obtener una vista transversal del proyecto Module410Name=Webcalendar Module410Desc=Interfaz con el calendario Webcalendar Module500Name=Gastos especiales (impuestos, gastos sociales, dividendos) @@ -531,7 +531,7 @@ Module50200Desc=Módulo para proporcionar un pago en línea con tarjeta de créd Module50400Name=Contabilidad (avanzada) Module50400Desc=Gestión contable (doble partida) Module54000Name=PrintIPP -Module54000Desc=Imprimir vía impresora Cups IPP. +Module54000Desc=La impresión directa (sin abrir los documentos) usa el interfaz Cups IPP (La impresora debe ser visible por el servidor y CUPS debe estar instalado en el servidor) Module55000Name=OpenSurvey Module55000Desc=Módulo para realizar encuestas online (Como Doodle, Studs, Rdvz, etc.) Module59000Name=Márgenes @@ -783,6 +783,7 @@ DictionaryOrderMethods=Métodos de pedido DictionarySource=Orígenes de presupuestos/pedidos DictionaryAccountancyplan=Plan contable DictionaryAccountancysystem=Modelos de planes contables +DictionaryEMailTemplates=Plantillas E-Mails SetupSaved=Configuración guardada BackToModuleList=Volver a la lista de módulos BackToDictionaryList=Volver a la lista de diccionarios diff --git a/htdocs/langs/es_ES/printipp.lang b/htdocs/langs/es_ES/printipp.lang index b1831a86789..e97bd15c596 100644 --- a/htdocs/langs/es_ES/printipp.lang +++ b/htdocs/langs/es_ES/printipp.lang @@ -7,3 +7,8 @@ PRINTIPP_PORT=Puerto PRINTIPP_USER=Usuario PRINTIPP_PASSWORD=Contraseña NoPrinterFound=No se han encontrado impresoras (Compruebe la configuración de su CUPS) +FileWasSentToPrinter=El archivo %s ha sido enviado a la impresora +NoDefaultPrinterDefined=No hay impresora por defecto definida +DefaultPrinter=Impresora por defecto +Printer=Impresora +CupsServer=Servidor CUPS diff --git a/htdocs/langs/es_ES/productbatch.lang b/htdocs/langs/es_ES/productbatch.lang index dd61a420dbc..ceb6bd361e3 100644 --- a/htdocs/langs/es_ES/productbatch.lang +++ b/htdocs/langs/es_ES/productbatch.lang @@ -10,10 +10,11 @@ batch_number=Número Lote/Serie l_eatby=Fecha de caducidad l_sellby=Fecha límite de venta DetailBatchNumber=Detalles del lote/serie -DetailBatchFormat=Caducidad: %s Límite venta: %s LOTE: %s (Stock : %d) +DetailBatchFormat=Lote/Serie: %s - Caducidad: %s - Límite venta: %s (Stock: %d) printBatch=Lote: %s printEatby=Caducidad: %s printSellby=Límite venta: %s printQty=Cant.: %d AddDispatchBatchLine=Añada una línea para despacho por caducidad BatchDefaultNumber=Indefinido +WhenProductBatchModuleOnOptionAreForced=Si el módulo de Lotes/Series está activado, el incremento/decremento de stock es forzado a lo último escogido y no puede editarse. Otras opciones pueden definirse si se necesita diff --git a/htdocs/langs/es_ES/projects.lang b/htdocs/langs/es_ES/projects.lang index da5a65ceb96..5ac8e82d6f9 100644 --- a/htdocs/langs/es_ES/projects.lang +++ b/htdocs/langs/es_ES/projects.lang @@ -36,6 +36,8 @@ TaskTimeSpent=Tiempo dedicado en tareas TaskTimeUser=Usuario TaskTimeNote=Nota TaskTimeDate=Fecha +TasksOnOpenedProject=Tareas en proyectos abiertos +WorkloadNotDefined=Carga de trabajo no definida NewTimeSpent=Nuevo tiempo dedicado MyTimeSpent=Mi tiempo dedicado MyTasks=Mis tareas diff --git a/htdocs/langs/es_ES/resource.lang b/htdocs/langs/es_ES/resource.lang index 5bc252fbce3..21c3311d29a 100644 --- a/htdocs/langs/es_ES/resource.lang +++ b/htdocs/langs/es_ES/resource.lang @@ -31,6 +31,4 @@ ConfirmDeleteResource=¿Está seguro de querer eliminar este recurso? RessourceSuccessfullyDeleted=Recurso eliminado correctamente DictionaryResourceType=Tipo de recursos -DictionaryEMailTemplates=Modelo de E-Mails - SelectResource=Seleccionar recurso