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

This commit is contained in:
Florian HENRY 2015-03-04 09:58:09 +01:00
commit 28f6197ac5
20 changed files with 482 additions and 147 deletions

View File

@ -41,7 +41,7 @@ $actiontest=GETPOST('test','alpha');
$actionsave=GETPOST('save','alpha');
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
// List of aviable colors
$colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5');

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
@ -39,6 +39,9 @@ if (! empty($conf->projet->enabled)) {
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
$filter=GETPOST("filter",'',3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
@ -170,7 +173,7 @@ $listofextcals=array();
if (empty($conf->global->AGENDA_DISABLE_EXT))
{
$i=0;
while($i < $conf->global->AGENDA_EXT_NB)
while($i < $MAXAGENDA)
{
$i++;
$source='AGENDA_EXT_SRC'.$i;
@ -188,7 +191,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT))
if (empty($user->conf->AGENDA_DISABLE_EXT))
{
$i=0;
while($i < $conf->global->AGENDA_EXT_NB)
while($i < $MAXAGENDA)
{
$i++;
$source='AGENDA_EXT_SRC_'.$user->id.'_'.$i;

View File

@ -36,12 +36,12 @@
*/
class CMailFile
{
var $subject; // Topic: Subject of email
var $addr_from; // From: Label of sender (name but can contains an email inside <>)
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it with an email from a sending host from is a SPF protected domain and sending host is not this domain.
// Return-Path: Email where to send bounds.
var $errors_to; // Errors-To: Email where to send errors.
var $subject; // Topic: Subject of email
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@mydomain.com>' or 'John Doe <myemail@mydomain.com>' or '<myemail+trackingid@mydomain.com>')
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, use for Sender an email of the protected domain.
// Return-Path: Email where to send bounds.
var $errors_to; // Errors-To: Email where to send errors.
var $addr_to;
var $addr_cc;
var $addr_bcc;

View File

@ -2575,7 +2575,7 @@ abstract class CommonObject
{
global $conf, $hookmanager, $inputalsopricewithtax, $usemargins, $langs, $user;
# Define usemargins
// Define usemargins
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element,array('facture','propal','commande'))) $usemargins=1;

View File

@ -330,7 +330,7 @@ class FormOther
}
// Print a select with each of them
$moreforfilter.='<select class="flat" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
$moreforfilter.='<select class="flat minwidth100" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
$moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing
if (is_array($tab_categs))

176
htdocs/core/js/timesheet.js Normal file
View File

@ -0,0 +1,176 @@
//FIXME total not working
/* Copyright (C) 2014 delcroip <delcroip@gmail.com>
* Laurent Destailleur 2015 <eldy@users.sourceforge.net>
*
* 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 3 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 <http://www.gnu.org/licenses/>.
*/
/* Parse en input data for time entry into timesheet */
function regexEvent(objet,evt,type)
{
console.log('regexEvent type='+type);
switch(type)
{
case 'days':
var regex= /^[0-9]{1}([.,]{1}[0-9]{1})?$/;
if(regex.test(objet.value) )
{
var tmp=objet.value.replace(',','.');
if(tmp<=1.5){
var tmpint=parseInt(tmp);
if(tmp-tmpint>=0.5){
objet.value= tmpint+0.5;
}else{
objet.value= tmpint;
}
}else{
objet.value= '1.5';
}
}else{
objet.value= '0';
}
break;
case 'hours':
var regex= /^[0-9]{1,2}:[0-9]{2}$/;
var regex2=/^[0-9]{1,2}$/;
if(!regex.test(objet.value))
{
if(regex2.test(objet.value))
objet.value=objet.value+':00';
else
objet.value='';
}
/* alert(jQuery("#"+id).val()); */
break;
case 'timeChar':
//var regex= /^[0-9:]{1}$/;
//alert(event.charCode);
var charCode = (evt.which) ? evt.which : event.keyCode;
if(((charCode >= 48) && (charCode <= 57)) || //num
(charCode===46) || (charCode===8)||// comma & periode
(charCode === 58) || (charCode==44) )// : & all charcode
{
// ((charCode>=96) && (charCode<=105)) || //numpad
return true;
}else
{
return false;
}
break;
default:
break;
}
}
function pad(n) {
return (n < 10) ? ("0" + n) : n;
}
/* function from http://www.timlabonne.com/2013/07/parsing-a-time-string-with-javascript/ */
function parseTime(timeStr, dt)
{
if (!dt) {
dt = new Date();
}
var time = timeStr.match(/(\d+)(?::(\d\d))?\s*(p?)/i);
if (!time) {
return -1;
}
var hours = parseInt(time[1], 10);
if (hours == 12 && !time[3]) {
hours = 0;
}
else {
hours += (hours < 12 && time[3]) ? 12 : 0;
}
dt.setHours(hours);
dt.setMinutes(parseInt(time[2], 10) || 0);
dt.setSeconds(0, 0);
return 0;
}
/* Update total. days = column nb staring from 0 */
function updateTotal(days,mode)
{
console.log('updateTotal days='+days+' mode='+mode);
if(mode=="hours")
{
var total = new Date(0);
total.setHours(0);
total.setMinutes(0);
var nbline = document.getElementById('numberOfLines').value;
for (var i=0;i<nbline;i++)
{
var id='task['+i+']['+days+']';
var taskTime= new Date(0);
var element=document.getElementById(id);
if(element)
{
/* alert(element.value);*/
if (element.value)
{
result=parseTime(element.value,taskTime);
}
else
{
result=parseTime(element.innerHTML,taskTime);
}
if (result >= 0)
{
total.setHours(total.getHours()+taskTime.getHours());
total.setMinutes(total.getMinutes()+taskTime.getMinutes());
}
}
}
document.getElementById('totalDay['+days+']').innerHTML = pad(total.getHours())+':'+pad(total.getMinutes());
//addText(,total.getHours()+':'+total.getMinutes());
}
else
{
var total =0;
var nbline = document.getElementById('numberOfLines').value;
for (var i=0;i<nbline;i++)
{
var id='task['+i+']['+days+']';
var taskTime= new Date(0);
var element=document.getElementById(id);
if(element)
{
if (element.value)
{
total+=parseInt(element.value);
}
else
{
total+=parseInt(element.innerHTML);
}
}
}
document.getElementById('totalDay['+days+']').innerHTML = total;
}
}

View File

@ -71,9 +71,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if ($canedit)
{
print '<tr>';
print '<td class="nowrap">';
print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("ActionsToDoBy").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">';
print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("Group").' &nbsp; ';
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
@ -83,16 +83,16 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
$formactions=new FormActions($db);
print '<tr>';
print '<td class="nowrap">';
print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Type");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0));
print '</td></tr>';
print '<tr>';
print '<td class="nowrap">';
print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Status");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
print '</td></tr>';
}
@ -100,9 +100,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
{
print '<tr>';
print '<td class="nowrap">';
print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("ThirdParty").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">';
print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
print $form->select_thirdparty($socid, 'socid');
print '</td></tr>';
}
@ -113,9 +113,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
$formproject=new FormProjets($db);
print '<tr>';
print '<td class="nowrap">';
print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Project").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">';
print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0);
print '</td></tr>';
}
@ -124,7 +124,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
{
// Filter on hours
print '<tr>';
print '<td class="nowrap">'.$langs->trans("WorkingTimeRange").'</td>';
print '<td class="nowrap" style="padding-bottom: 2px;">'.$langs->trans("WorkingTimeRange").'</td>';
print "<td class='nowrap maxwidthonsmartphone'>";
print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
if (empty($conf->dol_use_jmobile)) print ' - ';
@ -140,10 +140,6 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if (empty($conf->dol_use_jmobile)) print ' - ';
print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
print '</td></tr>';
print '<tr><td>'.$langs->trans("AgendaShowBirthdayEvents").' <input type="checkbox" id="check_birthday" name="check_birthday"></td></tr>';
print '</table>';
print '</td>';
}
// Hooks

View File

@ -3851,8 +3851,8 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
/**
* This function is called to encode a string into a HTML string but differs from htmlentities because
* all entities but &,<,> are converted. This permits to encode special chars to entities with no double
* encoding for already encoded HTML strings.
* a detection is done before to see if text is already HTML or not. Also, all entities but &,<,> are converted.
* This permits to encode special chars to entities with no double encoding for already encoded HTML strings.
* This function also remove last EOL or BR if $removelasteolbr=1 (default).
* For PDF usage, you can show text by 2 ways:
* - writeHTMLCell -> param must be encoded into HTML.
@ -3869,7 +3869,7 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8',$removelasteolbr=1)
{
$newstring=$stringtoencode;
if (dol_textishtml($stringtoencode))
if (dol_textishtml($stringtoencode)) // Check if text is already HTML or not
{
$newstring=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
if ($removelasteolbr) $newstring=preg_replace('/<br>$/i','',$newstring); // Remove last <br> (remove only last one)
@ -4725,6 +4725,7 @@ function picto_from_langcode($codelang)
* 'member' to add a tab in fundation member view
* 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member)
* 'ecm' to add a tab for another ecm view
* 'stock' to add a tab for warehouse view
* @param string $mode 'add' to complete head, 'remove' to remove entries
* @return void
*/

View File

@ -371,6 +371,21 @@ function dol_print_object_info($object)
}
}
/**
* Return an email formatted to include a tracking id
* For example myemail@mydomain.com becom myemail+trackingid@mydomain.com
*
* @param string $email Email address (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
* @param string $trackingid Tracking id (Ex: thi123 for thirdparty with id 123)
* @return boolean True if domain email is OK, False if KO
*/
function dolAddEmailTrackId($email, $trackingid)
{
$tmp=explode('@',$email);
return $tmp[0].'+'.$trackingid.'@'.(isset($tmp[1])?$tmp[1]:'');
}
/**
* Return true if email has a domain name that can't be resolved
*

View File

@ -550,7 +550,7 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
print $taskstatic->getNomUrl(0);
print "<br>";
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end);
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
print "</td>\n";
// Planned Workload
@ -665,6 +665,9 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
{
$var = !$var;
$lastprojectid=$lines[$i]->fk_project;
$projectstatic->id = $lines[$i]->fk_project;
$projectstatic->loadTimeSpent($datestart, $lines[$i]->id, $fuser->id);
}
// If we want all or we have a role on task, we show it
@ -673,7 +676,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
print "<tr ".$bc[$var].">\n";
// Project
print "<td>";
print '<td class="nowrap">';
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
@ -682,7 +685,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
print "</td>";
// Ref
print '<td>';
print '<td class="nowrap">';
$taskstatic->id=$lines[$i]->id;
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
print $taskstatic->getNomUrl(1);
@ -696,7 +699,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
print $taskstatic->getNomUrl(0);
print "<br>";
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end);
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
print "</td>\n";
// Planned Workload
@ -711,6 +714,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
print '</td>';
// Time spent
/*
print '<td align="right">';
if ($lines[$i]->duration)
{
@ -720,6 +724,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
}
else print '--:--';
print "</td>\n";
*/
$disabledproject=1;$disabledtask=1;
//print "x".$lines[$i]->fk_project;
@ -737,27 +742,22 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
$disabledtask=1;
}
// Fields to add new time
print '<td align="right">';
print $langs->trans("FeatureNotYetAvailable");
/*
print '<td class="nowrap" align="right">';
$s='';
$s.=$form->select_date('',$lines[$i]->id,0,0,2,"addtime",1,0,1,$disabledtask);
$s.='&nbsp;&nbsp;&nbsp;';
$s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text',0,1);
$s.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled="disabled"':'').' value="'.$langs->trans("Add").'">';
print $s;
print '</td>';
//var_dump($projectstatic->weekWorkLoad);
print '<td align="right">';
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
print '</td>';
*/
print '</td>';
print "</tr>\n";
// Fields to show current time
$tableCell=''; $modeinput='hours';
for ($idw = 0; $idw < 7; $idw++)
{
$dayWorkLoad = 0;
$tableCell ='<td align="center">';
$tableCell.='<input type="text" class="center" size="2" disabled="disabled" value="'.convertSecondToTime($dayWorkLoad,'allhourmin').'">+';
$tableCell.='<input type="text" class="center" size="2" id="task['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
$tableCell.= 'onblur="regexEvent(this,event,\''.$modeinput.'\');updateTotal('.$idw.',\''.$modeinput.'\')" />';
$tableCell.='</td>';
print $tableCell;
}
print "</tr>\n";
}
$inc++;

