From 70cccc907a70be1f74142a374d704100a0cd7a5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 May 2014 15:30:31 +0200 Subject: [PATCH 1/9] Fix: Check env before test to be sure module ecotax is not enabled (this change result). --- test/phpunit/FactureTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 1215dfba191..36e499bb613 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -76,7 +76,10 @@ class FactureTest extends PHPUnit_Framework_TestCase public static function setUpBeforeClass() { global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + if (! empty($conf->ecotaxdeee->enabled)) { print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(); } + + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. print __METHOD__."\n"; } From 1b25fdc3237c228b53a5d20ed3a60c93ac549159 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 May 2014 18:09:39 +0200 Subject: [PATCH 2/9] Fix: Param at wrong place. Fix: Add warning if phpunit are runned with external module on. --- .../invoices/email_unpaid_invoices_to_representatives.php | 2 +- test/phpunit/AllTests.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index e83dbe5b795..c0e04c0efef 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -226,7 +226,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta $allmessage.= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices").($usehtml?"
\n":"\n"); } $allmessage.= $message.($usehtml?"
\n":"\n"); - $allmessage.= $langs->trans("Total")." = ".price($total,0,0,-1,$conf->currency).($usehtml?"
\n":"\n"); + $allmessage.= $langs->trans("Total")." = ".price($total,0,$newlangs,0,0,-1,$conf->currency).($usehtml?"
\n":"\n"); if (! empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) { $allmessage.=$conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER; diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index f9bae36a568..0b7b09d199e 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -36,7 +36,10 @@ if ($langs->defaultlang != 'en_US') print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; exit; } - +if (! empty($conf->google->enabled)) +{ + print "Warning: Google module should not be enabled.\n"; +} if (empty($user->id)) { print "Load permissions for admin user nb 1\n"; From c0af0c3b524f34691b0775accba1ba9f2d82f993 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 May 2014 20:29:16 +0200 Subject: [PATCH 3/9] Fix: translation --- htdocs/projet/fiche.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 0e5b2cc26a7..d5001540a6b 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -536,7 +536,7 @@ else print ''; // Customer - print ''.$langs->trans("Thirdparty").''; + print ''.$langs->trans("ThirdParty").''; $text=$form->select_company($object->societe->id,'socid','',1,1); $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); @@ -607,7 +607,7 @@ else print ''.$langs->trans("Label").''.$object->title.''; // Third party - print ''.$langs->trans("Thirdparty").''; + print ''.$langs->trans("ThirdParty").''; if ($object->societe->id > 0) print $object->societe->getNomUrl(1); else print' '; print ''; From 02e0fac79f10475d4ec4482cbe296a151f3fe176 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 9 May 2014 13:28:29 +0200 Subject: [PATCH 4/9] "or" into if instead of || --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c3889a41456..4238cd7edcb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2547,7 +2547,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($picto == 'setup') $picto='title.png'; if (!empty($conf->browser->ie) && $picto=='title.png') $picto='title.gif'; - if ($num > $conf->liste_limit or $num == -1) + if (($num > $conf->liste_limit) || ($num == -1)) { $nextpage = 1; } From 62537cf5a4b37041e11239b692e0a112ccf357ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 May 2014 13:39:10 +0200 Subject: [PATCH 5/9] Fix: translation --- htdocs/projet/contact.php | 4 ++-- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/liste.php | 2 +- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/contact.php | 8 ++++---- htdocs/projet/tasks/document.php | 4 ++-- htdocs/projet/tasks/note.php | 4 ++-- htdocs/projet/tasks/task.php | 6 +++--- htdocs/projet/tasks/time.php | 4 ++-- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 0674bcaf24b..3e44f9a0ed9 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -177,7 +177,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$object->title.''; // Customer - print "".$langs->trans("Company").""; + print "".$langs->trans("ThirdParty").""; print ''; if ($object->societe->id > 0) print $object->societe->getNomUrl(1); else print ' '; @@ -202,7 +202,7 @@ if ($id > 0 || ! empty($ref)) { $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); if ($res) break; - } + } } else { diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 8d545bf1e6a..951123ce88e 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -123,7 +123,7 @@ if ($object->id > 0) print ''.$langs->trans("Label").''.$object->title.''; // Company - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); else print ' '; print ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 4266d0f745e..e256fb45baa 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -114,7 +114,7 @@ print ''; print ''.$langs->trans("Label").''.$project->title.''; -print ''.$langs->trans("Company").''; +print ''.$langs->trans("ThirdParty").''; if (! empty($project->societe->id)) print $project->societe->getNomUrl(1); else print ' '; print ''; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 50a5022a2f0..beed3f05ae8 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -122,7 +122,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$object->title.''; - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); else print ' '; print ''; diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index 974f7f5ef00..8a53c6dcea8 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -126,7 +126,7 @@ if ($resql) print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"","",'align="right"',$sortfield,$sortorder); print "\n"; diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index dddab2a5e79..fdaeda490db 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -115,7 +115,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$object->title.''; // Third party - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if ($object->societe->id > 0) print $object->societe->getNomUrl(1); else print' '; print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 5319781fdb7..3f9b9b463c5 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -215,7 +215,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$object->title.''; - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); else print ' '; print ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index f9fb74ad6b4..bac9f0fa999 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -185,7 +185,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$projectstatic->title.''; - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; @@ -247,7 +247,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Customer - print "".$langs->trans("Company").""; + print "".$langs->trans("ThirdParty").""; print ''; if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1); else print ' '; @@ -271,7 +271,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''.$langs->trans("Source").''; - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; print ''.$langs->trans("ProjectContact").''; print ''.$langs->trans("ContactType").''; print ' '; @@ -353,7 +353,7 @@ if ($id > 0 || ! empty($ref)) // Liste des contacts lies print ''; print ''.$langs->trans("Source").''; - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; print ''.$langs->trans("ProjectContact").''; print ''.$langs->trans("ContactType").''; print ''.$langs->trans("Status").''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 0b876d0490a..51d9a48d595 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -151,7 +151,7 @@ if ($object->id > 0) print ''.$langs->trans("Label").''.$projectstatic->title.''; - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; @@ -214,7 +214,7 @@ if ($object->id > 0) print ''; // Third party - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 1b6bebeb9d5..46802c7be27 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -142,7 +142,7 @@ if ($object->id > 0) print ''.$langs->trans("Label").''.$projectstatic->title.''; // Company - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; @@ -194,7 +194,7 @@ if ($object->id > 0) print ''; // Third party - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1); else print' '; print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index a338e36b119..9274dcc65f4 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -227,7 +227,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$projectstatic->title.''; - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; @@ -310,7 +310,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Third party - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; @@ -404,7 +404,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Third party - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 304781e8309..a9c5bcba545 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -217,7 +217,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$projectstatic->title.''; // Thirdparty - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; @@ -281,7 +281,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Third party - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); else print ' '; print ''; From a627dd9ae804daaf593107175ee601b315866250 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 May 2014 17:14:40 +0200 Subject: [PATCH 6/9] Fix: Duplicate line when project has no tasks. --- htdocs/core/class/html.formother.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 472a1c19668..7f30f7c9c96 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -479,11 +479,11 @@ class FormOther $numlines=count($lines); for ($i = 0 ; $i < $numlines ; $i++) { - if ($lines[$i]->fk_parent == $parent) + if ($lines[$i]->fk_parent == $parent) { $var = !$var; - //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); + //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines // Break on a new project if ($parent == 0) // We are on a task at first level @@ -514,7 +514,7 @@ class FormOther $newdisablechildoftaskid=$disablechildoftaskid; // Print task - if ($lines[$i]->id >= 0) + if (isset($lines[$i]->id)) // We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0 { // Check if we must disable entry $disabled=0; From 4e41b721fb63ab5a79fc9e040c48a8d3eaf4d37a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 May 2014 16:43:47 +0200 Subject: [PATCH 7/9] Fix: Nb of notes and doc not visible onto tasks. --- ChangeLog | 1 + htdocs/core/lib/project.lib.php | 28 +++++++++++++++++----------- htdocs/projet/tasks/contact.php | 2 ++ htdocs/projet/tasks/note.php | 2 ++ htdocs/projet/tasks/task.php | 2 ++ htdocs/projet/tasks/time.php | 2 ++ 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 189dd345490..720c4680f2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ Fix: [ bug #1353 ] Email notifications, wrong URL. Fix: [ bug #1362 ] Note is not saved. Fix: tr/td balance. Fix: [ bug #1360 ] note indicator for member tab. +Fix: Nb of notes and doc not visible onto tasks. ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 3f22eb93187..c4cdcba3fff 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -142,18 +142,24 @@ function task_prepare_head($object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'task'); - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');; - /*$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $listoffiles=dol_dir_list($filesdir,'files',1); - $head[$h][1] = (count($listoffiles)?$langs->trans('DocumentsNb',count($listoffiles)):$langs->trans('Documents'));*/ - $head[$h][1] = $langs->trans('Documents'); - $head[$h][2] = 'task_document'; - $h++; + if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $nbNote = 0; + if(!empty($object->note_private)) $nbNote++; + if(!empty($object->note_public)) $nbNote++; + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');; + $head[$h][1] = $langs->trans('Notes'); + if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + $head[$h][2] = 'task_notes'; + $h++; + } - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');; - $head[$h][1] = $langs->trans('Notes'); - $head[$h][2] = 'task_notes'; + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');; + $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $listoffiles=dol_dir_list($filesdir,'files',1,'','thumbs'); + $head[$h][1] = (count($listoffiles)?$langs->trans('DocumentsNb',count($listoffiles)):$langs->trans('Documents')); + $head[$h][2] = 'task_document'; $h++; complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove'); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index bac9f0fa999..5049262e498 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -157,6 +157,8 @@ if ($id > 0 || ! empty($ref)) $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + $object->project = dol_clone($projectstatic); + $userWrite = $projectstatic->restrictedProjectArea($user,'write'); if ($withproject) diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 46802c7be27..3266f292a0d 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -52,6 +52,8 @@ if ($id > 0 || ! empty($ref)) { $projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + + $object->project = dol_clone($projectstatic); } else { diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 9274dcc65f4..3d645d694bb 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -199,6 +199,8 @@ if ($id > 0 || ! empty($ref)) $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + $object->project = dol_clone($projectstatic); + $userWrite = $projectstatic->restrictedProjectArea($user,'write'); if (! empty($withproject)) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index a9c5bcba545..b9ebc7ae5de 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -187,6 +187,8 @@ if ($id > 0 || ! empty($ref)) $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + $object->project = dol_clone($projectstatic); + $userWrite = $projectstatic->restrictedProjectArea($user,'write'); if ($withproject) From 3fd7e18c080df2bb2c88e73f8a0e610e2673d7e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 May 2014 17:00:55 +0200 Subject: [PATCH 8/9] Fix: Bad translation into title of action buttons --- htdocs/compta/facture/prelevement.php | 7 ++++--- htdocs/projet/ganttview.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/task.php | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 48b08946469..f542fa9bbd9 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -428,7 +428,7 @@ if ($object->id > 0) /* * Withdrawal request - */ + */ $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; $sql .= " , pfd.date_traite as date_traite"; @@ -462,12 +462,13 @@ if ($object->id > 0) } else { - print ''.$langs->trans("MakeWithdrawRequest").''; + print ''.$langs->trans("MakeWithdrawRequest").''; } } else { - print ''.$langs->trans("MakeWithdrawRequest").''; + if ($num == 0) print ''.$langs->trans("MakeWithdrawRequest").''; + else print ''.$langs->trans("MakeWithdrawRequest").''; } print "
\n"; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index beed3f05ae8..36c991e6397 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -161,7 +161,7 @@ if ($user->rights->projet->all->creer || $user->rights->projet->creer) } else { - print ''.$langs->trans('AddTask').''; + print ''.$langs->trans('AddTask').''; } print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 3f9b9b463c5..67556847ce7 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -369,7 +369,7 @@ else } else { - print ''.$langs->trans('AddTask').''; + print ''.$langs->trans('AddTask').''; } print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 3d645d694bb..038c5e05b85 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -269,7 +269,7 @@ if ($id > 0 || ! empty($ref)) } else { - print ''.$langs->trans('AddTask').''; + print ''.$langs->trans('AddTask').''; } print ''; From 7bb24969d8f0530968bbaa6d423b4b5c093eaaf0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 May 2014 19:52:24 +0200 Subject: [PATCH 9/9] Fix: [ bug #1372 ] Margin calculation does not work in proposals --- ChangeLog | 1 + htdocs/core/tpl/freeproductline_create.tpl.php | 11 ++++++++--- htdocs/core/tpl/predefinedproductline_create.tpl.php | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 720c4680f2c..cc38390b9fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ Fix: [ bug #1362 ] Note is not saved. Fix: tr/td balance. Fix: [ bug #1360 ] note indicator for member tab. Fix: Nb of notes and doc not visible onto tasks. +Fix: [ bug #1372 ] Margin calculation does not work in proposals ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index 41eccdddda9..a4c4b733fed 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -252,8 +252,10 @@ if (! empty($usemargins) && $user->rights->margins->creer) var remise = $("input[name='remise_percent']:first"); var rate = $("input[name='"+npRate+"']:first"); + if (rate.val() == '') return true; + if (! $.isNumeric(rate.val().replace(',','.'))) { alert('trans("rateMustBeNumeric")); ?>'); @@ -274,12 +276,13 @@ if (! empty($usemargins) && $user->rights->margins->creer) if (remisejs != 100) { + if (remisejs == '') remisejs=0; + bpjs=price2numjs(buying_price.val()); ratejs=price2numjs(rate.val()); - - if (npRate == "marginRate") + if (npRate == "np_marginRate") price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); - else if (npRate == "markRate") + else if (npRate == "np_markRate") price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); } $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value @@ -291,6 +294,8 @@ if (! empty($usemargins) && $user->rights->margins->creer) /* Function similar to price2num in PHP */ function price2numjs(num) { + if (num == '') return ''; + transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal"); diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index acd06c807d3..68126cb1924 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -298,6 +298,8 @@ if (! empty($usemargins) && $user->rights->margins->creer) /* Function similar to price2num in PHP */ function price2numjs(num) { + if (num == '') return ''; + transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");