Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2017-01-03 01:34:46 +01:00
commit c27a1c1705
19 changed files with 245 additions and 62 deletions

109
ChangeLog
View File

@ -403,6 +403,115 @@ So if you included it into your module, change your code like this to be compati
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
***** ChangeLog for 3.9.4 compared to 3.9.3 *****
FIX: #2853
FIX: #3128
FIX: #4447
FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code
FIX: #5340
FIX: #5473
FIX: #5474 Country_id of "Don" object is still empty
FIX: #5534
FIX: #5535 bad dependency.
FIX: #5537 AJAX project search does not work properly
FIX: #5540 getFormMail is not registered as addReplace hook
FIX: #5544 Disabled Contact still appear in lists to send emails
FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them
FIX: #5568
FIX: #5594
FIX: #5629 PgSQL Interger string stylish error
FIX: #5651
FIX: #5660
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
FIX: #5907
FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
FIX: #6051
FIX: #6088
FIX: Can correct stock of lot using eatby or sell by date
FIX: Can make a movement on "out of sell" products
FIX: cannot update bank account on invoice if module order not activated
FIX: Can't create withdrawal document
FIX: delete contract extrafields on contract deletion
FIX: Direction of movement lost if an error occurs
FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
FIX: export extrafields must not include separe type
FIX: External user must not be able to edit its discounts
FIX: Failed to export contact categories with contact extra fields
FIX: header title in commercial area
FIX: HT and TTC price should always be displayed together
FIX: incoterms
FIX: incoterms do not output into crabe invoice PDF
FIX: in PgSQL no quote "word style" is permitted around column name
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
FIX: margin tab on customer card must filter on current entity invoices
FIX: missing column into SQL on thridparty list
FIX: only show projects of related third if external user
FIX: PgSQL Module Ressource list crash #5637
FIX: php Strict
FIX: Regression when deleting product
FIX: Security to restrict email sending was not efficient
FIX: tag for date rfc in odt substitution
FIX: Update intervention lline crash with PgSQL
FIX: update limit stock on product stock
FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15)
FIX: wrong test on dict.php
***** ChangeLog for 3.9.4 compared to 3.9.3 *****
FIX: #2853
FIX: #3128
FIX: #4447
FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code
FIX: #5340
FIX: #5473
FIX: #5474 Country_id of "Don" object is still empty
FIX: #5534
FIX: #5535 bad dependency.
FIX: #5537 AJAX project search does not work properly
FIX: #5540 getFormMail is not registered as addReplace hook
FIX: #5544 Disabled Contact still appear in lists to send emails
FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them
FIX: #5568
FIX: #5594
FIX: #5629 PgSQL Interger string stylish error
FIX: #5651
FIX: #5660
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
FIX: #5907
FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
FIX: #6051
FIX: #6088
FIX: Can correct stock of lot using eatby or sell by date
FIX: Can make a movement on "out of sell" products
FIX: cannot update bank account on invoice if module order not activated
FIX: Can't create withdrawal document
FIX: delete contract extrafields on contract deletion
FIX: Direction of movement lost if an error occurs
FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
FIX: export extrafields must not include separe type
FIX: External user must not be able to edit its discounts
FIX: Failed to export contact categories with contact extra fields
FIX: header title in commercial area
FIX: HT and TTC price should always be displayed together
FIX: incoterms
FIX: incoterms do not output into crabe invoice PDF
FIX: in PgSQL no quote "word style" is permitted around column name
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
FIX: margin tab on customer card must filter on current entity invoices
FIX: missing column into SQL on thridparty list
FIX: only show projects of related third if external user
FIX: PgSQL Module Ressource list crash #5637
FIX: php Strict
FIX: Regression when deleting product
FIX: Security to restrict email sending was not efficient
FIX: tag for date rfc in odt substitution
FIX: Update intervention lline crash with PgSQL
FIX: update limit stock on product stock
FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15)
FIX: wrong test on dict.php
***** ChangeLog for 3.9.3 compared to 3.9.2 *****
FIX: #4383 $userid not defined
FIX: #4448 $filebonprev is not used, $this->filename now

View File

