2
0
forked from Wavyzz/dolibarr

Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer
2020-02-02 18:34:09 +00:00
parent ffa847bc8e
commit 9781c20f84
4 changed files with 809 additions and 809 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -285,7 +285,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
DOL_URL_ROOT.'/don/list.php?leftmenu=donations'
);
// Translation lang files
$langfile=array(
$langfile = array(
"users",
"companies",
"prospects",
@@ -359,87 +359,87 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$dashboardlines = array();
// Do not include sections without management permission
require_once DOL_DOCUMENT_ROOT . '/core/class/workboardresponse.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
// Number of actions to do (late)
if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) {
include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$board = new ActionComm($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of project opened
if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$board = new Project($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of tasks to do (late)
if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) {
include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$board = new Task($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of commercial proposals opened (expired)
if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$board = new Propal($db);
$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed");
$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
}
// Number of commercial proposals opened (expired)
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$board = new SupplierProposal($db);
$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed");
$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
}
// Number of customer orders a deal
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$board = new Commande($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of suppliers orders a deal
if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$board = new CommandeFournisseur($db);
$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element . '_awaiting'] = $board->load_board($user, 'awaiting');
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element.'_awaiting'] = $board->load_board($user, 'awaiting');
}
// Number of services enabled (delayed)
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$board = new Contrat($db);
$dashboardlines[$board->element . '_inactive'] = $board->load_board($user, "inactive");
$dashboardlines[$board->element.'_inactive'] = $board->load_board($user, "inactive");
// Number of active services (expired)
$dashboardlines[$board->element . '_active'] = $board->load_board($user, "active");
$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
}
// Number of invoices customers (has paid)
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$board = new Facture($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of supplier invoices (has paid)
if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$board = new FactureFournisseur($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of transactions to conciliate
if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid) {
include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$board = new Account($db);
$nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
if ($nb > 0) {
@@ -449,36 +449,36 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
// Number of cheque to send
if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
$board = new RemiseCheque($db);
$dashboardlines['RemiseCheque'] = $board->load_board($user);
}
// Number of foundation members
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) {
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$board = new Adherent($db);
$dashboardlines[$board->element . '_shift'] = $board->load_board($user, 'shift');
$dashboardlines[$board->element . '_expired'] = $board->load_board($user, 'expired');
$dashboardlines[$board->element.'_shift'] = $board->load_board($user, 'shift');
$dashboardlines[$board->element.'_expired'] = $board->load_board($user, 'expired');
}
// Number of expense reports to approve
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board = new ExpenseReport($db);
$dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove');
}
// Number of expense reports to pay
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board = new ExpenseReport($db);
$dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay');
}
// Number of holidays to approve
if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) {
include_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php';
include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$board = new Holiday($db);
$dashboardlines['Holiday'] = $board->load_board($user);
}
@@ -877,23 +877,23 @@ print '<div class="fichecenter fichecenterbis">';
* Show boxes
*/
$boxlist.='<div class="twocolumns">';
$boxlist .= '<div class="twocolumns">';
$boxlist.='<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if(!empty($nbworkboardcount))
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if (!empty($nbworkboardcount))
{
$boxlist.=$boxwork;
$boxlist .= $boxwork;
}
$boxlist.=$resultboxes['boxlista'];
$boxlist .= $resultboxes['boxlista'];
$boxlist.= '</div>';
$boxlist .= '</div>';
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{
// Remove allready present info in new dash board
if(!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0){
if (!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0) {
foreach ($boxstatItems as $boxstatItemKey => $boxstatItemHtml) {
if (in_array($boxstatItemKey, $globalStatInTopOpenedDashBoard)) {
unset($boxstatItems[$boxstatItemKey]);

View File

@@ -34,54 +34,54 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
if (! empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
if (! empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
if (! empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
if (! empty($conf->salaries->enabled)) require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (!empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
if (!empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
if (!empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
if (!empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
if (!empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
if (!empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
if (!empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
if (!empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
if (!empty($conf->salaries->enabled)) require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
// Load translation files required by the page
$langs->loadLangs(array('projects', 'companies', 'suppliers', 'compta'));
if (! empty($conf->facture->enabled)) $langs->load("bills");
if (! empty($conf->commande->enabled)) $langs->load("orders");
if (! empty($conf->propal->enabled)) $langs->load("propal");
if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
if (! empty($conf->deplacement->enabled)) $langs->load("trips");
if (! empty($conf->expensereport->enabled)) $langs->load("trips");
if (! empty($conf->don->enabled)) $langs->load("donations");
if (! empty($conf->loan->enabled)) $langs->load("loan");
if (! empty($conf->salaries->enabled)) $langs->load("salaries");
if (!empty($conf->facture->enabled)) $langs->load("bills");
if (!empty($conf->commande->enabled)) $langs->load("orders");
if (!empty($conf->propal->enabled)) $langs->load("propal");
if (!empty($conf->ficheinter->enabled)) $langs->load("interventions");
if (!empty($conf->deplacement->enabled)) $langs->load("trips");
if (!empty($conf->expensereport->enabled)) $langs->load("trips");
if (!empty($conf->don->enabled)) $langs->load("donations");
if (!empty($conf->loan->enabled)) $langs->load("loan");
if (!empty($conf->salaries->enabled)) $langs->load("salaries");
$id=GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
$datesrfc=GETPOST('datesrfc');
$dateerfc=GETPOST('dateerfc');
$dates=dol_mktime(0, 0, 0, GETPOST('datesmonth'), GETPOST('datesday'), GETPOST('datesyear'));
$datee=dol_mktime(23, 59, 59, GETPOST('dateemonth'), GETPOST('dateeday'), GETPOST('dateeyear'));
if (empty($dates) && ! empty($datesrfc)) $dates=dol_stringtotime($datesrfc);
if (empty($datee) && ! empty($dateerfc)) $datee=dol_stringtotime($dateerfc);
if (! isset($_POST['datesrfc']) && ! isset($_POST['datesday']) && ! empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR))
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$datesrfc = GETPOST('datesrfc');
$dateerfc = GETPOST('dateerfc');
$dates = dol_mktime(0, 0, 0, GETPOST('datesmonth'), GETPOST('datesday'), GETPOST('datesyear'));
$datee = dol_mktime(23, 59, 59, GETPOST('dateemonth'), GETPOST('dateeday'), GETPOST('dateeyear'));
if (empty($dates) && !empty($datesrfc)) $dates = dol_stringtotime($datesrfc);
if (empty($datee) && !empty($dateerfc)) $datee = dol_stringtotime($dateerfc);
if (!isset($_POST['datesrfc']) && !isset($_POST['datesday']) && !empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR))
{
$new=dol_now();
$tmp=dol_getdate($new);
$new = dol_now();
$tmp = dol_getdate($new);
//$datee=$now
//$dates=dol_time_plus_duree($datee, -1, 'y');
$dates=dol_get_first_day($tmp['year'], 1);
$dates = dol_get_first_day($tmp['year'], 1);
}
if ($id == '' && $ref == '')
{
@@ -90,16 +90,16 @@ if ($id == '' && $ref == '')
exit();
}
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
// Security check
$socid=$object->socid;
$socid = $object->socid;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $object->id, 'projet&project');
@@ -163,23 +163,23 @@ print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
@@ -510,19 +510,19 @@ $listofreferent = array(
*/
);
$parameters=array('listofreferent'=>$listofreferent);
$parameters = array('listofreferent'=>$listofreferent);
$resHook = $hookmanager->executeHooks('completeListOfReferent', $parameters, $object, $action);
if(!empty($hookmanager->resArray)) {
if (!empty($hookmanager->resArray)) {
$listofreferent = array_merge($listofreferent, $hookmanager->resArray);
}
if ($action=="addelement")
if ($action == "addelement")
{
$tablename = GETPOST("tablename");
$elementselectid = GETPOST("elementselect");
$result=$object->update_element($tablename, $elementselectid);
if ($result<0)
$result = $object->update_element($tablename, $elementselectid);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -549,7 +549,7 @@ $showdatefilter = 0;
if (!$showdatefilter)
{
print '<div class="center centpercent">';
print '<form action="'.$_SERVER["PHP_SELF"].'?id=' . $object->id . '" method="post">';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION["newtoken"].'">';
print '<input type="hidden" name="tablename" value="'.$tablename.'">';
print '<input type="hidden" name="action" value="view">';
@@ -590,53 +590,53 @@ print '</tr>';
foreach ($listofreferent as $key => $value)
{
$name=$langs->trans($value['name']);
$title=$value['title'];
$classname=$value['class'];
$tablename=$value['table'];
$datefieldname=$value['datefieldname'];
$qualified=$value['test'];
$name = $langs->trans($value['name']);
$title = $value['title'];
$classname = $value['class'];
$tablename = $value['table'];
$datefieldname = $value['datefieldname'];
$qualified = $value['test'];
$margin = $value['margin'];
$project_field = $value['project_field'];
if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'plus')
{
$element = new $classname($db);
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field)?$project_field:'fk_projet');
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet');
if (count($elementarray)>0 && is_array($elementarray))
if (count($elementarray) > 0 && is_array($elementarray))
{
$total_ht = 0;
$total_ttc = 0;
$num=count($elementarray);
$num = count($elementarray);
for ($i = 0; $i < $num; $i++)
{
$tmp=explode('_', $elementarray[$i]);
$idofelement=$tmp[0];
$idofelementuser=$tmp[1];
$tmp = explode('_', $elementarray[$i]);
$idofelement = $tmp[0];
$idofelementuser = $tmp[1];
$element->fetch($idofelement);
if ($idofelementuser) $elementuser->fetch($idofelementuser);
// Define if record must be used for total or not
$qualifiedfortotal=true;
$qualifiedfortotal = true;
if ($key == 'invoice')
{
if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type == Facture::TYPE_DEPOSIT) $qualifiedfortotal=false; // If hidden option to use deposits as payment (deprecated, not recommended to use this), deposits are not included
if (!empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal = false; // Replacement invoice, do not include into total
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type == Facture::TYPE_DEPOSIT) $qualifiedfortotal = false; // If hidden option to use deposits as payment (deprecated, not recommended to use this), deposits are not included
}
if ($key == 'propal')
{
if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal=false; // Refused proposal must not be included in total
if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal = false; // Refused proposal must not be included in total
}
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
// Define $total_ht_by_line
if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ht_by_line=$element->amount;
elseif ($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ht_by_line = $element->amount;
elseif ($tablename == 'fichinter') $total_ht_by_line = $element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ht_by_line = $element->price * abs($element->qty);
elseif ($tablename == 'projet_task')
{
if ($idofelementuser)
@@ -759,49 +759,49 @@ foreach ($listofreferent as $key => $value)
$element = new $classname($db);
$addform='';
$addform = '';
$idtofilterthirdparty=0;
$idtofilterthirdparty = 0;
$array_of_element_linkable_with_different_thirdparty = array('facture_fourn', 'commande_fournisseur');
if (! in_array($tablename, $array_of_element_linkable_with_different_thirdparty))
if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty))
{
$idtofilterthirdparty=$object->thirdparty->id;
if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
$idtofilterthirdparty = $object->thirdparty->id;
if (!empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty .= ','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
}
if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element))
{
$selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300', -2, !empty($project_field)?$project_field:'fk_projet');
if ($selectList<0)
$selectList = $formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300', -2, !empty($project_field) ? $project_field : 'fk_projet');
if ($selectList < 0)
{
setEventMessages($formproject->error, $formproject->errors, 'errors');
}
elseif($selectList)
elseif ($selectList)
{
// Define form with the combo list of elements to link
$addform.='<div class="inline-block valignmiddle">';
$addform.='<form action="'.$_SERVER["PHP_SELF"].'?id=' . $object->id . '" method="post">';
$addform.='<input type="hidden" name="token" value="'.$_SESSION["newtoken"].'">';
$addform.='<input type="hidden" name="tablename" value="'.$tablename.'">';
$addform.='<input type="hidden" name="action" value="addelement">';
$addform.='<input type="hidden" name="datesrfc" value="'.dol_print_date($dates, 'dayhourrfc').'">';
$addform.='<input type="hidden" name="dateerfc" value="'.dol_print_date($datee, 'dayhourrfc').'">';
$addform.='<table><tr><td>'.$langs->trans("SelectElement").'</td>';
$addform.='<td>'.$selectList.'</td>';
$addform.='<td><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("AddElement")).'"></td>';
$addform.='</tr></table>';
$addform.='</form>';
$addform.='</div>';
$addform .= '<div class="inline-block valignmiddle">';
$addform .= '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
$addform .= '<input type="hidden" name="token" value="'.$_SESSION["newtoken"].'">';
$addform .= '<input type="hidden" name="tablename" value="'.$tablename.'">';
$addform .= '<input type="hidden" name="action" value="addelement">';
$addform .= '<input type="hidden" name="datesrfc" value="'.dol_print_date($dates, 'dayhourrfc').'">';
$addform .= '<input type="hidden" name="dateerfc" value="'.dol_print_date($datee, 'dayhourrfc').'">';
$addform .= '<table><tr><td>'.$langs->trans("SelectElement").'</td>';
$addform .= '<td>'.$selectList.'</td>';
$addform .= '<td><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("AddElement")).'"></td>';
$addform .= '</tr></table>';
$addform .= '</form>';
$addform .= '</div>';
}
}
if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew)
{
$addform.='<div class="inline-block valignmiddle">';
if ($testnew) $addform.='<a class="buttonxxx" href="'.$urlnew.'"><span class="valignmiddle text-plus-circle">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
$addform .= '<div class="inline-block valignmiddle">';
if ($testnew) $addform .= '<a class="buttonxxx" href="'.$urlnew.'"><span class="valignmiddle text-plus-circle">'.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
$addform.='<a class="buttonxxx buttonRefused" disabled="disabled" href="#"><span class="valignmiddle text-plus-circle">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
$addform .= '<a class="buttonxxx buttonRefused" disabled="disabled" href="#"><span class="valignmiddle text-plus-circle">'.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
$addform.='<div>';
$addform .= '<div>';
}
print load_fiche_titre($langs->trans($title), $addform, '');
@@ -827,7 +827,7 @@ foreach ($listofreferent as $key => $value)
else print $langs->trans("ThirdParty");
print '</td>';
// Duration of intervention
if($tablename == 'fichinter')
if ($tablename == 'fichinter')
{
print '<td>';
print $langs->trans("TotalDuration");
@@ -915,7 +915,7 @@ foreach ($listofreferent as $key => $value)
{
if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin) // PROJECT_DISABLE_UNLINK_FROM_OVERVIEW is empty by defaut, so this test true
{
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=unlink&tablename=' . $tablename . '&elementselect=' . $element->id . ($project_field ? '&projectfield=' . $project_field : '') . '" class="reposition">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=unlink&tablename='.$tablename.'&elementselect='.$element->id.($project_field ? '&projectfield='.$project_field : '').'" class="reposition">';
print img_picto($langs->trans('Unlink'), 'unlink');
print '</a>';
}
@@ -1033,7 +1033,7 @@ foreach ($listofreferent as $key => $value)
print '</td>';
// Add duration and store it in counter for fichinter
if($tablename == 'fichinter')
if ($tablename == 'fichinter')
{
print '<td>';
print convertSecondToTime($element->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
@@ -1085,9 +1085,9 @@ foreach ($listofreferent as $key => $value)
if ($othermessage) print $othermessage;
if (isset($total_ht_by_line))
{
if (! $qualifiedfortotal) print '<strike>';
if (!$qualifiedfortotal) print '<strike>';
print price($total_ht_by_line);
if (! $qualifiedfortotal) print '</strike>';
if (!$qualifiedfortotal) print '</strike>';
}
if ($warning) print ' '.img_warning($warning);
print '</td>';
@@ -1132,9 +1132,9 @@ foreach ($listofreferent as $key => $value)
if ($othermessage) print $othermessage;
if (isset($total_ttc_by_line))
{
if (! $qualifiedfortotal) print '<strike>';
if (!$qualifiedfortotal) print '<strike>';
print price($total_ttc_by_line);
if (! $qualifiedfortotal) print '</strike>';
if (!$qualifiedfortotal) print '</strike>';
}
if ($warning) print ' '.img_warning($warning);
print '</td>';
@@ -1219,7 +1219,7 @@ foreach ($listofreferent as $key => $value)
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
// If fichinter add the total_duration
if($tablename == 'fichinter') print '<td class="left">'.convertSecondToTime($total_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
if ($tablename == 'fichinter') print '<td class="left">'.convertSecondToTime($total_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
print '<td class="right">';
if (empty($value['disableamount']))
{

View File

@@ -1420,16 +1420,16 @@ class User extends CommonObject
$result = $this->create($user);
if ($result > 0)
{
if (! empty($this->pass)) { // If a clear password was received (this situation should not happen anymore now), we use it to save it into database
if (!empty($this->pass)) { // If a clear password was received (this situation should not happen anymore now), we use it to save it into database
$newpass = $this->setPassword($user, $this->pass);
if (is_numeric($newpass) && $newpass < 0) $result = -2;
} elseif (! empty($this->pass_crypted)) { // If a crypted password is already known, we save it directly into database because the previous create did not save it.
} elseif (!empty($this->pass_crypted)) { // If a crypted password is already known, we save it directly into database because the previous create did not save it.
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql .= " SET pass_crypted = '".$this->db->escape($this->pass_crypted)."'";
$sql .= " WHERE rowid=".$this->id;
$resql = $this->db->query($sql);
if (! $resql)
if (!$resql)
{
$result = -1;
}