clean indent in comm directory

This commit is contained in:
Frédéric FRANCE 2019-10-26 14:28:40 +02:00
parent 7fee355fba
commit 1a10b30a76
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
23 changed files with 252 additions and 255 deletions

View File

@ -186,7 +186,7 @@
<!-- Check indent are done with spaces and with correct number --> <!-- Check indent are done with spaces and with correct number -->
<!-- Disabled as this does not support tab --> <!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> --> <!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<!-- TODO Enable this
<arg name="tab-width" value="4"/> <arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"> <rule ref="Generic.WhiteSpace.ScopeIndent">
<properties> <properties>
@ -194,7 +194,7 @@
<property name="tabIndent" value="true"/> <property name="tabIndent" value="true"/>
</properties> </properties>
</rule> </rule>
-->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" /> <rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />

View File

@ -94,7 +94,7 @@ if ($id > 0 && $action!='add') {
$ret1 = $object->fetch_userassigned(); $ret1 = $object->fetch_userassigned();
} }
if ($ret < 0 || $ret1 < 0) { if ($ret < 0 || $ret1 < 0) {
dol_print_error('', $object->error); dol_print_error('', $object->error);
} }
} }
@ -1582,19 +1582,20 @@ if ($id > 0)
if ($user->rights->agenda->allactions->create || if ($user->rights->agenda->allactions->create ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))
{ {
if ($action != 'classify') if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -484,9 +484,9 @@ class ActionComm extends CommonObject
return $this->id; return $this->id;
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
else else
@ -1043,7 +1043,7 @@ class ActionComm extends CommonObject
return $resarray; return $resarray;
} }
else else
{ {
return $db->lasterror(); return $db->lasterror();
} }
} }

View File

@ -379,7 +379,7 @@ class ICal
return $temp; return $temp;
} }
else else
{ {
return false; return false;
} }
} }

View File

@ -519,14 +519,14 @@ if (! empty($actioncode))
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
else else
{ {
if (is_array($actioncode)) if (is_array($actioncode))
{ {
$sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')";
} }
else else
{ {
$sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')";
} }
} }
} }
} }

View File

@ -41,8 +41,8 @@ $id = GETPOST('id', 'int');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');

View File

@ -702,15 +702,15 @@ if ($resql)
// Linked object // Linked object
if (! empty($arrayfields['a.fk_element']['checked'])) { if (! empty($arrayfields['a.fk_element']['checked'])) {
print '<td>'; print '<td>';
//var_dump($obj->fkelement.' '.$obj->elementtype); //var_dump($obj->fkelement.' '.$obj->elementtype);
if ($obj->fk_element > 0 && ! empty($obj->elementtype)) { if ($obj->fk_element > 0 && ! empty($obj->elementtype)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1); print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1);
} else { } else {
print "&nbsp;"; print "&nbsp;";
} }
print '</td>'; print '</td>';
} }
// Extra fields // Extra fields

View File

@ -418,14 +418,14 @@ if (! empty($actioncode))
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
else else
{ {
if (is_array($actioncode)) if (is_array($actioncode))
{ {
$sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')";
} }
else else
{ {
$sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')";
} }
} }
} }
} }
@ -683,16 +683,16 @@ while($currentdaytoshow<$lastdaytoshow) {
{ {
foreach ($eventarray as $daykey => $notused) foreach ($eventarray as $daykey => $notused)
{ {
// Get all assigned users for each event // Get all assigned users for each event
foreach ($eventarray[$daykey] as $index => $event) foreach ($eventarray[$daykey] as $index => $event)
{ {
$event->fetch_userassigned(); $event->fetch_userassigned();
$listofuserid=$event->userassigned; $listofuserid=$event->userassigned;
foreach($listofuserid as $userid => $tmp) foreach($listofuserid as $userid => $tmp)
{ {
if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid; if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid;
} }
} }
} }
} }
/* Use this list to have for all users */ /* Use this list to have for all users */

View File

@ -565,7 +565,7 @@ if ($object->id > 0)
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code']).'</a>'; if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code']).'</a>';
} }
print '</div></td></tr>'; print '</div></td></tr>';
print "</table>"; print "</table>";
} }
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
@ -1297,8 +1297,8 @@ if ($object->id > 0)
{ {
if ($object->client != 0 && $object->client != 2) if ($object->client != 0 && $object->client != 2)
{ {
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>'; if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>'; else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
} }
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>'; else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
} }

View File

