Skip to content

Commit

Permalink
Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/fichinter/stats/index.php
  • Loading branch information
eldy committed Nov 8, 2018
2 parents 6401a7a + 8a89da2 commit 3e844db
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 78 deletions.
80 changes: 44 additions & 36 deletions htdocs/comm/remx.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
print '<div class="fichecenter">';

print '<div class="underbanner clearboth"></div>';

if(! $isCustomer && ! $isSupplier) {
print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>';

Expand All @@ -266,8 +266,8 @@
$db->close();
exit;
}


print '<table class="border centpercent">';

if($isCustomer) { // Calcul avoirs client en cours
Expand All @@ -293,7 +293,7 @@

print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$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>';
Expand Down Expand Up @@ -322,10 +322,10 @@
{
dol_print_error($db);
}

print '<tr><td class="titlefield">'.$langs->trans("SupplierAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$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>';
Expand All @@ -344,20 +344,20 @@
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" />';
}

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 ' &nbsp; <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>';
Expand Down Expand Up @@ -401,7 +401,7 @@
/*
* Liste remises fixes client restant en cours (= liees a aucune facture ni ligne de facture)
*/

print load_fiche_titre($langs->trans("DiscountStillRemaining"));

if($isCustomer) {
Expand All @@ -424,10 +424,11 @@
$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
Expand All @@ -439,17 +440,17 @@
print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td width="50">&nbsp;</td>';
print '</tr>';

$showconfirminfo=array();

$i = 0;
$num = $db->num_rows($resql);
if ($num > 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))
Expand Down Expand Up @@ -502,7 +503,7 @@
}
else print '<td>&nbsp;</td>';
print '</tr>';

if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
{
$showconfirminfo['rowid']=$obj->rowid;
Expand All @@ -517,7 +518,8 @@
}
$db->free($resql);
print "</table>";

print '</div>';

if (count($showconfirminfo))
{
$amount1=price2num($showconfirminfo['amount_ttc']/2,'MT');
Expand Down Expand Up @@ -561,10 +563,11 @@
$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
Expand All @@ -576,17 +579,17 @@
print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td width="50">&nbsp;</td>';
print '</tr>';

$showconfirminfo=array();

$i = 0;
$num = $db->num_rows($resql);
if ($num > 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))
Expand Down Expand Up @@ -639,7 +642,7 @@
}
else print '<td>&nbsp;</td>';
print '</tr>';

if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
{
$showconfirminfo['rowid']=$obj->rowid;
Expand All @@ -654,7 +657,8 @@
}
$db->free($resql);
print "</table>";

print '</div>';

if (count($showconfirminfo))
{
$amount1=price2num($showconfirminfo['amount_ttc']/2,'MT');
Expand All @@ -673,19 +677,19 @@
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) {
Expand Down Expand Up @@ -730,12 +734,13 @@
$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
Expand All @@ -747,7 +752,7 @@
print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
print '<td width="50">&nbsp;</td>';
print '</tr>';

$tab_sqlobj=array();
$tab_sqlobjOrder=array();
$num = $db->num_rows($resql);
Expand All @@ -761,7 +766,7 @@
}
}
$db->free($resql);

$num = $db->num_rows($resql2);
for ($i = 0;$i < $num;$i++)
{
Expand All @@ -771,7 +776,7 @@
}
$db->free($resql2);
array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);

$num = count($tab_sqlobj);
if ($num > 0)
{
Expand Down Expand Up @@ -830,8 +835,9 @@
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}

print "</table>";
print '</div>';
}
else
{
Expand Down Expand Up @@ -882,12 +888,13 @@
$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
Expand All @@ -899,7 +906,7 @@
print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
print '<td width="50">&nbsp;</td>';
print '</tr>';

$tab_sqlobj=array();
$tab_sqlobjOrder=array();
$num = $db->num_rows($resql);
Expand All @@ -913,7 +920,7 @@
}
}
$db->free($resql);

$num = $db->num_rows($resql2);
for ($i = 0;$i < $num;$i++)
{
Expand All @@ -923,7 +930,7 @@
}
$db->free($resql2);
array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);

$num = count($tab_sqlobj);
if ($num > 0)
{
Expand Down Expand Up @@ -982,8 +989,9 @@
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}

print "</table>";
print '</div>';
}
else
{
Expand Down
4 changes: 3 additions & 1 deletion htdocs/commande/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@
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";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formprojet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ function selectOpportunityStatus($htmlname, $preselected='-1', $showempty=1, $us
$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
{
Expand Down
4 changes: 0 additions & 4 deletions htdocs/core/class/translate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,6 @@ private function getTradFromKey($key)
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))
{
Expand Down
6 changes: 4 additions & 2 deletions htdocs/core/lib/company.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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">';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modProduct.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function __construct($db)
'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').')';
}

Expand Down

0 comments on commit 3e844db

Please sign in to comment.