diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index eb21636126a9a21e07deb55f0885858295b29f66..15c810f46c59fa0f2ae8394f9ed8c2e3ff2eb0c2 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -146,6 +146,10 @@ if ($action == 'setModuleOptions') else if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); + if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF)) + { + dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value,'chaine',0,'',$conf->entity); + } } else if ($action == 'del') diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 37a0f944bb3257ef4b8bc2da115929718def4596..b8920bb45a407b28aee7f69cdbe0c380a96680c9 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * @@ -98,7 +98,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">'; // Statistics -print '<table class="noborder" width="100%">'; +print '<table class="noborder nohover" width="100%">'; print '<tr class="liste_titre">'; print '<td colspan="4">'.$langs->trans("Statistics").'</td>'; print "</tr>\n"; @@ -111,7 +111,7 @@ foreach ($listoftype as $code => $label) if ($conf->use_javascript_ajax) { - print '<tr><td align="center" colspan="4">'; + print '<tr '.$bc[false].'><td align="center" colspan="4">'; $data=array('series'=>$dataseries); dol_print_graph('stats',300,180,$data,1,'pie',1); print '</td></tr>'; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 641ceb43e8f5cf9a5f73bb7c63ba3fd6d82f5190..eefeec44b2f830f5fec696d373b70a67080e69cb 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport // Total with all taxes $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($this->postotalttc-2, $curY); + $pdf->SetXY($this->postotalttc-1, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R'); $nexY+=5; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 0b688790af763a37826e737f111c791d449aa626..5dbd4635d12aba1b64b673598ba9056d2401bede 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -46,6 +46,7 @@ $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth'), GETPOST('date_debu $date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth'), GETPOST('date_finday'), GETPOST('date_finyear')); $date = dol_mktime(0, 0, 0, GETPOST('datemonth'), GETPOST('dateday'), GETPOST('dateyear')); $fk_projet=GETPOST('fk_projet'); +$vatrate=GETPOST('vatrate'); $ref=GETPOST("ref",'alpha'); // If socid provided by ajax company selector @@ -175,7 +176,7 @@ if ($action == 'update' && $user->rights->expensereport->creer) } } -if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) +if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) { $object = new ExpenseReport($db); $object->fetch($id); @@ -217,6 +218,8 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if ($emailTo && $emailFrom) { + $filename=array(); $filedir=array(); $mimetype=array(); + // SUBJECT $subject = $langs->trans("ExpenseReportWaitingForApproval"); @@ -231,7 +234,6 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if($resultPDF): // ATTACHMENT - $filename=array(); $filedir=array(); $mimetype=array(); array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref).".pdf"); array_push($mimetype,"application/pdf"); @@ -257,7 +259,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if ($mailfile->error) { $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); $mesg.='<br>'.$mailfile->error; setEventMessage($mesg,'errors'); } @@ -845,7 +847,7 @@ if ($action == "addline") $object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees'); $object_ligne->fk_c_tva = GETPOST('fk_c_tva'); - $object_ligne->vatrate = price2num(GETPOST('vatrate')); + $object_ligne->vatrate = price2num($vatrate); $object_ligne->fk_projet = $fk_projet; @@ -890,10 +892,10 @@ if ($action == "addline") { $object_ligne->fk_expensereport = $_POST['fk_expensereport']; - $type = 0; // TODO What if service + $type = 0; // TODO What if service ? $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type); - $object_ligne->vatrate = price2num(GETPOST('vatrate')); + $object_ligne->vatrate = price2num($vatrate); $object_ligne->total_ttc = $tmp[2]; $object_ligne->total_ht = $tmp[0]; $object_ligne->total_tva = $tmp[1]; @@ -1337,7 +1339,7 @@ else dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); if ($action == 'save'): - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1); if ($ret == 'html') print '<br>'; endif; @@ -1413,6 +1415,7 @@ else print '<td>'.$langs->trans("Statut").'</td>'; print '<td>'.$object->getLibStatut(4).'</td>'; print '</tr>'; + print '<tr>'; print '<td>'.$langs->trans("NotePublic").'</td>'; print '<td>'.$object->note_public.'</td>'; @@ -1451,20 +1454,6 @@ else print '<td>'.$langs->trans("DATE_SAVE").'</td>'; print '<td>'.dol_print_date($object->date_create,'dayhour').'</td></tr>'; print '</tr>'; - if($object->fk_statut==6) - { - print '<tr>'; - print '<td>'.$langs->trans("AUTHORPAIEMENT").'</td>'; - print '<td>'; - $userfee=new User($db); - $userfee->fetch($object->fk_user_paid); - print $userfee->getNomUrl(1); - print '</td></tr>'; - print '<tr>'; - print '<td>'.$langs->trans("DATE_PAIEMENT").'</td>'; - print '<td>'.$object->date_paiement.'</td></tr>'; - print '</tr>'; - } // User to inform if($object->fk_statut<3) // informed @@ -1536,6 +1525,22 @@ else print '</td>'; print '</tr>'; } + + if($object->fk_statut==6) + { + print '<tr>'; + print '<td>'.$langs->trans("AUTHORPAIEMENT").'</td>'; + print '<td>'; + $userfee=new User($db); + $userfee->fetch($object->fk_user_paid); + print $userfee->getNomUrl(1); + print '</td></tr>'; + print '<tr>'; + print '<td>'.$langs->trans("DATE_PAIEMENT").'</td>'; + print '<td>'.$object->date_paiement.'</td></tr>'; + print '</tr>'; + } + print '</table>'; print '<br>'; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 98a6aea00e7ebc268e59ecbc8764d73a8cbf9a0f..9be10765a0a278d1447f243d898bd939bdbebef4 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -110,7 +110,7 @@ class ExpenseReport extends CommonObject // List of language codes for status $this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); + $this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); $this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut8'); return 1; diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index 5b157f6df8bd3dc4c2e157ed40a7f26a4d99f170..e98921362ffd847487236987ea57feceba1148c8 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * @@ -70,13 +70,11 @@ $totalnb=$totalsum=0; $sql = "SELECT tf.code, tf.label, count(de.rowid) as nb, sum(de.total_ht) as km"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."expensereport_det as de, ".MAIN_DB_PREFIX."c_type_fees as tf"; $sql.= " WHERE de.fk_expensereport = d.rowid AND de.fk_c_type_fees = tf.id"; - // RESTRICT RIGHTS if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) { $sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n"; } - $sql.= " GROUP BY tf.code, tf.label"; $result = $db->query($sql); @@ -202,7 +200,7 @@ if ($result) } else { - print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>'; + print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>'; } print '</table><br>'; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 163267ff52fc8114dde3436ae4dedca758d75241..8fcf0a4eb08fa5ba14c4d70b12d8040aa43e1aa8 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -501,7 +501,7 @@ Module600Name=Notifications Module600Desc=Send EMail notifications on some Dolibarr business events to third-party contacts (setup defined on each thirdparty) Module700Name=Donations Module700Desc=Donation management -Module770Name=Expense Report +Module770Name=Expense reports Module770Desc=Management and claim expense reports (transportation, meal, ...) Module1120Name=Supplier commercial proposal Module1120Desc=Request supplier commercial proposal and prices diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 9a878366bc7117d6b3678825dadc612d06f4c5bd..8b935e8cc18ffefd0eada70d9ad92a994736b9cb 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -191,3 +191,4 @@ WarningNotRelevant=Irrelevant operation for this dataset WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s. WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters +WarningSomeLinesWithNullHourlyRate=Some times were recorded by users when their hourly rate was not defined. A value of 0 was used but this may result in wrong valuation of time spent. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ae766c7a14788a2571f84ea533a0f6a396e70fe0..d37f437364ea6f775b1940cb8129d439ead163ab 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -302,7 +302,7 @@ UnitPriceTTC=Unit price PriceU=U.P. PriceUHT=U.P. (net) AskPriceSupplierUHT=U.P. net Requested -PriceUTTC=U.P. +PriceUTTC=U.P. (inc. tax) Amount=Amount AmountInvoice=Invoice amount AmountPayment=Payment amount diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 25db18df4744e9d4b9929612671c881ffee3d53b..8b9291d950178b234dfe5cf813d28f196f1cd956 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -77,6 +77,7 @@ ListExpenseReportsAssociatedProject=List of expense reports associated with the ListDonationsAssociatedProject=List of donations associated with the project ListActionsAssociatedProject=List of events associated with the project ListTaskTimeUserProject=List of time consumed on tasks of project +TaskTimeUserProject=Time consumed on tasks of project ActivityOnProjectThisWeek=Activity on project this week ActivityOnProjectThisMonth=Activity on project this month ActivityOnProjectThisYear=Activity on project this year diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index d4e4e8c4359fb6978be31c36375d36e328e97fff..969ceaa01d6f2382b6efa1e408893dbc6b2d882b 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -76,6 +76,7 @@ BROUILLONNER=Reopen SendToValid=Sent on approval ModifyInfoGen=Edit ValidateAndSubmit=Validate and submit for approval +ValidatedWaitingApproval=Validated (waiting for approval) NOT_VALIDATOR=You are not allowed to approve this expense report NOT_AUTHOR=You are not the author of this expense report. Operation cancelled. diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3b2caf30ad7b4a3e0f1da87b003b9a03c1b9f080..bd20a930aa46a3a949174434707a8603526331ac 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -930,7 +930,7 @@ class Task extends CommonObject $result=array(); $sql = "SELECT"; - $sql.= " SUM(t.task_duration / 3600 * thm) as amount"; + $sql.= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as amount, SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " WHERE t.fk_task = ".$id; if (is_object($fuser) && $fuser->id > 0) @@ -947,7 +947,8 @@ class Task extends CommonObject $datefieldname="task_datehour"; $sql.=" AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; } - + //print $sql; + dol_syslog(get_class($this)."::getSumOfAmount", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -955,7 +956,8 @@ class Task extends CommonObject $obj = $this->db->fetch_object($resql); $result['amount'] = $obj->amount; - + $result['nblinesnull'] = $obj->nblinesnull; + $this->db->free($resql); return $result; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a9089673ae6b4a07492514ac5b38d812f7669311..c044d3093220b05ad72197189e1fdfc97467332c 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -463,7 +463,11 @@ foreach ($listofreferent as $key => $value) } else { - if ($element instanceof Task) print $element->getNomUrl(1,'withproject','time'); + if ($element instanceof Task) + { + print $element->getNomUrl(1,'withproject','time'); + print ' - '.dol_trunc($element->label, 48); + } else print $element->getNomUrl(1); $element_doc = $element->element; @@ -522,13 +526,19 @@ foreach ($listofreferent as $key => $value) print '</td>'; // Amount without tax + $warning=''; if (empty($value['disableamount'])) { if ($tablename == 'don') $total_ht_by_line=$element->amount; elseif ($tablename == 'projet_task') { - $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); + $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty $total_ht_by_line = price2num($tmp['amount'],'MT'); + if ($tmp['nblinesnull'] > 0) + { + $langs->load("errors"); + $warning=$langs->trans("WarningSomeLinesWithNullHourlyRate"); + } } else { @@ -538,6 +548,7 @@ foreach ($listofreferent as $key => $value) if (! $qualifiedfortotal) print '<strike>'; print (isset($total_ht_by_line)?price($total_ht_by_line):' '); if (! $qualifiedfortotal) print '</strike>'; + if ($warning) print ' '.img_warning($warning); print '</td>'; } else print '<td></td>'; @@ -559,13 +570,18 @@ foreach ($listofreferent as $key => $value) if (! $qualifiedfortotal) print '<strike>'; print (isset($total_ttc_by_line)?price($total_ttc_by_line):' '); if (! $qualifiedfortotal) print '</strike>'; + if ($warning) print ' '.img_warning($warning); print '</td>'; } else print '<td></td>'; // Status print '<td align="right">'; - if ($element instanceof CommonInvoice) + if ($tablename == 'expensereport_det') + { + print $expensereport->getLibStatut(5); + } + else if ($element instanceof CommonInvoice) { //This applies for Facture and FactureFournisseur print $element->getLibStatut(5, $element->getSommePaiement()); @@ -694,6 +710,7 @@ print '<td align="right" width="100">'.$langs->trans("AmountHT").'</td>'; print '<td align="right" width="100">'.$langs->trans("AmountTTC").'</td>'; print '</tr>'; +$var=true; foreach ($listofreferent as $key => $value) { $name=$langs->trans($value['name']); @@ -710,7 +727,6 @@ foreach ($listofreferent as $key => $value) $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); if (count($elementarray)>0 && is_array($elementarray)) { - $var=true; $total_ht = 0; $total_ttc = 0; @@ -793,11 +809,15 @@ foreach ($listofreferent as $key => $value) case 'Contrat': $newclassname = 'Contract'; break; + case 'Task': + $newclassname = 'TaskTimeUserProject'; + break; default: $newclassname = $classname; } - print '<tr>'; + $var = ! $var; + print '<tr '.$bc[$var].'>'; // Module print '<td align="left">'.$langs->trans($newclassname).'</td>'; // Nb