@ -1061,7 +1061,8 @@ if ($resql)
$text_info='';
$text_warning='';
$nbprod=0;
// Ref
if (! empty($arrayfields['c.ref']['checked']))
{
print '<td class="nowrap">';
@ -1186,12 +1187,12 @@ if ($resql)
print '</td>';
}
// Warning late icon
// Warning late icon and note
print '<td class="nobordernopadding nowrap">';
if ($generic_commande->hasDelay()) {
print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
}
if(!empty($obj->note_private))
if (!empty($obj->note_private) || !empty($obj->note_public))
{
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/commande/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';

View File

@ -1345,8 +1345,16 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error ++;
}
if (! GETPOST('prod_entry_mode'))
{
if (GETPOST('type') < 0 && ! GETPOST('search_idprod'))
{
setEventMessages($langs->trans('ErrorChooseBetweenFreeAntryOrPredefinedProduct'), null, 'errors');
$error ++;
}
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''

View File

@ -30,14 +30,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$langs->load("companies");
if (! empty($conf->facture->enabled)) $langs->load("bills");
// Security check
$socid = GETPOST("socid",'int');
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
$id = GETPOST('id')?GETPOST('id','int'):GETPOST('socid','int');
// Security check
if ($user->societe_id) $id=$user->societe_id;
$result = restrictedArea($user, 'societe', $id, '&societe');
$object = new Societe($db);
if ($id > 0) $object->fetch($id);
/*
@ -47,20 +47,21 @@ if ($user->societe_id > 0)
$form = new Form($db);
$userstatic=new User($db);
llxHeader();
$title=$langs->trans("ThirdParty").' - '.$langs->trans("Summary");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary");
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
if ($socid > 0)
llxHeader('',$title,$help_url);
if ($id > 0)
{
$societe = new Societe($db);
$societe->fetch($socid);
/*
* Affichage onglets
*/
$head = societe_prepare_head($societe);
$head = societe_prepare_head($object);
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 1);
dol_fiche_end();
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
@ -86,7 +87,7 @@ if ($socid > 0)
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
$sql.= " u.login, u.rowid as userid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.fk_user_valid = u.rowid";
$sql.= " ORDER BY f.datef ASC";

View File

@ -965,7 +965,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
* @return mixed Return html part or void if noprint is 1
* TODO change function to be able to list event linked to an object.
*/
function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC')
{
global $bc,$user,$conf;
global $form;
@ -1183,7 +1183,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
}
$out.=getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder);
$out.='<td class="maxwidth100onsmartphone">'.$langs->trans("Label").'</td>';
$out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep, a.id', '', $param, '', $sortfield, $sortorder);
$out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, '', $sortfield, $sortorder);
$out.='<td>'.$langs->trans("Type").'</td>';
$out.='<td></td>';
$out.='<td></td>';

View File

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

View File

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

View File

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

View File

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

View File

@ -111,8 +111,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{
$this->posxtva=99;
$this->posxup=114;
$this->posxqty=133;
$this->posxunit=150;
$this->posxqty=130;
$this->posxunit=147;
} else {
$this->posxtva=112;
$this->posxup=126;

View File

@ -183,7 +183,7 @@ $min_year = 5;
$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
$sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,";
$sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,";
$sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.statut, u.photo";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
@ -524,17 +524,40 @@ if ($resql)
$expensereportstatic->date_modif=$db->jdate($obj->date_modif);
$expensereportstatic->date_valid=$db->jdate($obj->date_valid);
$expensereportstatic->date_approve=$db->jdate($obj->date_approve);
$expensereportstatic->note_private=$obj->note_private;
$expensereportstatic->note_public=$obj->note_public;
$var=!$var;
print "<tr ".$bc[$var].">";
// Ref
if (! empty($arrayfields['d.ref']['checked'])) {
print '<td>';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $expensereportstatic->getNomUrl(1);
print '</td>';
// Warning late icon and note
print '<td class="nobordernopadding nowrap">';
if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) print img_warning($langs->trans("Late"));
if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) print img_warning($langs->trans("Late"));
if (!empty($obj->note_private) || !empty($obj->note_public))
{
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/commande/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '</span>';
}
print '</td>';
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->expensereport->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
print '</td>';
print '</tr></table>';
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// User
if (! empty($arrayfields['user']['checked'])) {
print '<td align="left">';
$usertmp->id=$obj->id_user;
@ -547,18 +570,22 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Start date
if (! empty($arrayfields['d.date_debut']['checked'])) {
print '<td align="center">'.($obj->date_debut > 0 ? dol_print_date($obj->date_debut, 'day') : '').'</td>';
if (! $i) $totalarray['nbfield']++;
}
// End date
if (! empty($arrayfields['d.date_fin']['checked'])) {
print '<td align="center">'.($obj->date_fin > 0 ? dol_print_date($obj->date_fin, 'day') : '').'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date validation
if (! empty($arrayfields['d.date_valid']['checked'])) {
print '<td align="center">'.($obj->date_valid > 0 ? dol_print_date($obj->date_valid, 'day') : '').'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date approval
if (! empty($arrayfields['d.date_approve']['checked'])) {
print '<td align="center">'.($obj->date_approve > 0 ? dol_print_date($obj->date_approve, 'day') : '').'</td>';
if (! $i) $totalarray['nbfield']++;

View File

@ -21,7 +21,7 @@ create table llx_c_typent
(
id integer PRIMARY KEY,
code varchar(12) NOT NULL,
libelle varchar(30),
libelle varchar(48),
fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B)
active tinyint DEFAULT 1 NOT NULL,
module varchar(32) NULL,

View File

@ -170,11 +170,11 @@ ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship
ErrorFileMustHaveFormat=File must have format %s
ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled.
ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order.
ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice.
ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment.
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal.
ErrorFailedToLoadLoginFileForMode=Failed to get the login file for mode '%s'.
ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enough for product %s to add it into a new order.
ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enough for product %s to add it into a new invoice.
ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s to add it into a new shipment.
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal.
ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'.
ErrorModuleNotFound=File of module was not found.
ErrorFieldAccountNotDefinedForBankLine=Value for Accounting account not defined for source bank line %s
ErrorBankStatementNameMustFollowRegex=Error, bank statement name must follow the following syntax rule %s

View File

@ -35,7 +35,7 @@ MailingStatusSentPartialy=Sent partialy
MailingStatusSentCompletely=Sent completely
MailingStatusError=Error
MailingStatusNotSent=Not sent
MailSuccessfulySent=Email successfully sent (from %s to %s)
MailSuccessfulySent=Email successfully accepted for delivery (from %s to %s)
MailingSuccessfullyValidated=EMailing successfully validated
MailUnsubcribe=Unsubscribe
MailingStatusNotContact=Don't contact anymore

View File

@ -58,6 +58,7 @@ TaskDateEnd=Task end date
TaskDescription=Task description
NewTask=New task
AddTask=Create task
AddTimeSpent=Create time spent
Activity=Activity
Activities=Tasks/activities
MyActivities=My tasks/activities

View File

@ -1498,7 +1498,7 @@ class Project extends CommonObject
{
$sql="UPDATE ".MAIN_DB_PREFIX.$tableName;
if ($TableName=="actioncomm")
if ($tableName == "actioncomm")
{
$sql.= " SET fk_project=".$this->id;
$sql.= " WHERE id=".$elementSelectId;

View File

@ -1039,12 +1039,12 @@ class Task extends CommonObject
}
/**
* Calculate value of time consumed using the thm (hourly amount value of work for user entering time)
* Calculate quantity and value of time consumed using the thm (hourly amount value of work for user entering time)
*
* @param User $fuser Filter on a dedicated user
* @param string $dates Start date (ex 00:00:00)
* @param string $datee End date (ex 23:59:59)
* @return array Array of info for task array('amount')
* @return array Array of info for task array('amount','nbseconds','nblinesnull')
*/
function getSumOfAmount($fuser='', $dates='', $datee='')
{
@ -1055,6 +1055,7 @@ class Task extends CommonObject
$result=array();
$sql = "SELECT";
$sql.= " SUM(t.task_duration) as nbseconds,";
$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;
@ -1081,6 +1082,7 @@ class Task extends CommonObject
$obj = $this->db->fetch_object($resql);
$result['amount'] = $obj->amount;
$result['nbseconds'] = $obj->nbseconds;
$result['nblinesnull'] = $obj->nblinesnull;
$this->db->free($resql);

View File

@ -370,6 +370,19 @@ $listofreferent=array(
'buttonnew'=>'AddDonation',
'testnew'=>$user->rights->don->creer,
'test'=>$conf->don->enabled && $user->rights->don->lire),
'project_task'=>array(
'name'=>"TaskTimeValorised",
'title'=>"ListTaskTimeUserProject",
'class'=>'Task',
'margin'=>'minus',
'table'=>'projet_task',
'datefieldname'=>'task_date',
'disableamount'=>0,
'urlnew'=>DOL_URL_ROOT.'/projet/tasks.php?id='.$id,
'buttonnew'=>'AddTimeSpent',
'testnew'=>$user->rights->projet->creer,
'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))),
/* No need for this, available on dedicated tab "Agenda/Events"
'agenda'=>array(
'name'=>"Agenda",
'title'=>"ListActionsAssociatedProject",
@ -382,15 +395,7 @@ $listofreferent=array(
'buttonnew'=>'AddEvent',
'testnew'=>$user->rights->agenda->myactions->create,
'test'=>$conf->agenda->enabled && $user->rights->agenda->myactions->read),
'project_task'=>array(
'name'=>"TaskTimeValorised",
'title'=>"ListTaskTimeUserProject",
'class'=>'Task',
'margin'=>'minus',
'table'=>'projet_task',
'datefieldname'=>'task_date',
'disableamount'=>0,
'test'=>$conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS)),
*/
);
$parameters=array('listofreferent'=>$listofreferent);
@ -691,6 +696,7 @@ foreach ($listofreferent as $key => $value)
print '<td'.(($tablename != 'actioncomm' && $tablename != 'projet_task') ? ' style="width: 200px"':'').'>'.$langs->trans("Ref").'</td>';
// Date
print '<td'.(($tablename != 'actioncomm' && $tablename != 'projet_task') ? ' style="width: 200px"':'').' align="center">';
if (in_array($tablename, array('projet_task'))) print $langs->trans("TimeSpent");
if (! in_array($tablename, array('projet_task'))) print $langs->trans("Date");
print '</td>';
// Thirdparty or user
@ -784,9 +790,9 @@ foreach ($listofreferent as $key => $value)
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $projectid . '&action=unlink&tablename=' . $tablename . '&elementselect=' . $element->id . '">' . img_picto($langs->trans('Unlink'), 'editdelete') . '</a>';
}
print "</td>\n";
// Ref
print '<td align="left">';
if ($tablename == 'expensereport_det')
{
print $expensereport->getNomUrl(1);
@ -822,11 +828,10 @@ foreach ($listofreferent as $key => $value)
// Show customer ref
if (! empty($element->ref_customer)) print ' - '.$element->ref_customer;
}
print "</td>\n";
// Date
$date='';
// Date or TimeSpent
$date=''; $total_time_by_line = null;
if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines
elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status))
{
@ -851,6 +856,12 @@ foreach ($listofreferent as $key => $value)
print dol_print_date($element->datep,'dayhour');
if ($element->datef && $element->datef > $element->datep) print " - ".dol_print_date($element->datef,'dayhour');
}
else if (in_array($tablename, array('projet_task')))
{
$tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty
print convertSecondToTime($tmpprojtime['nbseconds'], 'allhourmin');
$total_time_by_line = $tmpprojtime['nbseconds'];
}
else print dol_print_date($date,'day');
print '</td>';
@ -885,14 +896,13 @@ foreach ($listofreferent as $key => $value)
$total_ht_by_line=null;
$othermessage='';
if ($tablename == 'don') $total_ht_by_line=$element->amount;
elseif ($tablename == 'projet_task')
elseif (in_array($tablename, array('projet_task')))
{
if (! empty($conf->salaries->enabled))
{
// TODO Permission to read daily rate
$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)
// TODO Permission to read daily rate to show value
$total_ht_by_line = price2num($tmpprojtime['amount'],'MT');
if ($tmpprojtime['nblinesnull'] > 0)
{
$langs->load("errors");
$warning=$langs->trans("WarningSomeLinesWithNullHourlyRate", $conf->currency);
@ -988,6 +998,8 @@ foreach ($listofreferent as $key => $value)
$total_ht_by_third += $total_ht_by_line;
$total_ttc_by_third += $total_ttc_by_line;
$total_time = $total_time + $total_time_by_line;
}
if (canApplySubtotalOn($tablename))
@ -1013,7 +1025,17 @@ foreach ($listofreferent as $key => $value)
if ($breakline) print $breakline;
// Total
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Number").': '.$i.'</td>';
$colspan=4;
if (in_array($tablename, array('projet_task'))) $colspan=2;
print '<tr class="liste_total"><td colspan="'.$colspan.'">'.$langs->trans("Number").': '.$i.'</td>';
if (in_array($tablename, array('projet_task')))
{
print '<td align="center">';
print convertSecondToTime($total_time, 'allhourmin');
print '</td>';
print '<td>';
print '</td>';
}
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
print '<td align="right">';

View File

@ -35,6 +35,18 @@ $ref = GETPOST('ref','alpha');
$socid = GETPOST('socid','int');
$action = GETPOST('action','alpha');
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield","alpha");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (! $sortfield) $sortfield="a.datep,a.id";
if (! $sortorder) $sortorder="DESC";
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (GETPOST('actioncode','array'))
{
$actioncode=GETPOST('actioncode','array',3);
@ -181,7 +193,7 @@ if (!empty($object->id))
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters);
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
}