@ -59,13 +59,13 @@ llxHeader('', $langs->trans("Contacts"));
if ($type == "c" || $type == "p") if ($type == "c" || $type == "p")
{ {
$label = $langs->trans("Customers"); $label = $langs->trans("Customers");
$urlfiche="card.php"; $urlfiche="card.php";
} }
if ($type == "f") if ($type == "f")
{ {
$label = $langs->trans("Suppliers"); $label = $langs->trans("Suppliers");
$urlfiche="card.php"; $urlfiche="card.php";
} }
/* /*
@ -88,29 +88,28 @@ if ($socid) $sql.= " AND s.rowid = ".$socid;
if (dol_strlen($stcomm)) if (dol_strlen($stcomm))
{ {
$sql.= " AND s.fk_stcomm=".$db->escape($stcomm); $sql.= " AND s.fk_stcomm=".$db->escape($stcomm);
} }
if (! empty($search_lastname)) if (! empty($search_lastname))
{ {
$sql.= " AND p.name LIKE '%".$db->escape($search_lastname)."%'"; $sql.= " AND p.name LIKE '%".$db->escape($search_lastname)."%'";
} }
if (! empty($search_firstname)) if (! empty($search_firstname))
{ {
$sql.= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'"; $sql.= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'";
} }
if (! empty($search_company)) if (! empty($search_company))
{ {
$sql.= " AND s.nom LIKE '%".$db->escape($search_company)."%'"; $sql.= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
} }
if (! empty($contactname)) // acces a partir du module de recherche if (! empty($contactname)) // acces a partir du module de recherche
{ {
$sql.= " AND (p.name LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') "; $sql.= " AND (p.name LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') ";
$sortfield = "p.name"; $sortf$sortorder = "ASC";
$sortorder = "ASC";
} }
$sql.= $db->order($sortfield, $sortorder); $sql.= $db->order($sortfield, $sortorder);

View File

@ -851,7 +851,7 @@ else
setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings'); setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it. if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it.
{ {
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant... setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant...
} }
$_GET["action"]=''; $_GET["action"]='';
} }

View File

@ -131,7 +131,7 @@ if (is_resource($handle))
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
print '</tr>'; print '</tr>';
} }

View File

@ -9,10 +9,10 @@
* Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -166,7 +166,7 @@ if (empty($reshook))
if ($object->id > 0) { if ($object->id > 0) {
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY)) { if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY)) {
//Get difference between old and new delivery date and change lines according to difference //Get difference between old and new delivery date and change lines according to difference
$date_delivery = dol_mktime(12, 0, 0, $date_delivery = dol_mktime(12, 0, 0,
GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliverymonth', 'int'),
GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryday', 'int'),
GETPOST('date_deliveryyear', 'int') GETPOST('date_deliveryyear', 'int')
@ -174,7 +174,7 @@ if (empty($reshook))
if (!empty($object->date_livraison) && !empty($date_delivery)) if (!empty($object->date_livraison) && !empty($date_delivery))
{ {
//Attempt to get the date without possible hour rounding errors //Attempt to get the date without possible hour rounding errors
$old_date_delivery = dol_mktime(12, 0, 0, $old_date_delivery = dol_mktime(12, 0, 0,
dol_print_date($object->date_livraison, '%m'), dol_print_date($object->date_livraison, '%m'),
dol_print_date($object->date_livraison, '%d'), dol_print_date($object->date_livraison, '%d'),
dol_print_date($object->date_livraison, '%Y') dol_print_date($object->date_livraison, '%Y')
@ -459,91 +459,91 @@ if (empty($reshook))
$id = $object->create($user); $id = $object->create($user);
if ($id > 0) if ($id > 0)
{ {
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = ucfirst($subelement); $classname = ucfirst($subelement);
$srcobject = new $classname($db); $srcobject = new $classname($db);
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
$result = $srcobject->fetch($object->origin_id); $result = $srcobject->fetch($object->origin_id);
if ($result > 0) if ($result > 0)
{
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
{ {
$srcobject->fetch_lines();
$lines = $srcobject->lines; $lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
{
$srcobject->fetch_lines();
$lines = $srcobject->lines;
}
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
// Positive line
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Date start
$date_start = false;
if ($lines[$i]->date_debut_prevue)
$date_start = $lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel)
$date_start = $lines[$i]->date_debut_reel;
if ($lines[$i]->date_start)
$date_start = $lines[$i]->date_start;
// Date end
$date_end = false;
if ($lines[$i]->date_fin_prevue)
$date_end = $lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel)
$date_end = $lines[$i]->date_fin_reel;
if ($lines[$i]->date_end)
$date_end = $lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
if ($result > 0) {
$lineid = $result;
} else {
$lineid = 0;
$error ++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
// Hooks
$parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0)
$error ++;
} else {
setEventMessages($srcobject->error, $srcobject->errors, 'errors');
$error ++;
} }
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
// Positive line
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Date start
$date_start = false;
if ($lines[$i]->date_debut_prevue)
$date_start = $lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel)
$date_start = $lines[$i]->date_debut_reel;
if ($lines[$i]->date_start)
$date_start = $lines[$i]->date_start;
// Date end
$date_end = false;
if ($lines[$i]->date_fin_prevue)
$date_end = $lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel)
$date_end = $lines[$i]->date_fin_reel;
if ($lines[$i]->date_end)
$date_end = $lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
if ($result > 0) {
$lineid = $result;
} else {
$lineid = 0;
$error ++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
// Hooks
$parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0)
$error ++;
} else {
setEventMessages($srcobject->error, $srcobject->errors, 'errors');
$error ++;
}
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error ++; $error ++;
@ -920,8 +920,8 @@ if (empty($reshook))
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{ {
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
} }
} }
// If price per customer // If price per customer

View File

@ -227,7 +227,7 @@ class Proposals extends DolibarrApi
} }
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$this->propal->getLinesArray(); $this->propal->getLinesArray();
$result = array(); $result = array();
@ -255,7 +255,7 @@ class Proposals extends DolibarrApi
$result = $this->propal->fetch($id); $result = $this->propal->fetch($id);
if (! $result) { if (! $result) {
throw new RestException(404, 'Commercial Proposal not found'); throw new RestException(404, 'Commercial Proposal not found');
} }
if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {

View File

@ -1714,9 +1714,9 @@ class Propal extends CommonObject
// multilangs // multilangs
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) { if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
$line = new Product($this->db); $line = new Product($this->db);
$line->fetch($objp->fk_product); $line->fetch($objp->fk_product);
$line->getMultiLangs(); $line->getMultiLangs();
} }
$this->lines[$i] = $line; $this->lines[$i] = $line;
@ -3403,7 +3403,7 @@ class Propal extends CommonObject
{ {
$prodid = mt_rand(1, $num_prods); $prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid]; $line->fk_product=$prodids[$prodid];
$line->product_ref='SPECIMEN'; $line->product_ref='SPECIMEN';
} }
$this->lines[$xnbp]=$line; $this->lines[$xnbp]=$line;
@ -3919,7 +3919,7 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0; if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
// if buy price not defined, define buyprice as configured in margin admin // if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0 && $pa_ht_isemptystring) if ($this->pa_ht == 0 && $pa_ht_isemptystring)
{ {
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)

View File

@ -170,20 +170,21 @@ if ($object->id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer) if ($user->rights->propal->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -125,20 +125,21 @@ if ($object->id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer) if ($user->rights->propal->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -86,20 +86,21 @@ if (! empty($conf->projet->enabled))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer) if ($user->rights->propal->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -279,8 +279,9 @@ $sql.= ' u.login';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields // Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
// Add fields from hooks // Add fields from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -693,7 +694,7 @@ if ($resql)
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Date cloture // Date cloture
if (! empty($arrayfields['p.date_cloture']['checked'])) if (! empty($arrayfields['p.date_cloture']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';

View File

@ -101,20 +101,21 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer) if ($user->rights->propal->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -29,11 +29,8 @@ if (empty($conf) || ! is_object($conf)) {
exit; exit;
} }
?>
<!-- BEGIN PHP TEMPLATE --> print "<!-- BEGIN PHP TEMPLATE -->\n";
<?php
global $user; global $user;
@ -45,51 +42,46 @@ $langs->load("propal");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total=0; $ilink=0; $total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)
{ {
$ilink++; $ilink++;
$trclass='oddeven'; $trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?> print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" > print '<td class="linkedcol-element" >'.$langs->trans("Proposal");
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?> if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
<?php
if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
{ {
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id; $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>'; print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
} }
?> print '</td>';
</td> print '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td> print '<td class="linkedcol-ref" >'.$objectlink->ref_client.'</td>';
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td> print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td> print '<td class="linkedcol-amount right">';
<td class="linkedcol-amount right"><?php if ($user->rights->propale->lire) {
if ($user->rights->propale->lire) { $total = $total + $objectlink->total_ht;
$total = $total + $objectlink->total_ht; echo price($objectlink->total_ht);
echo price($objectlink->total_ht); }
} ?></td> print '</td>';
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td> print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
<td class="linkedcol-action right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
</tr> print "</tr>\n";
<?php
} }
if (count($linkedObjectBlock) > 1) if (count($linkedObjectBlock) > 1)
{ {
?> print '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>"> print '<td>'.$langs->trans("Total").'</td>';
<td><?php echo $langs->trans("Total"); ?></td> print '<td></td>';
<td></td> print '<td class="center"></td>';
<td class="center"></td> print '<td class="center"></td>';
<td class="center"></td> print '<td class="right">'.price($total).'</td>';
<td class="right"><?php echo price($total); ?></td> print '<td class="right"></td>';
<td class="right"></td> print '<td class="right"></td>';
<td class="right"></td> print "</tr>\n";
</tr>
<?php
} }
?>
<!-- END PHP TEMPLATE --> print "<!-- END PHP TEMPLATE -->\n";

View File

@ -34,8 +34,8 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
$socid = $_GET["socid"]; $socid = $_GET["socid"];
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }

View File

@ -34,8 +34,8 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
$socid = $_GET["socid"]; $socid = $_GET["socid"];
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }