Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/fichinter/stats/index.php
This commit is contained in:
commit
3e844db74f
@ -254,7 +254,7 @@ if ($socid > 0)
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
if(! $isCustomer && ! $isSupplier) {
|
||||
print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>';
|
||||
|
||||
@ -266,8 +266,8 @@ if ($socid > 0)
|
||||
$db->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
if($isCustomer) { // Calcul avoirs client en cours
|
||||
@ -293,7 +293,7 @@ if ($socid > 0)
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
|
||||
print '<td>'.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||
|
||||
|
||||
if (! empty($user->fk_soc)) // No need to show this for external users
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
|
||||
@ -322,10 +322,10 @@ if ($socid > 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SupplierAbsoluteDiscountAllUsers").'</td>';
|
||||
print '<td>'.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||
|
||||
|
||||
if (! empty($user->fk_soc)) // No need to show this for external users
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("SupplierAbsoluteDiscountMy").'</td>';
|
||||
@ -344,11 +344,11 @@ if ($socid > 0)
|
||||
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
if($isCustomer && ! $isSupplier) {
|
||||
print '<input type="hidden" name="discount_type" value="0" />';
|
||||
}
|
||||
|
||||
|
||||
if(! $isCustomer && $isSupplier) {
|
||||
print '<input type="hidden" name="discount_type" value="1" />';
|
||||
}
|
||||
@ -356,8 +356,8 @@ if ($socid > 0)
|
||||
print '<table class="border" width="100%">';
|
||||
if($isCustomer && $isSupplier) {
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>';
|
||||
print '<td><input type="radio" name="discount_type" id="discount_type_0" selected value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
|
||||
print ' <input type="radio" name="discount_type" id="discount_type_1" selected value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
|
||||
print '<td><input type="radio" name="discount_type" id="discount_type_0" checked="checked" value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
|
||||
print ' <input type="radio" name="discount_type" id="discount_type_1" value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("AmountHT").'</td>';
|
||||
@ -401,7 +401,7 @@ if ($socid > 0)
|
||||
/*
|
||||
* Liste remises fixes client restant en cours (= liees a aucune facture ni ligne de facture)
|
||||
*/
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("DiscountStillRemaining"));
|
||||
|
||||
if($isCustomer) {
|
||||
@ -424,10 +424,11 @@ if ($socid > 0)
|
||||
$sql.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
|
||||
$sql.= " AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
|
||||
$sql.= " ORDER BY rc.datec DESC";
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
||||
@ -439,9 +440,9 @@ if ($socid > 0)
|
||||
print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$showconfirminfo=array();
|
||||
|
||||
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
@ -449,7 +450,7 @@ if ($socid > 0)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
|
||||
if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
|
||||
@ -502,7 +503,7 @@ if ($socid > 0)
|
||||
}
|
||||
else print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
|
||||
{
|
||||
$showconfirminfo['rowid']=$obj->rowid;
|
||||
@ -517,7 +518,8 @@ if ($socid > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (count($showconfirminfo))
|
||||
{
|
||||
$amount1=price2num($showconfirminfo['amount_ttc']/2,'MT');
|
||||
@ -561,10 +563,11 @@ if ($socid > 0)
|
||||
$sql.= " AND rc.discount_type = 1"; // Eliminate customer discounts
|
||||
$sql.= " AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
|
||||
$sql.= " ORDER BY rc.datec DESC";
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
||||
@ -576,9 +579,9 @@ if ($socid > 0)
|
||||
print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$showconfirminfo=array();
|
||||
|
||||
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
@ -586,7 +589,7 @@ if ($socid > 0)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
|
||||
if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
|
||||
@ -639,7 +642,7 @@ if ($socid > 0)
|
||||
}
|
||||
else print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
|
||||
{
|
||||
$showconfirminfo['rowid']=$obj->rowid;
|
||||
@ -654,7 +657,8 @@ if ($socid > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (count($showconfirminfo))
|
||||
{
|
||||
$amount1=price2num($showconfirminfo['amount_ttc']/2,'MT');
|
||||
@ -673,19 +677,19 @@ if ($socid > 0)
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if($isCustomer) {
|
||||
if ($isCustomer) {
|
||||
print '</div>'; // class="ficheaddleft"
|
||||
print '</div>'; // class="fichehalfright"
|
||||
print '</div>'; // class="fichecenter"
|
||||
}
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
/*
|
||||
* List discount consumed (=liees a une ligne de facture ou facture)
|
||||
*/
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("DiscountAlreadyCounted"));
|
||||
|
||||
if($isCustomer) {
|
||||
@ -730,12 +734,13 @@ if ($socid > 0)
|
||||
$sql2.= " AND rc.fk_user = u.rowid";
|
||||
$sql2.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
|
||||
$sql2.= " ORDER BY dc DESC";
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql2=null;
|
||||
if ($resql) $resql2=$db->query($sql2);
|
||||
if ($resql2)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
||||
@ -747,7 +752,7 @@ if ($socid > 0)
|
||||
print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$tab_sqlobj=array();
|
||||
$tab_sqlobjOrder=array();
|
||||
$num = $db->num_rows($resql);
|
||||
@ -761,7 +766,7 @@ if ($socid > 0)
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
$num = $db->num_rows($resql2);
|
||||
for ($i = 0;$i < $num;$i++)
|
||||
{
|
||||
@ -771,7 +776,7 @@ if ($socid > 0)
|
||||
}
|
||||
$db->free($resql2);
|
||||
array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);
|
||||
|
||||
|
||||
$num = count($tab_sqlobj);
|
||||
if ($num > 0)
|
||||
{
|
||||
@ -830,8 +835,9 @@ if ($socid > 0)
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -882,12 +888,13 @@ if ($socid > 0)
|
||||
$sql2.= " AND rc.fk_user = u.rowid";
|
||||
$sql2.= " AND rc.discount_type = 1"; // Eliminate customer discounts
|
||||
$sql2.= " ORDER BY dc DESC";
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql2=null;
|
||||
if ($resql) $resql2=$db->query($sql2);
|
||||
if ($resql2)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
||||
@ -899,7 +906,7 @@ if ($socid > 0)
|
||||
print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$tab_sqlobj=array();
|
||||
$tab_sqlobjOrder=array();
|
||||
$num = $db->num_rows($resql);
|
||||
@ -913,7 +920,7 @@ if ($socid > 0)
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
$num = $db->num_rows($resql2);
|
||||
for ($i = 0;$i < $num;$i++)
|
||||
{
|
||||
@ -923,7 +930,7 @@ if ($socid > 0)
|
||||
}
|
||||
$db->free($resql2);
|
||||
array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);
|
||||
|
||||
|
||||
$num = count($tab_sqlobj);
|
||||
if ($num > 0)
|
||||
{
|
||||
@ -982,8 +989,9 @@ if ($socid > 0)
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -466,7 +466,9 @@ if ($resql)
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="SendOrderRef";
|
||||
|
||||
@ -654,7 +654,7 @@ class FormProjets
|
||||
$sellist .= '>';
|
||||
if ($useshortlabel)
|
||||
{
|
||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatusShort".$obj->code) != "OppStatusShort".$obj->code ? $langs->transnoentitiesnoconv("OppStatusShort".$obj->code) : $obj->label);
|
||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -562,10 +562,6 @@ class Translate
|
||||
elseif (preg_match('/^PaymentTypeShort([0-9A-Z]+)$/i',$key,$reg))
|
||||
{
|
||||
$newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle','',1);
|
||||
}
|
||||
elseif (preg_match('/^OppStatusShort([0-9A-Z]+)$/i',$key,$reg))
|
||||
{
|
||||
$newstr=$this->getLabelFromKey($db,$reg[1],'c_lead_status','code','label');
|
||||
}
|
||||
elseif (preg_match('/^OppStatus([0-9A-Z]+)$/i',$key,$reg))
|
||||
{
|
||||
|
||||
@ -120,6 +120,7 @@ function societe_prepare_head(Societe $object)
|
||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as n";
|
||||
$sql.= " WHERE fk_soc = ".$object->id;
|
||||
$sql.= " AND entity IN (".getEntity('project').")";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -739,11 +740,12 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
|
||||
print '<div class="div-table-responsive">';
|
||||
print "\n".'<table class="noborder" width=100%>';
|
||||
|
||||
$sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount";
|
||||
$sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount";
|
||||
$sql .= ", cls.code as opp_status_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid";
|
||||
$sql .= " WHERE p.fk_soc = ".$object->id;
|
||||
$sql .= " AND p.entity IN (".getEntity('project').")";
|
||||
$sql .= " ORDER BY p.dateo DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
@ -799,7 +801,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
|
||||
print '</td>';
|
||||
// Opp status
|
||||
print '<td align="center">';
|
||||
if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code);
|
||||
if ($obj->opp_status_code) print $langs->trans("OppStatus".$obj->opp_status_code);
|
||||
print '</td>';
|
||||
// Opp percent
|
||||
print '<td align="right">';
|
||||
|
||||
@ -239,7 +239,7 @@ class modProduct extends DolibarrModules
|
||||
'pr.date_price'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ $WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
$mode='customer';
|
||||
if ($mode == 'customer' && ! $user->rights->ficheinter->lire) accessforbidden();
|
||||
if (! $user->rights->ficheinter->lire) accessforbidden();
|
||||
|
||||
$userid=GETPOST('userid','int');
|
||||
$socid=GETPOST('socid','int');
|
||||
@ -50,7 +50,7 @@ $endyear=$year;
|
||||
$object_status=GETPOST('object_status');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("interventions","suppliers","companies","other"));
|
||||
$langs->loadLangs(array('interventions', 'companies', 'other', 'suppliers'));
|
||||
|
||||
|
||||
/*
|
||||
@ -60,11 +60,8 @@ $langs->loadLangs(array("interventions","suppliers","companies","other"));
|
||||
$form=new Form($db);
|
||||
$objectstatic=new FichInter($db);
|
||||
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$title=$langs->trans("InterventionStatistics");
|
||||
$dir=$conf->ficheinter->dir_temp;
|
||||
}
|
||||
$title=$langs->trans("InterventionStatistics");
|
||||
$dir=$conf->ficheinter->dir_temp;
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
@ -77,19 +74,18 @@ if ($object_status != '' && $object_status > -1) $stats->where .= ' AND c.fk_sta
|
||||
|
||||
// Build graphic number of object
|
||||
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filenamenb = $dir.'/interventionsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filenamenb = $dir.'/interventionsnbinyear-'.$year.'.png';
|
||||
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$year.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px1 = new DolGraph();
|
||||
@ -121,20 +117,17 @@ if (! $mesg)
|
||||
|
||||
// Build graphic amount of object
|
||||
$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filenameamount = $dir.'/interventionsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstatssupplier&file=interventionsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filenameamount = $dir.'/interventionsamountinyear-'.$year.'.png';
|
||||
if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstatssupplier&file=interventionsamountinyear-'.$year.'.png';
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px2 = new DolGraph();
|
||||
@ -169,14 +162,12 @@ $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filename_avg = $dir.'/interventionsaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstatssupplier&file=interventionsaverage-'.$user->id.'-'.$year.'.png';
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$user->id.'-'.$year.'.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename_avg = $dir.'/interventionsaverage-'.$year.'.png';
|
||||
if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstatssupplier&file=interventionsaverage-'.$year.'.png';
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$year.'.png';
|
||||
}
|
||||
|
||||
$px3 = new DolGraph();
|
||||
@ -219,13 +210,12 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||
|
||||
$h=0;
|
||||
$head = array();
|
||||
$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php?mode='.$mode;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/fichinter/stats/index.php';
|
||||
$head[$h][1] = $langs->trans("ByMonthYear");
|
||||
$head[$h][2] = 'byyear';
|
||||
$h++;
|
||||
|
||||
if ($mode == 'customer') $type='order_stats';
|
||||
if ($mode == 'supplier') $type='supplier_order_stats';
|
||||
$type = 'fichinter_stats';
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,$type);
|
||||
|
||||
@ -244,9 +234,8 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
|
||||
$filter = 's.client in (1,2,3)';
|
||||
print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"');
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
|
||||
@ -288,7 +277,8 @@ foreach ($data as $val)
|
||||
{
|
||||
$year = $val['year'];
|
||||
while (! empty($year) && $oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
{
|
||||
// If we have empty year
|
||||
$oldyear--;
|
||||
|
||||
print '<tr class="oddeven" height="24">';
|
||||
|
||||
@ -203,6 +203,11 @@ if ($socid > 0)
|
||||
$marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ;
|
||||
$markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ;
|
||||
|
||||
$sign = '';
|
||||
if ($objp->type == Facture::TYPE_CREDIT_NOTE){
|
||||
$sign = '-';
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$invoicestatic->id=$objp->facid;
|
||||
@ -213,11 +218,11 @@ if ($socid > 0)
|
||||
print dol_print_date($db->jdate($objp->datef),'day')."</td>";
|
||||
print "<td align=\"right\">".price($objp->selling_price, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price(($objp->type == 2 ? -1 : 1) * $objp->buying_price, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->marge, null, null, null, null, $rounding)."</td>\n";
|
||||
print "<td align=\"right\">".$sign.price($objp->marge, null, null, null, null, $rounding)."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':$sign.price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
||||
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -600,7 +600,7 @@ if (! empty($arrayfields['p.public']['checked']))
|
||||
if (! empty($arrayfields['p.fk_opp_status']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowrap center">';
|
||||
print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 1, 1, 0, 'maxwidth100');
|
||||
print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.opp_amount']['checked']))
|
||||
@ -809,7 +809,7 @@ while ($i < min($num,$limit))
|
||||
if (! empty($arrayfields['p.fk_opp_status']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code);
|
||||
if ($obj->opp_status_code) print $langs->trans("OppStatus".$obj->opp_status_code);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -477,7 +477,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
|
||||
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
|
||||
$contactsofproject=(! empty($object->id)?$object->getListContactId('internal'):'');
|
||||
if (count($contactsofproject))
|
||||
if (is_array($contactsofproject) && count($contactsofproject))
|
||||
{
|
||||
print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
}
|
||||
|
||||
@ -948,6 +948,24 @@ class Societe extends CommonObject
|
||||
// We don't check when update called during a create because verify was already done.
|
||||
// For a merge, we suppose source data is clean and a customer code of a deleted thirdparty must be accepted into a target thirdparty with empty code without duplicate error
|
||||
$result = $this->verify();
|
||||
|
||||
// If there is only one error and error is ErrorBadCustomerCodeSyntax and we don't change customer code, we allow the update
|
||||
// So we can update record that were using and old numbering rule.
|
||||
if (is_array($this->errors))
|
||||
{
|
||||
if (in_array('ErrorBadCustomerCodeSyntax', $this->errors) && is_object($this->oldcopy) && $this->oldcopy->code_client == $this->code_client)
|
||||
{
|
||||
if (($key = array_search('ErrorBadCustomerCodeSyntax', $this->errors)) !== false) unset($this->errors[$key]); // Remove error message
|
||||
}
|
||||
if (in_array('ErrorBadSupplierCodeSyntax', $this->errors) && is_object($this->oldcopy) && $this->oldcopy->code_fournisseur == $this->code_fournisseur)
|
||||
{
|
||||
if (($key = array_search('ErrorBadSupplierCodeSyntax', $this->errors)) !== false) unset($this->errors[$key]); // Remove error message
|
||||
}
|
||||
if (empty($this->errors)) // If there is no more error, we can make like if there is no error at all
|
||||
{
|
||||
$result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
@ -1509,7 +1527,7 @@ class Societe extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove links to subsidiaries companies
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user