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

Conflicts:
	htdocs/core/class/rssparser.class.php
	htdocs/langs/en_US/boxes.lang
This commit is contained in:
Laurent Destailleur 2018-09-27 12:55:25 +02:00
commit 62b31df069
11 changed files with 79 additions and 46 deletions

View File

@ -328,20 +328,20 @@ if ($action == 'edit' || $action == 'updateedit')
// Name
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
print '<input name="nom" id="name" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
// Addresse
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS: GETPOST("MAIN_INFO_SOCIETE_ADDRESS",'nohtml')) . '</textarea></td></tr>'."\n";
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:GETPOST("MAIN_INFO_SOCIETE_ADDRESS",'nohtml')) . '</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha')) . '"></td></tr>'."\n";
print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP:GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml')) . '"></td></tr>'."\n";
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN:GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml')) . '"></td></tr>'."\n";
// Country
@ -363,29 +363,29 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_SOCIETE_TEL . '"></td></tr>';
print '<input name="tel" id="phone" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL) . '"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_SOCIETE_FAX . '"></td></tr>';
print '<input name="fax" id="fax" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX) . '"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_SOCIETE_MAIL . '"></td></tr>';
print '<input name="mail" id="email" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL) . '"></td></tr>';
print '</td></tr>'."\n";
// Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_SOCIETE_WEB . '"></td></tr>';
print '<input name="web" id="web" class="minwidth300" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB) . '"></td></tr>';
print '</td></tr>'."\n";
// Barcode
if (! empty($conf->barcode->enabled)) {
print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
print '<input name="barcode" id="barcode" class="minwidth150" value="'. $conf->global->MAIN_INFO_SOCIETE_GENCOD . '"></td></tr>';
print '<input name="barcode" id="barcode" class="minwidth150" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD) . '"></td></tr>';
print '</td></tr>';
}
@ -424,19 +424,19 @@ if ($action == 'edit' || $action == 'updateedit')
// Managing Director(s)
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '"></td></tr>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS) . '"></td></tr>';
// GDPR contact
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
print '</td><td>';
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="' . $conf->global->MAIN_INFO_GDPR . '"></td></tr>';
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_GDPR) . '"></td></tr>';
// Capital
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
print '<input name="capital" id="capital" class="minwidth100" value="' . $conf->global->MAIN_INFO_CAPITAL . '"></td></tr>';
print '<input name="capital" id="capital" class="minwidth100" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL) . '"></td></tr>';
// Juridical Status
@ -455,7 +455,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
print '<input name="siren" id="profid1" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '') . '">';
print '<input name="siren" id="profid1" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '') . '">';
}
else
{
@ -471,7 +471,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
print '<input name="siret" id="profid2" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '' ) . '">';
print '<input name="siret" id="profid2" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '' ) . '">';
}
else
{
@ -487,7 +487,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
print '<input name="ape" id="profid3" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '') . '">';
print '<input name="ape" id="profid3" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '') . '">';
}
else
{
@ -503,7 +503,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
print '<input name="rcs" id="profid4" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '') . '">';
print '<input name="rcs" id="profid4" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '') . '">';
}
else
{
@ -519,7 +519,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '') . '">';
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '') . '">';
}
else
{
@ -535,7 +535,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '') . '">';
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '') . '">';
}
else
{
@ -547,7 +547,7 @@ if ($action == 'edit' || $action == 'updateedit')
// TVA Intra
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
print '<input name="tva" id="intra_vat" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
print '<input name="tva" id="intra_vat" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
print '</td></tr>';
// Object of the company

View File

@ -96,7 +96,7 @@ $usefilter=0;
$listofsessions=listOfSessions();
$num=count($listofsessions);
print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup');
print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'', $num, ($num?$num:''),'setup'); // Do not show numer (0) if no session found (it means we can't know)
$savehandler=ini_get("session.save_handler");
$savepath=ini_get("session.save_path");

View File

