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

This commit is contained in:
Laurent Destailleur 2017-10-06 15:23:10 +02:00
commit 43d85af5ae
8 changed files with 127 additions and 101 deletions

View File

@ -239,21 +239,25 @@ class Proposals extends DolibarrApi
*
* @return int
*/
function postLine($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
function postLine($id, $request_data = NULL)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
$result = $this->propal->fetch($id);
if (! $result) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->propal->addline(
if (! DolibarrApi::_checkAccessToResource('propal',$this->propal->id))
{
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->propal->addline(
$request_data->desc,
$request_data->subprice,
$request_data->qty,
@ -300,43 +304,52 @@ class Proposals extends DolibarrApi
*
* @return object
*/
function putLine($id, $lineid, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
function putLine($id, $lineid, $request_data = NULL)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
$result = $this->propal->fetch($id);
if($result <= 0) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->propal->updateline(
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$propalline = new PropaleLigne($this->db);
$result = $propalline->fetch($lineid);
if ($result <= 0) {
throw new RestException(404, 'Proposal line not found');
}
$updateRes = $this->propal->updateline(
$lineid,
$request_data->subprice,
$request_data->qty,
$request_data->remise_percent,
$request_data->tva_tx,
$request_data->localtax1_tx,
$request_data->localtax2_tx,
$request_data->desc,
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
isset($request_data->qty)?$request_data->qty:$propalline->qty,
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
isset($request_data->desc)?$request_data->desc:$propalline->desc,
'HT',
$request_data->info_bits,
$request_data->special_code,
$request_data->fk_parent_line,
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
0,
$request_data->fk_fournprice,
$request_data->pa_ht,
$request_data->label,
$request_data->product_type,
$request_data->date_start,
$request_data->date_end,
$request_data->array_options,
$request_data->fk_unit,
$request_data->multicurrency_subprice
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
isset($request_data->label)?$request_data->label:$propalline->label,
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
);
if ($updateRes > 0) {

View File

@ -3654,59 +3654,66 @@ class PropaleLigne extends CommonObjectLine
{
$objp = $this->db->fetch_object($result);
$this->id = $objp->rowid;
$this->rowid = $objp->rowid; // deprecated
$this->fk_propal = $objp->fk_propal;
$this->fk_parent_line = $objp->fk_parent_line;
$this->label = $objp->custom_label;
$this->desc = $objp->description;
$this->qty = $objp->qty;
$this->price = $objp->price; // deprecated
$this->subprice = $objp->subprice;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->remise = $objp->remise; // deprecated
$this->remise_percent = $objp->remise_percent;
$this->fk_remise_except = $objp->fk_remise_except;
$this->fk_product = $objp->fk_product;
$this->info_bits = $objp->info_bits;
if ($objp)
{
$this->id = $objp->rowid;
$this->rowid = $objp->rowid; // deprecated
$this->fk_propal = $objp->fk_propal;
$this->fk_parent_line = $objp->fk_parent_line;
$this->label = $objp->custom_label;
$this->desc = $objp->description;
$this->qty = $objp->qty;
$this->price = $objp->price; // deprecated
$this->subprice = $objp->subprice;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->remise = $objp->remise; // deprecated
$this->remise_percent = $objp->remise_percent;
$this->fk_remise_except = $objp->fk_remise_except;
$this->fk_product = $objp->fk_product;
$this->info_bits = $objp->info_bits;
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
$this->fk_fournprice = $objp->fk_fournprice;
$this->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
$this->pa_ht = $marginInfos[0];
$this->marge_tx = $marginInfos[1];
$this->marque_tx = $marginInfos[2];
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
$this->pa_ht = $marginInfos[0];
$this->marge_tx = $marginInfos[1];
$this->marque_tx = $marginInfos[2];
$this->special_code = $objp->special_code;
$this->product_type = $objp->product_type;
$this->rang = $objp->rang;
$this->special_code = $objp->special_code;
$this->product_type = $objp->product_type;
$this->rang = $objp->rang;
$this->ref = $objp->product_ref; // deprecated
$this->product_ref = $objp->product_ref;
$this->libelle = $objp->product_label; // deprecated
$this->product_label = $objp->product_label;
$this->product_desc = $objp->product_desc;
$this->fk_unit = $objp->fk_unit;
$this->ref = $objp->product_ref; // deprecated
$this->product_ref = $objp->product_ref;
$this->libelle = $objp->product_label; // deprecated
$this->product_label = $objp->product_label;
$this->product_desc = $objp->product_desc;
$this->fk_unit = $objp->fk_unit;
$this->date_start = $this->db->jdate($objp->date_start);
$this->date_end = $this->db->jdate($objp->date_end);
$this->date_start = $this->db->jdate($objp->date_start);
$this->date_end = $this->db->jdate($objp->date_end);
// Multicurrency
$this->fk_multicurrency = $objp->fk_multicurrency;
$this->multicurrency_code = $objp->multicurrency_code;
$this->multicurrency_subprice = $objp->multicurrency_subprice;
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
// Multicurrency
$this->fk_multicurrency = $objp->fk_multicurrency;
$this->multicurrency_code = $objp->multicurrency_code;
$this->multicurrency_subprice = $objp->multicurrency_subprice;
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$this->db->free($result);
$this->db->free($result);
return 1;
return 1;
}
else
{
return 0;
}
}
else
{

View File

@ -5701,8 +5701,8 @@ class Form
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')')
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')')
);
}

View File

@ -663,12 +663,6 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print "</td>";
// Ref
print '<td>';
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
print $taskstatic->getNomUrl(1,'withproject');
print '</td>';
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
{
// Thirdparty
@ -679,6 +673,12 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print '</td>';
}
// Ref
print '<td>';
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
print $taskstatic->getNomUrl(1, 'withproject', 'time');
print '</td>';
// Label task
print "<td>";
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
@ -686,7 +686,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
$taskstatic->ref=$lines[$i]->label;
$taskstatic->date_start=$lines[$i]->date_start;
$taskstatic->date_end=$lines[$i]->date_end;
print $taskstatic->getNomUrl(0,'withproject');
print $taskstatic->getNomUrl(0, 'withproject', 'time');
//print "<br>";
//for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);

View File

@ -364,6 +364,8 @@ update llx_bank_url as bu set url_id = (select e.fk_user_author from tmp_bank_ur
drop table tmp_bank_url_expense_user;
-- VMYSQL4.1 update llx_projet_task_time set task_datehour = task_date where task_datehour < task_date or task_datehour > DATE_ADD(task_date, interval 1 day);
-- Clean product prices
--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05';

View File

@ -242,13 +242,14 @@ if ($action == 'addtime' && $user->rights->projet->lire)
$object->timespent_note = GETPOST($key.'note');
if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered
{
$object->timespent_date = dol_mktime(GETPOST($key."hour"),GETPOST($key."min"),0,$monthofday,$dayofday,$yearofday);
$object->timespent_datehour = dol_mktime(GETPOST($key."hour"),GETPOST($key."min"),0,$monthofday,$dayofday,$yearofday);
$object->timespent_withhour = 1;
}
else
{
$object->timespent_date = dol_mktime(12,0,0,$monthofday,$dayofday,$yearofday);
$object->timespent_datehour = dol_mktime(12,0,0,$monthofday,$dayofday,$yearofday);
}
$object->timespent_date = $object->timespent_datehour;
if ($object->timespent_date > 0)
{

View File

@ -247,6 +247,7 @@ if ($action == 'addtime' && $user->rights->projet->lire)
$object->timespent_duration = $newduration;
$object->timespent_fk_user = $usertoprocess->id;
$object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
$object->timespent_datehour = $object->timespent_date;
$result=$object->addTimeSpent($user);
if ($result < 0)

View File

@ -685,7 +685,9 @@ class Task extends CommonObject
//print $usert.'-'.$userp.'-'.$projectid.'-'.$socid.'-'.$mode.'<br>';
// List of tasks (does not care about permissions. Filtering will be done later)
$sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus,";
$sql = "SELECT ";
if ($filteronprojuser > 0 || $filterontaskuser > 0) $sql.= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task
$sql.= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus,";
$sql.= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,";
$sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,";
$sql.= " s.rowid as thirdparty_id, s.nom as thirdparty_name";
@ -749,7 +751,7 @@ class Task extends CommonObject
}
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
if ($projectid) $sql.= " AND p.rowid in (".$projectid.")";
if ($filteronprojref) $sql.= " AND p.ref LIKE '%".$filteronprojref."%'";
if ($filteronprojref) $sql.= " AND p.ref LIKE '%".$this->db->escape($filteronprojref)."%'";
if ($filteronprojstatus > -1) $sql.= " AND p.fk_statut = ".$filteronprojstatus;
if ($morewherefilter) $sql.=$morewherefilter;
$sql.= " ORDER BY p.ref, t.rang, t.dateo";