diff --git a/ChangeLog b/ChangeLog index 715fdbac204..6598ca3d17d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -123,6 +123,8 @@ 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. +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/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index e98c16e520e..e579bc21640 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/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 18b765390e0..6567204232a 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; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c12f7343986..91544d83485 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2560,7 +2560,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; } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index d530c2ac5cc..4ebf543b7b1 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/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 ff39c9b705c..61ab48e636b 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"); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index ab892617a00..97b489cc3e4 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 721689bf5b0..c652c591ff7 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 a318608addf..b35f89dd1a7 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/fiche.php b/htdocs/projet/fiche.php index dbe55558f2c..d1fbf0d10ee 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -544,7 +544,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); @@ -615,7 +615,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 ''; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 06ff6867d79..77767fd446f 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 ''; @@ -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/liste.php b/htdocs/projet/liste.php index 35df2b981b5..39fcdb64a01 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 e030833c052..710d4b9f50d 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -104,7 +104,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 7e8f48e1adb..fc02da1c821 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 ''; @@ -369,7 +369,7 @@ else } else { - print ''.$langs->trans('AddTask').''; + print ''.$langs->trans('AddTask').''; } print ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index d65b54a2f7c..a86dd329e4c 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) @@ -185,7 +187,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 +249,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 ' '; @@ -281,7 +283,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 ' '; @@ -365,7 +367,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 7c5df98168c..29aca5f23f7 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 a9836894da9..f0f72810e8a 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 { @@ -131,7 +133,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 ''; @@ -183,7 +185,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 af56faa9329..62dfb3cbe68 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -198,6 +198,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)) @@ -226,7 +228,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 ''; @@ -266,7 +268,7 @@ if ($id > 0 || ! empty($ref)) } else { - print ''.$langs->trans('AddTask').''; + print ''.$langs->trans('AddTask').''; } print ''; @@ -309,7 +311,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 ''; @@ -403,7 +405,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 9078b95bede..4d70ddae36b 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) @@ -217,7 +219,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 +283,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/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 78b4d46071d..87b11b13a37 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 66b434ce6b7..339d8e50ede 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"; 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"; }