@ -954,6 +954,8 @@ if (empty($reshook))
if($facture_source->type == Facture::TYPE_SITUATION)
{
$source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id
$line->fk_prev_id = $line->id; // Credit note line need to be linked to the situation invoice it is create from
if(!empty($facture_source->tab_previous_situation_invoice))
{
@ -977,7 +979,7 @@ if (empty($reshook))
$maxPrevSituationPercent = 0;
foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{
if($prevLine->id == $line->fk_prev_id)
if($prevLine->id == $source_fk_prev_id)
{
$maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent);
@ -1535,7 +1537,8 @@ if (empty($reshook))
$line->origin = $object->origin;
$line->origin_id = $line->id;
$line->fetch_optionals($line->id);
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
if ($line->fk_remise_except)
{

View File

@ -4913,9 +4913,10 @@ class FactureLigne extends CommonInvoiceLine
* Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
*
* @param int $invoiceid Invoice id
* @param bool $include_credit_note Include credit note or not
* @return int >= 0
*/
function get_prev_progress($invoiceid)
function get_prev_progress($invoiceid, $include_credit_note=true)
{
// phpcs:enable
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
@ -4930,7 +4931,26 @@ class FactureLigne extends CommonInvoiceLine
$resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) {
$res = $this->db->fetch_array($resql);
return floatval($res['situation_percent']);
$returnPercent = floatval($res['situation_percent']);
if($include_credit_note) {
$sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd';
$sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) ';
$sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id;
$sql.= ' AND f.situation_cycle_ref = '.$tmpinvoice->situation_cycle_ref; // Prevent cycle outed
$sql.= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE;
$res = $this->db->query($sql);
if($res) {
while($obj = $this->db->fetch_object($res)) {
$returnPercent = $returnPercent + floatval($obj->situation_percent);
}
}
}
return $returnPercent;
} else {
$this->error = $this->db->error();
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);

View File

@ -732,7 +732,7 @@ while ($i < min($num,$limit))
// Job position
if (! empty($arrayfields['p.poste']['checked']))
{
print '<td>'.dol_trunc($obj->poste,20).'</td>';
print '<td class="tdoverflowmax100">'.$obj->poste.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Zip

View File

@ -389,13 +389,17 @@ class CMailFile
// TODO if (! empty($moreinheader)) ...
// Give the message a subject
$this->message->setSubject($this->encodetorfc2822($subject));
try {
$result = $this->message->setSubject($subject);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
// Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (! empty($from)) {
try {
$this->message->setFrom($this->getArrayAddress($from));
$result = $this->message->setFrom($this->getArrayAddress($from));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
@ -404,7 +408,7 @@ class CMailFile
// Set the To addresses with an associative array
if (! empty($to)) {
try {
$this->message->setTo($this->getArrayAddress($to));
$result = $this->message->setTo($this->getArrayAddress($to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
@ -412,13 +416,17 @@ class CMailFile
if (! empty($replyto)) {
try {
$this->message->SetReplyTo($this->getArrayAddress($replyto));
$result = $this->message->SetReplyTo($this->getArrayAddress($replyto));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
$this->message->setCharSet($conf->file->character_set_client);
try {
$result = $this->message->setCharSet($conf->file->character_set_client);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
if (! empty($this->html))
{

View File

@ -3422,7 +3422,7 @@ class Form
if ($obj->situation_final != 1) {
//Not prov?
if (substr($obj->facnumber, 1, 4) != 'PROV') {
if ($selected == $obj->situation_final) {
if ($selected == $obj->rowid) {
$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->facnumber . '</option>';
} else {
$opt .= '<option value="' . $obj->rowid . '">' . $obj->facnumber . '</option>';

View File

@ -763,7 +763,7 @@ function xml2php($xml)
}
//Let see if the new child is not in the array
if ($tab==false && in_array($key,array_keys($array)))
if ($tab === false && in_array($key,array_keys($array)))
{
//If this element is already in the array we will create an indexed array
$tmp = $array[$key];
@ -772,7 +772,7 @@ function xml2php($xml)
$array[$key][] = $child;
$tab = true;
}
elseif($tab == true)
elseif($tab === true)
{
//Add an element in an existing array
$array[$key][] = $child;

View File

@ -172,7 +172,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 0"; // Limit to products
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture;
}
else
@ -213,7 +213,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 0"; // Limit to products
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
@ -320,7 +320,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture;
}
else
@ -361,7 +361,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
@ -465,7 +465,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = -1";
$sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
$sql.= " ORDER BY e.rowid";
if (! $sql)
@ -641,7 +641,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 0"; // Limit to products
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture;
}
else
@ -682,7 +682,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 0"; // Limit to products
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
@ -789,7 +789,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture;
}
else
@ -830,7 +830,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
@ -934,7 +934,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = -1";
$sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
$sql.= " ORDER BY e.rowid";
if (! $sql)

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -42,7 +43,7 @@ print '});'."\n";
print '$("#show-'.$blocname.'").click(function(){'."\n";
print ' setShowHide(1);'."\n";
print ' $("#'.$blocname.'").show("blind", {direction: "vertical"}, 300).addClass("nohideobject");'."\n";
print ' $("#'.$blocname.'_bloc").show("blind", {direction: "vertical"}, 300).addClass("nohideobject");'."\n";
print ' $(this).hide();'."\n";
print ' $("#hide-'.$blocname.'").show();'."\n";
print '});'."\n";

View File

@ -190,6 +190,7 @@ if ($action == 'order' && isset($_POST['valid']))
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " WHERE fk_soc = ".$suppliersid[$i];
$sql.= " AND source = 42 AND fk_statut = 0";
$sql.= " AND entity IN (".getEntity('commande_fournisseur').")";
$sql.= " ORDER BY date_creation DESC";
$resql = $db->query($sql);
if($resql && $db->num_rows($resql) > 0) {