View File

@ -255,40 +255,40 @@ class modFournisseur extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
while ($obj=$this->db->fetch_object($resql))
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='invoice';
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='facture_fourn';
}
}
// End add axtra fields
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
@ -309,40 +309,40 @@ class modFournisseur extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
while ($obj=$this->db->fetch_object($resql))
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='invoice';
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='facture_fourn';
}
}
// End add axtra fields
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
@ -353,20 +353,57 @@ class modFournisseur extends DolibarrModules
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')';
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Commandes fournisseurs et lignes de commandes';
$this->export_icon[$r]='order';
$this->export_permission[$r]=array(array("fournisseur","commande","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.note_private'=>"NotePrivate",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"order",'f.ref'=>"order",'f.ref_supplier'=>"order",'f.date_creation'=>"order",'f.date_commande'=>"order",'f.total_ht'=>"order",'f.total_ttc'=>"order",'f.tva'=>"order",'f.fk_statut'=>'order','f.note_private'=>"order",'fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"order",'f.ref'=>"order",'f.ref_supplier'=>"order",'f.date_creation'=>"order",'f.date_commande'=>"order",'f.total_ht'=>"order",'f.total_ttc'=>"order",'f.tva'=>"order",'f.fk_statut'=>'order','f.note_public'=>"order",'f.note_private'=>"order",'fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='order';
}
}
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f, '.MAIN_DB_PREFIX.'commande_fournisseurdet as fd';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseurdet as fd';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande';
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_order',1).')';

View File

@ -1095,8 +1095,8 @@ ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_task (fk_task);
ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_date (task_date);
ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_datehour);
ALTER TABLE llx_projet_task CHANGE COLUMN duration_effective real DEFAULT 0 NULL;
ALTER TABLE llx_projet_task CHANGE COLUMN planned_workload real DEFAULT 0 NULL;
ALTER TABLE llx_projet_task MODIFY COLUMN duration_effective real DEFAULT 0 NULL;
ALTER TABLE llx_projet_task MODIFY COLUMN planned_workload real DEFAULT 0 NULL;
-- add extrafield on ficheinter lines

View File

@ -62,7 +62,7 @@ LastProspectContactDone=Contact done
DateActionPlanned=Date event planned for
DateActionDone=Date event done
ActionAskedBy=Event reported by
ActionAffectedTo=Event owned by
ActionAffectedTo=Event assigned to
ActionDoneBy=Event done by
ActionUserAsk=Reported by
ErrorStatusCantBeZeroIfStarted=If field '<b>Date done</b>' is filled, action is started (or finished), so field '<b>Status</b>' can't be 0%%.

View File

@ -467,14 +467,14 @@ else
if ($user->rights->stock->mouvement->creer)
{
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&amp;id='.$objp->rowid.'&amp;action=transfert">';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&id='.$objp->rowid.'&action=transfert&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id).'">';
print img_picto($langs->trans("StockMovement"),'uparrow.png','class="hideonsmartphone"').' '.$langs->trans("StockMovement");
print "</a></td>";
}
if ($user->rights->stock->creer)
{
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&amp;id='.$objp->rowid.'&amp;action=correction">';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&id='.$objp->rowid.'&action=correction&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id).'">';
print $langs->trans("StockCorrection");
print "</a></td>";
}

View File

@ -37,7 +37,7 @@ function dolDispatchToDo($order_id)
$dispatched = array();
$ordered = array();
# Count nb of quantity dispatched per product
// Count nb of quantity dispatched per product
$sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch';
$sql.= ' WHERE fk_commande = ' . $order_id;
$sql.= ' GROUP BY fk_product';
@ -49,7 +49,7 @@ function dolDispatchToDo($order_id)
$dispatched[$obj->fk_product] = $obj;
}
# Count nb of quantity to dispatch per product
// Count nb of quantity to dispatch per product
$sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet';
$sql.= ' WHERE fk_commande = ' . $order_id;
$sql.= ' AND fk_product > 0';

View File

@ -43,7 +43,7 @@ $langs->load("stocks");
$langs->load("sendings");
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
$backtopage=GETPOST('backtopage');
$action=GETPOST("action");
$cancel=GETPOST('cancel');
@ -160,8 +160,16 @@ if ($action == "correct_stock" && ! $cancel)
if ($result > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
exit;
if ($backtopage)
{
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
exit;
}
}
else
{
@ -292,8 +300,17 @@ if ($action == "transfert_stock" && ! $cancel)
if (! $error && $result1 >= 0 && $result2 >= 0)
{
$db->commit();
header("Location: product.php?id=".$product->id);
exit;
if ($backtopage)
{
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: product.php?id=".$product->id);
exit;
}
}
else
{
@ -594,6 +611,7 @@ if ($id > 0 || $ref)
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'" method="post">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="correct_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border" width="100%">';
// Warehouse
@ -681,6 +699,7 @@ if ($id > 0 || $ref)
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'" method="post">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="transfert_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($pdluoid)
{
print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';

View File

@ -48,6 +48,8 @@ $socid=0;
if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $projectid);
$now=dol_now();
/*
* Actions
@ -94,7 +96,7 @@ $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$user,($project->id?$pr
//var_dump($taskrole);
llxHeader("",$title,"");
llxHeader("",$title,"",'','','',array('/core/js/timesheet.js'));
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
@ -143,8 +145,17 @@ print '<td>'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td align="right">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print '<td colspan="2" align="right">'.$langs->trans("xxx").'</td>';
//print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
$tmp=dol_getdate($now);
$startdayarray=dol_get_first_day_week($tmp['mday'], $tmp['mon'], $tmp['year']);
$startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
for($i=0;$i<7;$i++)
{
print '<td width="7%" align="center">'.dol_print_date($startday + ($i * 3600 * 24), '%a').'<br>'.dol_print_date($startday + ($i * 3600 * 24), 'day').'</td>';
}
print "</tr>\n";
// By default, we can edit only tasks we are assigned to
@ -154,6 +165,17 @@ if (count($tasksarray) > 0)
{
$j=0;
projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
print '<tr class="liste_total">
<td class="liste_total" colspan="5" align="right">'.$langs->trans("Total").'</td>
<td class="liste_total" width="7%" align="center"><div id="totalDay[0]">&nbsp;</div></td>
<td class="liste_total" width="7%" align="center"><div id="totalDay[1]">&nbsp;</div></td>
<td class="liste_total" width="7%" align="center"><div id="totalDay[2]">&nbsp;</div></td>
<td class="liste_total" width="7%" align="center"><div id="totalDay[3]">&nbsp;</div></td>
<td class="liste_total" width="7%" align="center"><div id="totalDay[4]">&nbsp;</div></td>
<td class="liste_total" width="7%" align="center"><div id="totalDay[5]">&nbsp;</div></td>
<td class="liste_total" width="7%" align="center"><div id="totalDay[6]">&nbsp;</div></td>
</tr>';
}
else
{
@ -161,8 +183,15 @@ else
}
print "</table>";
print '<input type="hidden" name="timestamp" value="1425423513"/>'."\n";
print '<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).'"/>'."\n";
dol_fiche_end();
print '<div class="center">';
print '<input type="button" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print '</div>';
print '</form>';

View File

@ -1432,5 +1432,52 @@ class Project extends CommonObject
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
/**
* load time spent into this->weekWorkLoad for all day of a week and task id
*
* @param int $datestart First day of week (use dol_get_first_day to find this date)
* @param int $taskid Task id
* @param int $userid Time consumed per a particular user
* @return int <0 if OK, >0 if KO
*/
public function loadTimeSpent($datestart,$taskid,$userid=0)
{
$error=0;
$sql = "SELECT ptt.rowid, ptt.task_duration, ptt.task_date";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time AS ptt";
$sql.= " WHERE ptt.fk_task='".$taskid."'";
$sql.= " AND ptt.fk_user='".$userid."'";
$sql .= "AND (ptt.task_date >= '".$this->db->idate($datestart)."' ";
$sql .= "AND (ptt.task_date < '".$this->db->idate($datestart + 7 * 24 * 3600)."' ";
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
// Loop on each record found, so each couple (project id, task id)
while ($i < $num)
{
$obj=$this->db->fetch_object($resql);
$day=$this->db->jdate($obj->task_date);
//$day=(intval(date('w',strtotime($obj->task_date)))+1)%6;
// if several tasktime in one day then only the last is used
$this->weekWorkLoad[$day] += $obj->task_duration;
$this->taskTimeId[$day]= ($obj->rowid)?($obj->rowid):0;
$i++;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
}
}

View File

@ -22,6 +22,10 @@
* http://127.0.0.1/dolibarr/public/agenda/agendaexport.php?format=vcal&exportkey=cle
* http://127.0.0.1/dolibarr/public/agenda/agendaexport.php?format=ical&type=event&exportkey=cle
* http://127.0.0.1/dolibarr/public/agenda/agendaexport.php?format=rss&exportkey=cle
* Other parameters into url are:
* &notolderthan=99
* &year=2015
* &id=..., &idfrom=..., &idto=...
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
@ -55,23 +59,26 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Security check
if (empty($conf->agenda->enabled)) accessforbidden('',1,1,1);
// Not older than
if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; // default limit
// Define format, type and filter
$format='ical';
$type='event';
if (! empty($_GET["format"])) $format=$_GET["format"];
if (! empty($_GET["type"])) $type=$_GET["type"];
$filters=array();
if (! empty($_GET["year"])) $filters['year']=$_GET["year"];
if (! empty($_GET["id"])) $filters['id']=$_GET["id"];
if (! empty($_GET["idfrom"])) $filters['idfrom']=$_GET["idfrom"];
if (! empty($_GET["idto"])) $filters['idto']=$_GET["idto"];
if (! empty($_GET["project"])) $filters['project']=$_GET["project"];
if (! empty($_GET["login"])) $filters['login']=$_GET["login"];
if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"];
if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"];
// Not older than
if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100;
$filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY;
if (! empty($_GET["year"])) $filters['year']=$_GET["year"];
if (! empty($_GET["id"])) $filters['id']=$_GET["id"];
if (! empty($_GET["idfrom"])) $filters['idfrom']=$_GET["idfrom"];
if (! empty($_GET["idto"])) $filters['idto']=$_GET["idto"];
if (! empty($_GET["project"])) $filters['project']=$_GET["project"];
if (! empty($_GET["login"])) $filters['login']=$_GET["login"];
if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"];
if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"];
if (GETPOST("notolderthan")) $filters['notolderthan']=GETPOST("notolderthan","int");
else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY;
// Check config
if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY))

View File

@ -259,9 +259,9 @@ if (empty($reshook))
$action = (($action=='add'||$action=='create')?'create':'edit');
}
}
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
if (! $vallabel && ! empty($conf->global->$idprof_mandatory))
{
$langs->load("errors");
@ -2129,6 +2129,11 @@ else
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID))
{
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'thi'.$object->id);
}
$formmail->withfrom=1;
$formmail->withtopic=1;
$liste=array();