16 changes: 8 additions & 8 deletions htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Expand Up @@ -1315,27 +1315,27 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}

if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
}
}

if (! empty($conf->global->PDF_SHOW_PROJECT))
if (!empty($conf->global->PDF_SHOW_PROJECT))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
}
}

Expand Down
18 changes: 9 additions & 9 deletions htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
Expand Up @@ -621,7 +621,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
{
// We found a page break
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
Expand Down Expand Up @@ -1475,27 +1475,27 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}

if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
}
}

if (! empty($conf->global->PDF_SHOW_PROJECT))
if (!empty($conf->global->PDF_SHOW_PROJECT))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
}
}

Expand Down
268 changes: 134 additions & 134 deletions htdocs/core/modules/dons/html_cerfafr.modules.php

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -494,7 +494,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
$curY = $tab_top_newpage;

// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
Expand Down Expand Up @@ -539,7 +539,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
// We found a page break

// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
Expand Down Expand Up @@ -1051,15 +1051,15 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');

// Show online payment link
$useonlinepayment = ((! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
$useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
global $langs;

$langs->loadLangs(array('payment', 'paybox'));
$servicename=$langs->transnoentities('Online');
$servicename = $langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';

$pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
}
Expand Down Expand Up @@ -1707,27 +1707,27 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}

if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
}
}

if (! empty($conf->global->PDF_SHOW_PROJECT))
if (!empty($conf->global->PDF_SHOW_PROJECT))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
}
}

Expand Down
16 changes: 8 additions & 8 deletions htdocs/core/modules/facture/doc/pdf_sponge.modules.php
Expand Up @@ -1963,27 +1963,27 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}

if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
}
}

if (! empty($conf->global->PDF_SHOW_PROJECT))
if (!empty($conf->global->PDF_SHOW_PROJECT))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
}
}

Expand Down
378 changes: 189 additions & 189 deletions htdocs/core/modules/modCategorie.class.php

Large diffs are not rendered by default.

178 changes: 89 additions & 89 deletions htdocs/core/modules/modProjet.class.php

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions htdocs/core/modules/propale/doc/pdf_azur.modules.php
Expand Up @@ -502,7 +502,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
$curY = $tab_top_newpage;

// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
Expand Down Expand Up @@ -548,7 +548,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
// We found a page break

// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
Expand Down Expand Up @@ -1101,28 +1101,28 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
//Local tax 1 before VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
//{
foreach($this->localtax1 as $localtax_type => $localtax_rate)
foreach ($this->localtax1 as $localtax_type => $localtax_rate)
{
if (in_array((string) $localtax_type, array('1','3','5'))) continue;
if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;

foreach($localtax_rate as $tvakey => $tvaval)
foreach ($localtax_rate as $tvakey => $tvaval)
{
if ($tvakey!=0) // On affiche pas taux 0
if ($tvakey != 0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;

$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);

$tvacompl='';
$tvacompl = '';
if (preg_match('/\*/', $tvakey))
{
$tvakey=str_replace('*', '', $tvakey);
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
Expand All @@ -1133,13 +1133,13 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
//Local tax 2 before VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
foreach($this->localtax2 as $localtax_type => $localtax_rate)
foreach ($this->localtax2 as $localtax_type => $localtax_rate)
{
if (in_array((string) $localtax_type, array('1','3','5'))) continue;
if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;

foreach($localtax_rate as $tvakey => $tvaval)
foreach ($localtax_rate as $tvakey => $tvaval)
{
if ($tvakey!=0) // On affiche pas taux 0
if ($tvakey != 0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;

Expand All @@ -1148,15 +1148,15 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);

$tvacompl='';
$tvacompl = '';
if (preg_match('/\*/', $tvakey))
{
$tvakey=str_replace('*', '', $tvakey);
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
Expand Down Expand Up @@ -1192,11 +1192,11 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
//Local tax 1 after VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
//{
foreach($this->localtax1 as $localtax_type => $localtax_rate)
foreach ($this->localtax1 as $localtax_type => $localtax_rate)
{
if (in_array((string) $localtax_type, array('2','4','6'))) continue;
if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;

foreach($localtax_rate as $tvakey => $tvaval)
foreach ($localtax_rate as $tvakey => $tvaval)
{
if ($tvakey != 0) // On affiche pas taux 0
{
Expand All @@ -1205,16 +1205,16 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);

$tvacompl='';
$tvacompl = '';
if (preg_match('/\*/', $tvakey))
{
$tvakey=str_replace('*', '', $tvakey);
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';

$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
Expand All @@ -1224,11 +1224,11 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
//Local tax 2 after VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
foreach($this->localtax2 as $localtax_type => $localtax_rate)
foreach ($this->localtax2 as $localtax_type => $localtax_rate)
{
if (in_array((string) $localtax_type, array('2','4','6'))) continue;
if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;

foreach($localtax_rate as $tvakey => $tvaval)
foreach ($localtax_rate as $tvakey => $tvaval)
{
// retrieve global local tax
if ($tvakey != 0) // On affiche pas taux 0
Expand All @@ -1238,16 +1238,16 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);

$tvacompl='';
$tvacompl = '';
if (preg_match('/\*/', $tvakey))
{
$tvakey=str_replace('*', '', $tvakey);
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';

$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
Expand Down Expand Up @@ -1476,7 +1476,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
if ($this->emetteur->logo)
{
$logodir = $conf->mycompany->dir_output;
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
Expand Down Expand Up @@ -1528,27 +1528,27 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}

if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
}
}

if (! empty($conf->global->PDF_SHOW_PROJECT))
if (!empty($conf->global->PDF_SHOW_PROJECT))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
}
}

Expand Down
20 changes: 10 additions & 10 deletions htdocs/core/modules/propale/doc/pdf_cyan.modules.php
Expand Up @@ -594,7 +594,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
$curY = $tab_top_newpage;

// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
Expand Down Expand Up @@ -640,7 +640,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
{
// We found a page break
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
Expand Down Expand Up @@ -1588,27 +1588,27 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}

if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
}
}

if (! empty($conf->global->PDF_SHOW_PROJECT))
if (!empty($conf->global->PDF_SHOW_PROJECT))
{
$object->fetch_projet();
if (! empty($object->project->ref))
if (!empty($object->project->ref))
{
$posy+=3;
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
}
}

Expand Down
18 changes: 9 additions & 9 deletions htdocs/fourn/class/fournisseur.commande.class.php
Expand Up @@ -185,7 +185,7 @@ class CommandeFournisseur extends CommonOrder



public $fields=array(
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
Expand Down Expand Up @@ -455,11 +455,11 @@ public function fetch_lines($only_product = 0)
$sql .= " l.date_start, l.date_end,";
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
$sql.= ", pfp.rowid as fk_pfp, pfp.packaging";
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn";
$sql .= " WHERE l.fk_commande = ".$this->id;
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
$sql .= " ORDER BY l.rang, l.rowid";
Expand Down Expand Up @@ -516,7 +516,7 @@ public function fetch_lines($only_product = 0)
$line->packaging = $objp->packaging;
}

$line->date_start = $this->db->jdate($objp->date_start);
$line->date_start = $this->db->jdate($objp->date_start);
$line->date_end = $this->db->jdate($objp->date_end);
$line->fk_unit = $objp->fk_unit;

Expand Down Expand Up @@ -1701,7 +1701,7 @@ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txloca
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
{
$prod = new Product($this->db, $fk_product);
$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid));
$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid));
if ($qty < $prod->packaging)
{
$qty = $prod->packaging;
Expand All @@ -1710,7 +1710,7 @@ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txloca
{
if (($qty % $prod->packaging) > 0)
{
$coeff = intval($qty/$prod->packaging) + 1;
$coeff = intval($qty / $prod->packaging) + 1;
$qty = $prod->packaging * $coeff;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
}
Expand Down Expand Up @@ -2679,7 +2679,7 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $t
{
if (($qty % $this->line->packaging) > 0)
{
$coeff = intval($qty/$this->line->packaging) + 1;
$coeff = intval($qty / $this->line->packaging) + 1;
$qty = $this->line->packaging * $coeff;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
}
Expand Down Expand Up @@ -3451,11 +3451,11 @@ public function fetch($rowid)
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
$sql.= ", pfp.rowid as fk_pfp, pfp.packaging";
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
$sql .= ' WHERE cd.rowid = '.$rowid;
$result = $this->db->query($sql);
if ($result)
Expand Down
4 changes: 2 additions & 2 deletions htdocs/fourn/class/fournisseur.facture.class.php
Expand Up @@ -218,7 +218,7 @@ class FactureFournisseur extends CommonInvoice
public $fk_facture_source;


public $fields=array(
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
Expand Down Expand Up @@ -2287,7 +2287,7 @@ public function load_board($user)

if ($facturestatic->hasDelay()) {
$response->nbtodolate++;
$response->url_late=DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
}
}
$this->db->free($resql);
Expand Down
12 changes: 6 additions & 6 deletions htdocs/fourn/class/fournisseur.product.class.php
Expand Up @@ -360,7 +360,7 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn
$sql .= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
$sql .= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
$sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging = ".(empty($packaging) ? 1 : $packaging);
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", packaging = ".(empty($packaging) ? 1 : $packaging);
$sql .= " WHERE rowid = ".$this->product_fourn_price_id;
// TODO Add price_base_type and price_ttc

Expand Down Expand Up @@ -410,7 +410,7 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
$sql .= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,";
$sql .= "datec, fk_product, fk_soc, ref_fourn, desc_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation, barcode, fk_barcode_type)";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", packaging";
$sql .= " values(";
$sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
$sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
Expand Down Expand Up @@ -438,14 +438,14 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn
$sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
$sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging)) ;
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging));
$sql .= ")";

$this->product_fourn_price_id = 0;

$resql = $this->db->query($sql);
if ($resql) {
$this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price");
$this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price");
}
else {
$error++;
Expand Down Expand Up @@ -505,7 +505,7 @@ public function fetch_product_fournisseur_price($rowid, $ignore_expression = 0)
$sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,";
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
$sql .= " pfp.barcode, pfp.fk_barcode_type";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql .= " WHERE pfp.rowid = ".(int) $rowid;

Expand Down Expand Up @@ -609,7 +609,7 @@ public function list_product_fournisseur_price($prodid, $sortfield = '', $sortor
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
$sql .= " pfp.barcode, pfp.fk_barcode_type";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
$sql .= " AND pfp.fk_soc = s.rowid";
Expand Down
24 changes: 12 additions & 12 deletions htdocs/fourn/commande/index.php
Expand Up @@ -166,7 +166,7 @@
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE cf.fk_soc = s.rowid";
$sql.= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing
$sql .= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing
if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " GROUP BY cf.fk_statut";
Expand Down Expand Up @@ -253,23 +253,23 @@
*/

$sql = "SELECT";
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " DISTINCT";
}
$sql.= " u.rowid, u.lastname, u.firstname, u.email, u.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
$sql .= " u.rowid, u.lastname, u.firstname, u.email, u.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ((ug.fk_user = u.rowid";
$sql.= " AND ug.entity IN (".getEntity('usergroup')."))";
$sql.= " OR u.entity = 0)"; // Show always superadmin
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql .= " WHERE ((ug.fk_user = u.rowid";
$sql .= " AND ug.entity IN (".getEntity('usergroup')."))";
$sql .= " OR u.entity = 0)"; // Show always superadmin
}
else
{
$sql.= " WHERE (u.entity IN (".getEntity('user').")";
$sql .= " WHERE (u.entity IN (".getEntity('user').")";
}
$sql.= " AND u.fk_soc IS NULL"; // An external user can not approved
$sql .= " AND u.fk_soc IS NULL"; // An external user can not approved

$resql = $db->query($sql);
if ($resql)
Expand All @@ -290,7 +290,7 @@
$userstatic->id = $obj->rowid;
$userstatic->getrights('fournisseur');

if (! empty($userstatic->rights->fournisseur->commande->approuver))
if (!empty($userstatic->rights->fournisseur->commande->approuver))
{
print '<tr class="oddeven">';
print '<td>';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/fourn/facture/paiement.php
Expand Up @@ -301,8 +301,8 @@

$paiement->num_payment = GETPOST('num_paiement', 'alpha');
$paiement->note_private = GETPOST('comment', 'alpha');
$paiement->num_paiement = $paiement->num_payment; // For bacward compatibility
$paiement->note = $paiement->note_private; // For bacward compatibility
$paiement->num_paiement = $paiement->num_payment; // For bacward compatibility
$paiement->note = $paiement->note_private; // For bacward compatibility

if (!$error)
{
Expand Down
32 changes: 16 additions & 16 deletions htdocs/modulebuilder/template/mymoduleindex.php
Expand Up @@ -25,39 +25,39 @@
*/

// Load Dolibarr environment
$res=0;
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
if (!$res) die("Include of main fails");

require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';

// Load translation files required by the page
$langs->loadLangs(array("mymodule@mymodule"));

$action=GETPOST('action', 'alpha');
$action = GETPOST('action', 'alpha');


// Security check
//if (! $user->rights->mymodule->myobject->read) accessforbidden();
$socid=GETPOST('socid', 'int');
$socid = GETPOST('socid', 'int');
if (isset($user->socid) && $user->socid > 0)
{
$action = '';
$socid = $user->socid;
}

$max=5;
$now=dol_now();
$max = 5;
$now = dol_now();


/*
Expand Down Expand Up @@ -164,8 +164,8 @@
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';


$NBMAX=3;
$max=3;
$NBMAX = 3;
$max = 3;

/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
// Last modified myobject
Expand Down
8 changes: 4 additions & 4 deletions htdocs/mrp/class/mo.class.php
Expand Up @@ -624,7 +624,7 @@ public function updateProduction(User $user, $notrigger = true)
$moline->role = 'toproduce';
$moline->position = 1;

$resultline = $moline->create($user, false); // Never use triggers here
$resultline = $moline->create($user, false); // Never use triggers here
if ($resultline <= 0) {
$error++;
$this->error = $moline->error;
Expand All @@ -639,14 +639,14 @@ public function updateProduction(User $user, $notrigger = true)
if ($bom->id > 0)
{
// Lines to consume
if (! $error) {
if (!$error) {
foreach ($bom->lines as $line)
{
$moline = new MoLine($this->db);

$moline->fk_mo = $this->id;
if ($line->qty_frozen) {
$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
} else {
$moline->qty = round($line->qty * $this->qty / $bom->efficiency, 2);
}
Expand All @@ -662,7 +662,7 @@ public function updateProduction(User $user, $notrigger = true)
$moline->qty_frozen = $line->qty_frozen;
$moline->disable_stock_change = $line->disable_stock_change;

$resultline = $moline->create($user, false); // Never use triggers here
$resultline = $moline->create($user, false); // Never use triggers here
if ($resultline <= 0) {
$error++;
$this->error = $moline->error;
Expand Down
100 changes: 50 additions & 50 deletions htdocs/mrp/mo_movements.php
Expand Up @@ -670,57 +670,57 @@
print "</tr>\n";

print '<tr class="liste_titre">';
if (! empty($arrayfields['m.rowid']['checked']))
if (!empty($arrayfields['m.rowid']['checked']))
print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['m.datem']['checked']))
if (!empty($arrayfields['m.datem']['checked']))
print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.ref']['checked']))
if (!empty($arrayfields['p.ref']['checked']))
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.label']['checked']))
if (!empty($arrayfields['p.label']['checked']))
print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['m.batch']['checked']))
if (!empty($arrayfields['m.batch']['checked']))
print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['pl.eatby']['checked']))
if (!empty($arrayfields['pl.eatby']['checked']))
print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['pl.sellby']['checked']))
if (!empty($arrayfields['pl.sellby']['checked']))
print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['e.ref']['checked'])) {
if (!empty($arrayfields['e.ref']['checked'])) {
// We are on a specific warehouse card, no filter on other should be possible
print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder);
}
if (! empty($arrayfields['m.fk_user_author']['checked']))
if (!empty($arrayfields['m.fk_user_author']['checked']))
print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['m.inventorycode']['checked']))
if (!empty($arrayfields['m.inventorycode']['checked']))
print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['m.label']['checked']))
if (!empty($arrayfields['m.label']['checked']))
print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['m.type_mouvement']['checked']))
if (!empty($arrayfields['m.type_mouvement']['checked']))
print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['origin']['checked']))
if (!empty($arrayfields['origin']['checked']))
print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['m.value']['checked']))
if (!empty($arrayfields['m.value']['checked']))
print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['m.price']['checked']))
if (!empty($arrayfields['m.price']['checked']))
print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, '', $sortfield, $sortorder, 'right ');

// Extra fields
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';

// Hook fields
$parameters = array('arrayfields' => $arrayfields,'param' => $param,'sortfield' => $sortfield,'sortorder' => $sortorder);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['m.datec']['checked'])) {
if (!empty($arrayfields['m.datec']['checked'])) {
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
}
if (! empty($arrayfields['m.tms']['checked'])) {
if (!empty($arrayfields['m.tms']['checked'])) {
print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";

$resql = $db->query($sql);
if (! $resql) {
if (!$resql) {
dol_print_error($db);
}
$num = $db->num_rows($resql);
Expand Down Expand Up @@ -752,29 +752,29 @@
$warehousestatic->label = $objp->warehouse_ref;
$warehousestatic->lieu = $objp->lieu;

if (! empty($objp->fk_origin)) {
if (!empty($objp->fk_origin)) {
$origin = $objectlist->get_origin($objp->fk_origin, $objp->origintype);
} else {
$origin = '';
}

print '<tr class="oddeven">';
// Id movement
if (! empty($arrayfields['m.rowid']['checked'])) {
if (!empty($arrayfields['m.rowid']['checked'])) {
// This is primary not movement id
print '<td>' . $objp->mid . '</td>';
print '<td>'.$objp->mid.'</td>';
}
if (! empty($arrayfields['m.datem']['checked'])) {
if (!empty($arrayfields['m.datem']['checked'])) {
// Date
print '<td>' . dol_print_date($db->jdate($objp->datem), 'dayhour') . '</td>';
print '<td>'.dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>';
}
if (! empty($arrayfields['p.ref']['checked'])) {
if (!empty($arrayfields['p.ref']['checked'])) {
// Product ref
print '<td class="nowraponall">';
print $productstatic->getNomUrl(1, 'stock', 16);
print "</td>\n";
}
if (! empty($arrayfields['p.label']['checked'])) {
if (!empty($arrayfields['p.label']['checked'])) {
// Product label
print '<td>';
/*
Expand All @@ -786,74 +786,74 @@
print $productstatic->label;
print "</td>\n";
}
if (! empty($arrayfields['m.batch']['checked'])) {
if (!empty($arrayfields['m.batch']['checked'])) {
print '<td class="center nowraponall">';
if ($productlot->id > 0)
print $productlot->getNomUrl(1);
else
print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement.
print '</td>';
}
if (! empty($arrayfields['pl.eatby']['checked'])) {
print '<td class="center">' . dol_print_date($objp->eatby, 'day') . '</td>';
if (!empty($arrayfields['pl.eatby']['checked'])) {
print '<td class="center">'.dol_print_date($objp->eatby, 'day').'</td>';
}
if (! empty($arrayfields['pl.sellby']['checked'])) {
print '<td class="center">' . dol_print_date($objp->sellby, 'day') . '</td>';
if (!empty($arrayfields['pl.sellby']['checked'])) {
print '<td class="center">'.dol_print_date($objp->sellby, 'day').'</td>';
}
// Warehouse
if (! empty($arrayfields['e.ref']['checked'])) {
if (!empty($arrayfields['e.ref']['checked'])) {
print '<td>';
print $warehousestatic->getNomUrl(1);
print "</td>\n";
}
// Author
if (! empty($arrayfields['m.fk_user_author']['checked'])) {
if (!empty($arrayfields['m.fk_user_author']['checked'])) {
print '<td class="tdoverflowmax100">';
print $userstatic->getNomUrl(- 1);
print $userstatic->getNomUrl(-1);
print "</td>\n";
}
if (! empty($arrayfields['m.inventorycode']['checked'])) {
if (!empty($arrayfields['m.inventorycode']['checked'])) {
// Inventory code
print '<td>';
//print '<a href="' . DOL_URL_ROOT . '/product/stock/movement_card.php' . '?id=' . $objp->entrepot_id . '&amp;search_inventorycode=' . $objp->inventorycode . '&amp;search_type_mouvement=' . $objp->type_mouvement . '">';
print $objp->inventorycode;
//print '</a>';
print '</td>';
}
if (! empty($arrayfields['m.label']['checked'])) {
if (!empty($arrayfields['m.label']['checked'])) {
// Label of movement
print '<td class="tdoverflowmax100aaa">' . $objp->label . '</td>';
print '<td class="tdoverflowmax100aaa">'.$objp->label.'</td>';
}
if (! empty($arrayfields['m.type_mouvement']['checked'])) {
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
// Type of movement
switch ($objp->type_mouvement) {
case "0":
print '<td class="center">' . $langs->trans('StockIncreaseAfterCorrectTransfer') . '</td>';
print '<td class="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>';
break;
case "1":
print '<td class="center">' . $langs->trans('StockDecreaseAfterCorrectTransfer') . '</td>';
print '<td class="center">'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</td>';
break;
case "2":
print '<td class="center">' . $langs->trans('StockDecrease') . '</td>';
print '<td class="center">'.$langs->trans('StockDecrease').'</td>';
break;
case "3":
print '<td class="center">' . $langs->trans('StockIncrease') . '</td>';
print '<td class="center">'.$langs->trans('StockIncrease').'</td>';
break;
}
}
if (! empty($arrayfields['origin']['checked'])) {
if (!empty($arrayfields['origin']['checked'])) {
// Origin of movement
print '<td class="nowraponall">' . $origin . '</td>';
print '<td class="nowraponall">'.$origin.'</td>';
}
if (! empty($arrayfields['m.value']['checked'])) {
if (!empty($arrayfields['m.value']['checked'])) {
// Qty
print '<td class="right">';
if ($objp->qt > 0)
print '+';
print $objp->qty;
print '</td>';
}
if (! empty($arrayfields['m.price']['checked'])) {
if (!empty($arrayfields['m.price']['checked'])) {
// Price
print '<td class="right">';
if ($objp->price != 0)
Expand All @@ -867,11 +867,11 @@
$selected = 0;
if (in_array($obj->rowid, $arrayofselected))
$selected = 1;
print '<input id="cb' . $obj->rowid . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (! $i)
$totalarray['nbfield'] ++;
if (!$i)
$totalarray['nbfield']++;

print "</tr>\n";
$i++;
Expand Down
30 changes: 15 additions & 15 deletions htdocs/mrp/mo_production.php
Expand Up @@ -167,12 +167,12 @@

// Line to produce
$moline->fk_mo = $object->id;
$moline->qty = GETPOST('qtytoadd', 'int');;
$moline->qty = GETPOST('qtytoadd', 'int'); ;
$moline->fk_product = GETPOST('productidtoadd', 'int');
$moline->role = 'toconsume';
$moline->position = 0;

$resultline = $moline->create($user, false); // Never use triggers here
$resultline = $moline->create($user, false); // Never use triggers here
if ($resultline <= 0) {
$error++;
setEventMessages($moline->error, $molines->errors, 'errors');
Expand Down Expand Up @@ -546,7 +546,7 @@
dol_fiche_end();


if (! in_array($action, array('consumeorproduce', 'consumeandproduceall')))
if (!in_array($action, array('consumeorproduce', 'consumeandproduceall')))
{
print '<div class="tabsAction">';

Expand Down Expand Up @@ -700,14 +700,14 @@
if (!empty($object->lines))
{
$nblinetoconsume = 0;
foreach($object->lines as $line) {
foreach ($object->lines as $line) {
if ($line->role == 'toconsume') {
$nblinetoconsume++;
}
}

$nblinetoconsumecursor = 0;
foreach($object->lines as $line) {
foreach ($object->lines as $line) {
if ($line->role == 'toconsume') {
$nblinetoconsumecursor++;

Expand All @@ -716,7 +716,7 @@

$arrayoflines = $object->fetchLinesLinked('consumed', $line->id);
$alreadyconsumed = 0;
foreach($arrayoflines as $line2) {
foreach ($arrayoflines as $line2) {
$alreadyconsumed += $line2['qty'];
}

Expand Down Expand Up @@ -756,15 +756,15 @@
}
print ' '.$alreadyconsumed;
print '</td>';
print '<td>'; // Warehouse
print '<td>'; // Warehouse
print '</td>';
if ($conf->productbatch->enabled) {
print '<td></td>'; // Lot
}
print '</tr>';

// Show detailed of already consumed with js code to collapse
foreach($arrayoflines as $line2) {
foreach ($arrayoflines as $line2) {
print '<tr class="expanddetail'.$line->id.' hideobject opacitylow">';
print '<td>';
print dol_print_date($line2['date'], 'dayhour');
Expand Down Expand Up @@ -792,7 +792,7 @@
print '<tr>';
print '<td>'.$langs->trans("ToConsume").'</td>';
$preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed));
if ($action == 'consumeorproduce' && ! GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0;
if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0;
print '<td class="right"><input type="text" class="width50" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
print '<td></td>';
print '<td>';
Expand Down Expand Up @@ -851,14 +851,14 @@
if (!empty($object->lines))
{
$nblinetoproduce = 0;
foreach($object->lines as $line) {
foreach ($object->lines as $line) {
if ($line->role == 'toproduce') {
$nblinetoproduce++;
}
}

$nblinetoproducecursor = 0;
foreach($object->lines as $line) {
foreach ($object->lines as $line) {
if ($line->role == 'toproduce') {
$nblinetoproducecursor++;

Expand All @@ -867,7 +867,7 @@

$arrayoflines = $object->fetchLinesLinked('produced', $line->id);
$alreadyproduced = 0;
foreach($arrayoflines as $line2) {
foreach ($arrayoflines as $line2) {
$alreadyproduced += $line2['qty'];
}

Expand All @@ -894,15 +894,15 @@
}
print ' '.$alreadyproduced;
print '</td>';
print '<td>'; // Warehouse
print '<td>'; // Warehouse
print '</td>';
if ($conf->productbatch->enabled) {
print '<td></td>'; // Lot
}
print '</tr>';

// Show detailed of already consumed with js code to collapse
foreach($arrayoflines as $line2) {
foreach ($arrayoflines as $line2) {
print '<tr class="expanddetailtoproduce'.$line->id.' hideobject opacitylow">';
print '<td>';
print dol_print_date($line2['date'], 'dayhour');
Expand All @@ -928,7 +928,7 @@
print '<tr>';
print '<td>'.$langs->trans("ToProduce").'</td>';
$preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced));
if ($action == 'consumeorproduce' && ! GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0;
if ($action == 'consumeorproduce' && !GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0;
print '<td class="right"><input type="text" class="width50" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
print '<td></td>';
print '<td>';
Expand Down
162 changes: 81 additions & 81 deletions htdocs/product/admin/product.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions htdocs/product/class/product.class.php
Expand Up @@ -1724,7 +1724,7 @@ public function get_buyprice($prodfournprice, $qty, $product_id = 0, $fourn_ref
$sql .= " pfp.fk_product, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression";
$sql .= " ,pfp.default_vat_code";
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql .= " WHERE pfp.rowid = ".$prodfournprice;
if ($qty > 0) { $sql .= " AND pfp.quantity <= ".$qty;
Expand Down Expand Up @@ -1778,7 +1778,7 @@ public function get_buyprice($prodfournprice, $qty, $product_id = 0, $fourn_ref
$sql .= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.desc_fourn as desc_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression";
$sql .= " ,pfp.default_vat_code";
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql .= " WHERE pfp.fk_product = ".$product_id;
if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'";
Expand Down
6 changes: 3 additions & 3 deletions htdocs/product/dynamic_price/class/price_parser.class.php
Expand Up @@ -181,7 +181,7 @@ public function parseExpression($product, $expression, $values)
//Do processing
$res = $entry->process();
//Store any error or clear status if OK
$entry->update_status($res < 1?$entry->error:'', $user);
$entry->update_status($res < 1 ? $entry->error : '', $user);
}

//Get all global values
Expand Down Expand Up @@ -216,7 +216,7 @@ public function parseExpression($product, $expression, $values)
{
$data = explode($this->special_chr, $expression);
$variable = $this->special_chr.$data[1];
if (isset($data[2])) $variable.= $this->special_chr;
if (isset($data[2])) $variable .= $this->special_chr;
$this->error_parser = array(23, array($variable, $expression));
return -6;
}
Expand Down Expand Up @@ -276,7 +276,7 @@ public function parseProduct($product, $extra_values = array())
if ($res < 0) {
$this->error_parser = array(25, null);
return -1;
} elseif($res == 0){
} elseif ($res == 0) {
$supplier_min_price = 0;
} else {
$supplier_min_price = $productFournisseur->fourn_unitprice;
Expand Down
8 changes: 4 additions & 4 deletions htdocs/product/stock/class/mouvementstock.class.php
Expand Up @@ -77,7 +77,7 @@ class MouvementStock extends CommonObject
public $batch;


public $fields=array(
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10, 'showoncombobox'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'datem' =>array('type'=>'datetime', 'label'=>'Datem', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
Expand Down Expand Up @@ -376,8 +376,8 @@ public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price =
if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after
{
$fk_project = 0;
if(!empty($this->origin)) { // This is set by caller for tracking reason
$origintype = empty($this->origin->origin_type)?$this->origin->element:$this->origin->origin_type;
if (!empty($this->origin)) { // This is set by caller for tracking reason
$origintype = empty($this->origin->origin_type) ? $this->origin->element : $this->origin->origin_type;
$fk_origin = $this->origin->id;
if ($origintype == 'project') $fk_project = $fk_origin;
else
Expand Down Expand Up @@ -985,7 +985,7 @@ public function get_origin($fk_origin, $origintype)
$origintype_array = explode('@', $origintype);
$classname = ucfirst($origintype_array[0]);
$modulename = empty($origintype_array[1]) ? $classname : empty($origintype_array[1]);
$result=dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php');
$result = dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php');
if ($result)
{
$classname = ucfirst($classname);
Expand Down
22 changes: 11 additions & 11 deletions htdocs/product/stock/replenish.php
Expand Up @@ -160,7 +160,7 @@
$desc = $productsupplier->description;
}
$line->desc = $desc;
if (! empty($conf->global->MAIN_MULTILANGS))
if (!empty($conf->global->MAIN_MULTILANGS))
{
// TODO Get desc in language of thirdparty
}
Expand Down Expand Up @@ -362,8 +362,8 @@

if ($usevirtualstock)
{
if (! empty($conf->commande->enabled)) {
$sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd1.qty) IS NULL", "0", "SUM(cd1.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
if (!empty($conf->commande->enabled)) {
$sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd1.qty) IS NULL", "0", "SUM(cd1.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlCommandesCli .= " FROM ".MAIN_DB_PREFIX."commandedet as cd1, ".MAIN_DB_PREFIX."commande as c1";
$sqlCommandesCli .= " WHERE c1.rowid = cd1.fk_commande AND c1.entity IN (".getEntity('commande').")";
$sqlCommandesCli .= " AND cd1.fk_product = p.rowid";
Expand All @@ -372,8 +372,8 @@
$sqlCommandesCli = '0';
}

if (! empty($conf->expedition->enabled)) {
$sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
if (!empty($conf->expedition->enabled)) {
$sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commandedet as cd2";
Expand All @@ -384,16 +384,16 @@
$sqlExpeditionsCli = '0';
}

if (! empty($conf->fournisseur->enabled)) {
$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
if (!empty($conf->fournisseur->enabled)) {
$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,";
$sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3";
$sqlCommandesFourn .= " WHERE c3.rowid = cd3.fk_commande";
$sqlCommandesFourn .= " AND c3.entity IN (".getEntity('supplier_order').")";
$sqlCommandesFourn .= " AND cd3.fk_product = p.rowid";
$sqlCommandesFourn .= " AND c3.fk_statut IN (3,4))";

$sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd4.qty) IS NULL", "0", "SUM(fd4.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd4.qty) IS NULL", "0", "SUM(fd4.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlReceptionFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf4,";
$sqlReceptionFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd4";
$sqlReceptionFourn .= " WHERE fd4.fk_commande = cf4.rowid AND cf4.entity IN (".getEntity('supplier_order').")";
Expand All @@ -404,16 +404,16 @@
$sqlReceptionFourn = '0';
}

if (! empty($conf->mrp->enabled)) {
$sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
if (!empty($conf->mrp->enabled)) {
$sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlProductionToConsume .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,";
$sqlProductionToConsume .= " ".MAIN_DB_PREFIX."mrp_production as mp5";
$sqlProductionToConsume .= " WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity('mo').")";
$sqlProductionToConsume .= " AND mp5.fk_product = p.rowid";
$sqlProductionToConsume .= " AND mp5.role IN ('toconsume', 'consummed')";
$sqlProductionToConsume .= " AND mm5.status IN (1,2))";

$sqlProductionToProduce = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toproduce'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlProductionToProduce = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toproduce'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlProductionToProduce .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,";
$sqlProductionToProduce .= " ".MAIN_DB_PREFIX."mrp_production as mp5";
$sqlProductionToProduce .= " WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity('mo').")";
Expand Down
4 changes: 2 additions & 2 deletions htdocs/projet/card.php
Expand Up @@ -263,8 +263,8 @@
$object->socid = GETPOST('socid', 'int');
$object->description = GETPOST('description', 'none'); // Do not use 'alpha' here, we want field as it is
$object->public = GETPOST('public', 'alpha');
$object->date_start = (! GETPOST('projectstart')) ? '' : $date_start;
$object->date_end = (! GETPOST('projectend')) ? '' : $date_end;
$object->date_start = (!GETPOST('projectstart')) ? '' : $date_start;
$object->date_end = (!GETPOST('projectend')) ? '' : $date_end;
if (GETPOSTISSET('opp_amount')) $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
if (GETPOSTISSET('budget_amount')) $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
if (GETPOSTISSET('opp_status')) $object->opp_status = $opp_status;
Expand Down
22 changes: 11 additions & 11 deletions htdocs/projet/list.php
Expand Up @@ -131,7 +131,7 @@
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>103),
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>104),
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>105),
'opp_weighted_amount'=>array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>106),
'opp_weighted_amount'=>array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>106),
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
'p.usage_opportunity'=>array('label'=>$langs->trans("UsageOpportunity"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>115),
'p.usage_task'=>array('label'=>$langs->trans("UsageTasks"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_HIDE_TASKS ? 0 : 1), 'position'=>116),
Expand Down Expand Up @@ -847,16 +847,16 @@
$totalarray['val']['p.opp_amount'] += $obj->opp_amount;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.opp_amount';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount';
}
// Opp percent
if (! empty($arrayfields['p.opp_percent']['checked']))
if (!empty($arrayfields['p.opp_percent']['checked']))
{
print '<td class="right">';
if ($obj->opp_percent) print price($obj->opp_percent, 1, $langs, 1, 0).'%';
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (!$i) $totalarray['nbfield']++;
}
// Opp weighted amount
if (!empty($arrayfields['opp_weighted_amount']['checked']))
Expand All @@ -868,11 +868,11 @@
$totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount';
}
// Budget
if (! empty($arrayfields['p.budget_amount']['checked']))
if (!empty($arrayfields['p.budget_amount']['checked']))
{
print '<td class="right">';
if ($obj->budget_amount != '')
Expand All @@ -881,11 +881,11 @@
$totalarray['val']['p.budget_amount'] += $obj->budget_amount;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.budget_amount';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount';
}
// Usage opportunity
if (! empty($arrayfields['p.usage_opportunity']['checked']))
if (!empty($arrayfields['p.usage_opportunity']['checked']))
{
print '<td class="right">';
if ($obj->usage_opportunity)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/public/error-401.php
Expand Up @@ -21,7 +21,7 @@
Sorry. You are not allowed to access this resource.

<br>
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.':''; ?>
<?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.' : ''; ?>

<hr>

Expand Down
2 changes: 1 addition & 1 deletion htdocs/public/error-404.php
Expand Up @@ -21,7 +21,7 @@
You requested a website or a page that does not exists.

<br>
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.':''; ?>
<?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.' : ''; ?>

<hr>

Expand Down
62 changes: 31 additions & 31 deletions htdocs/societe/class/api_contacts.class.php
Expand Up @@ -74,7 +74,7 @@ public function get($id, $includecount = 0)
{
throw new RestException(401, 'No permission to read contacts');
}
if ($id ==0) {
if ($id == 0) {
$result = $this->contact->initAsSpecimen();
} else {
$result = $this->contact->fetch($id);
Expand All @@ -87,7 +87,7 @@ public function get($id, $includecount = 0)

if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
{
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

if ($includecount)
Expand Down Expand Up @@ -134,37 +134,37 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100,
$search_sale = DolibarrApiAccess::$user->id;

$sql = "SELECT t.rowid";
$sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX . "socpeople_extrafields as te ON te.fk_object = t.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as te ON te.fk_object = t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
// We need this table joined to the select in order to filter by sale
$sql.= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON t.fk_soc = s.rowid";
$sql.= ' WHERE t.entity IN (' . getEntity('socpeople') . ')';
if ($socids) $sql.= " AND t.fk_soc IN (" . $socids . ")";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON t.fk_soc = s.rowid";
$sql .= ' WHERE t.entity IN ('.getEntity('socpeople').')';
if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";

if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0)
$sql.= " AND t.fk_soc = sc.fk_soc";
$sql .= " AND t.fk_soc = sc.fk_soc";
if ($search_sale > 0)
$sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
$sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = " . $search_sale;
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}

$sql.= $db->order($sortfield, $sortorder);
$sql .= $db->order($sortfield, $sortorder);

if ($limit)
{
Expand All @@ -174,7 +174,7 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100,
}
$offset = $limit * $page;

$sql.= $db->plimit($limit + 1, $offset);
$sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
Expand All @@ -199,7 +199,7 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100,
}
}
else {
throw new RestException(503, 'Error when retrieve contacts : ' . $sql);
throw new RestException(503, 'Error when retrieve contacts : '.$sql);
}
if (!count($obj_ret))
{
Expand Down Expand Up @@ -255,7 +255,7 @@ public function put($id, $request_data = null)

if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
{
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

foreach ($request_data as $field => $value)
Expand Down Expand Up @@ -290,7 +290,7 @@ public function delete($id)

if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
{
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->contact->oldcopy = clone $this->contact;
return $this->contact->delete();
Expand Down Expand Up @@ -330,7 +330,7 @@ public function createUser($id, $request_data = null)
}

if (!DolibarrApi::_checkAccessToResource('contact', $contact->id, 'socpeople&societe')) {
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

// Check mandatory fields
Expand Down Expand Up @@ -362,7 +362,7 @@ public function createUser($id, $request_data = null)
*/
public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}

Expand Down Expand Up @@ -396,24 +396,24 @@ public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $
*/
public function addCategory($id, $category_id)
{
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
throw new RestException(401, 'Insufficient rights');
}

$result = $this->contact->fetch($id);
if (! $result) {
if (!$result) {
throw new RestException(404, 'Contact not found');
}
$category = new Categorie($this->db);
$result = $category->fetch($category_id);
if (! $result) {
if (!$result) {
throw new RestException(404, 'category not found');
}

if (! DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) {
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (! DolibarrApi::_checkAccessToResource('category', $category->id)) {
if (!DolibarrApi::_checkAccessToResource('category', $category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

Expand All @@ -436,24 +436,24 @@ public function addCategory($id, $category_id)
*/
public function deleteCategory($id, $category_id)
{
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
throw new RestException(401, 'Insufficient rights');
}

$result = $this->contact->fetch($id);
if( ! $result ) {
if (!$result) {
throw new RestException(404, 'Contact not found');
}
$category = new Categorie($this->db);
$result = $category->fetch($category_id);
if( ! $result ) {
if (!$result) {
throw new RestException(404, 'category not found');
}

if( ! DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) {
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! DolibarrApi::_checkAccessToResource('category', $category->id)) {
if (!DolibarrApi::_checkAccessToResource('category', $category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

Expand Down
324 changes: 162 additions & 162 deletions htdocs/societe/list.php

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions htdocs/societe/project.php
Expand Up @@ -35,7 +35,7 @@

// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) $socid=$user->socid;
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'societe', $socid, '&societe');

// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
Expand All @@ -46,8 +46,8 @@
* Actions
*/

$parameters=array('id'=>$socid);
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');


Expand All @@ -71,25 +71,25 @@
$object = new Societe($db);
$result = $object->fetch($socid);

$title=$langs->trans("Projects");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
$title = $langs->trans("Projects");
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$title;
llxHeader('', $title);

if (! empty($conf->notification->enabled)) $langs->load("mails");
if (!empty($conf->notification->enabled)) $langs->load("mails");
$head = societe_prepare_head($object);

dol_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company');

$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');

print '<div class="fichecenter">';

print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';

if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
}
Expand Down Expand Up @@ -126,7 +126,7 @@


// Projects list
$result=show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton);
$result = show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton);
}

// End of page
Expand Down
14 changes: 7 additions & 7 deletions htdocs/takepos/admin/setup.php
Expand Up @@ -265,17 +265,17 @@
print '<td colspan="2">';
$prod = new Product($db);
$array = [];
foreach($prod->fields as $k => $v) {
$array[$k]=$k;
foreach ($prod->fields as $k => $v) {
$array[$k] = $k;
}
print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD)?'rowid':$conf->global->TAKEPOS_SORTPRODUCTFIELD), 0);
print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0);
print "</td></tr>\n";

$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
$htmltext .= '</i>';
// Color theme
print '<tr class="oddeven"><td>';
print $langs->trans("ColorTheme");
Expand Down
2 changes: 1 addition & 1 deletion htdocs/theme/md/dropdown.inc.php
@@ -1,5 +1,5 @@
<?php
if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>

/* <style type="text/css" > dont remove this line it's an ide hack */
/*
Expand Down
4 changes: 2 additions & 2 deletions htdocs/website/class/website.class.php
Expand Up @@ -232,7 +232,7 @@ public function create(User $user, $notrigger = false)
$tmplangarray = explode(',', $this->otherlang);
if (is_array($tmplangarray)) {
dol_mkdir($conf->website->dir_output.'/'.$this->ref);
foreach($tmplangarray as $val) {
foreach ($tmplangarray as $val) {
if (trim($val) == $this->lang) continue;
dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val));
}
Expand Down Expand Up @@ -519,7 +519,7 @@ public function update(User $user, $notrigger = false)
$tmplangarray = explode(',', $this->otherlang);
if (is_array($tmplangarray)) {
dol_mkdir($conf->website->dir_output.'/'.$this->ref);
foreach($tmplangarray as $val) {
foreach ($tmplangarray as $val) {
if (trim($val) == $this->lang) continue;
dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val));
}
Expand Down
120 changes: 60 additions & 60 deletions htdocs/website/index.php
Expand Up @@ -24,7 +24,7 @@
define('NOSCANPOSTFORINJECTION', 1);
define('NOSTYLECHECK', 1);
define('USEDOLIBARREDITOR', 1);
define('FORCE_CKEDITOR', 1); // We need CKEditor, even if module is off.
define('FORCE_CKEDITOR', 1); // We need CKEditor, even if module is off.

//header('X-XSS-Protection:0'); // Disable XSS filtering protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated.

Expand All @@ -40,53 +40,53 @@
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';

$langs->loadLangs(array("admin","other","website","errors"));
$langs->loadLangs(array("admin", "other", "website", "errors"));

if (! $user->rights->website->read) accessforbidden();
if (!$user->rights->website->read) accessforbidden();

$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.

$error=0;
$websiteid=GETPOST('websiteid', 'int');
$websitekey=GETPOST('website', 'alpha');
$page=GETPOST('page', 'alpha');
$pageid=GETPOST('pageid', 'int');
$pageref=GETPOST('pageref', 'aZ09');
$action=GETPOST('action', 'aZ09');
$confirm=GETPOST('confirm', 'alpha');
$cancel=GETPOST('cancel', 'alpha');
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$error = 0;
$websiteid = GETPOST('websiteid', 'int');
$websitekey = GETPOST('website', 'alpha');
$page = GETPOST('page', 'alpha');
$pageid = GETPOST('pageid', 'int');
$pageref = GETPOST('pageref', 'aZ09');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')

$type_container=GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha');
$type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha');

$section_dir = GETPOST('section_dir', 'alpha');
$file_manager = GETPOST('file_manager', 'alpha');
$replacesite = GETPOST('replacesite', 'alpha');

if (GETPOST('deletesite', 'alpha')) { $action='deletesite'; }
if (GETPOST('delete', 'alpha')) { $action='delete'; }
if (GETPOST('preview', 'alpha')) $action='preview';
if (GETPOST('createsite', 'alpha')) { $action='createsite'; }
if (GETPOST('createcontainer', 'alpha')) { $action='createcontainer'; }
if (GETPOST('editcss', 'alpha')) { $action='editcss'; }
if (GETPOST('editmenu', 'alpha')) { $action='editmenu'; }
if (GETPOST('setashome', 'alpha')) { $action='setashome'; }
if (GETPOST('editmeta', 'alpha')) { $action='editmeta'; }
if (GETPOST('editsource', 'alpha')) { $action='editsource'; }
if (GETPOST('editcontent', 'alpha')) { $action='editcontent'; }
if (GETPOST('exportsite', 'alpha')) { $action='exportsite'; }
if (GETPOST('importsite', 'alpha')) { $action='importsite'; }
if (GETPOST('createfromclone', 'alpha')) { $action='createfromclone'; }
if (GETPOST('createpagefromclone', 'alpha')) { $action='createpagefromclone'; }
if (empty($action) && $file_manager) $action='file_manager';
if (empty($action) && $replacesite) $action='replacesite';
if (GETPOST('deletesite', 'alpha')) { $action = 'deletesite'; }
if (GETPOST('delete', 'alpha')) { $action = 'delete'; }
if (GETPOST('preview', 'alpha')) $action = 'preview';
if (GETPOST('createsite', 'alpha')) { $action = 'createsite'; }
if (GETPOST('createcontainer', 'alpha')) { $action = 'createcontainer'; }
if (GETPOST('editcss', 'alpha')) { $action = 'editcss'; }
if (GETPOST('editmenu', 'alpha')) { $action = 'editmenu'; }
if (GETPOST('setashome', 'alpha')) { $action = 'setashome'; }
if (GETPOST('editmeta', 'alpha')) { $action = 'editmeta'; }
if (GETPOST('editsource', 'alpha')) { $action = 'editsource'; }
if (GETPOST('editcontent', 'alpha')) { $action = 'editcontent'; }
if (GETPOST('exportsite', 'alpha')) { $action = 'exportsite'; }
if (GETPOST('importsite', 'alpha')) { $action = 'importsite'; }
if (GETPOST('createfromclone', 'alpha')) { $action = 'createfromclone'; }
if (GETPOST('createpagefromclone', 'alpha')) { $action = 'createpagefromclone'; }
if (empty($action) && $file_manager) $action = 'file_manager';
if (empty($action) && $replacesite) $action = 'replacesite';

if (GETPOST('refreshsite') || GETPOST('refreshsite_x') || GETPOST('refreshsite.x')) $pageid = 0;

// Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
Expand Down Expand Up @@ -267,9 +267,9 @@
*/

// Protections
if (GETPOST('refreshsite') || GETPOST('refreshsite_x') || GETPOST('refreshsite.x') || GETPOST('refreshpage') || GETPOST('refreshpage_x') || GETPOST('refreshpage.x'))
if (GETPOST('refreshsite') || GETPOST('refreshsite_x') || GETPOST('refreshsite.x') || GETPOST('refreshpage') || GETPOST('refreshpage_x') || GETPOST('refreshpage.x'))
{
$action = 'preview'; // To avoid to make an action on another page or another site when we click on button to select another site or page.
$action = 'preview'; // To avoid to make an action on another page or another site when we click on button to select another site or page.
}
if (GETPOST('refreshsite', 'alpha') || GETPOST('refreshsite.x', 'alpha') || GETPOST('refreshsite_x', 'alpha')) // If we change the site, we reset the pageid and cancel addsite action.
{
Expand All @@ -279,20 +279,20 @@
$pageid = $object->fk_default_home;
if (empty($pageid))
{
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
$array = $objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
if (!is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage = (is_array($array) && count($array) > 0);

$firstpageid=0; $homepageid=0;
foreach($array as $key => $valpage)
$firstpageid = 0; $homepageid = 0;
foreach ($array as $key => $valpage)
{
if (empty($firstpageid)) $firstpageid=$valpage->id;
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
if (empty($firstpageid)) $firstpageid = $valpage->id;
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid = $valpage->id;
}
$pageid=($homepageid?$homepageid:$firstpageid); // We choose home page and if not defined yet, we take first page
$pageid = ($homepageid ? $homepageid : $firstpageid); // We choose home page and if not defined yet, we take first page
}
}
if (GETPOST('refreshpage', 'alpha') && ! in_array($action, array('updatecss'))) $action='preview';
if (GETPOST('refreshpage', 'alpha') && !in_array($action, array('updatecss'))) $action = 'preview';

// Cancel
if ($cancel)
Expand Down Expand Up @@ -2033,8 +2033,8 @@

if (!GETPOST('hide_websitemenu'))
{
$disabled='';
if (empty($user->rights->website->write)) $disabled=' disabled="disabled"';
$disabled = '';
if (empty($user->rights->website->write)) $disabled = ' disabled="disabled"';

//var_dump($objectpage);exit;
print '<div class="centpercent websitebar">';
Expand Down Expand Up @@ -2078,19 +2078,19 @@

if ($websitekey)
{
$virtualurl='';
$dataroot=DOL_DATA_ROOT.'/website/'.$websitekey;
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
$virtualurl = '';
$dataroot = DOL_DATA_ROOT.'/website/'.$websitekey;
if (!empty($object->virtualhost)) $virtualurl = $object->virtualhost;
}

$array=array();
$array = array();
if ($object->id > 0)
{
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
$array = $objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
$object->lines = $array;
}
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
if (!is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage = (is_array($array) && count($array) > 0);

if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite'))
{
Expand Down Expand Up @@ -2709,7 +2709,7 @@ function switchEditorOnline(forceenable)

// Other languages
print '<tr><td class="tdtop">';
$htmltext= '';
$htmltext = '';
print $form->textwithpicto($langs->trans('OtherLanguages'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_OTHERLANG');
print '</td><td>';
print '<input type="text" class="flat" value="'.(GETPOSTISSET('WEBSITE_OTHERLANG') ? GETPOST('WEBSITE_OTHERLANG', 'alpha') : $object->otherlang).'" name="WEBSITE_OTHERLANG">';
Expand Down Expand Up @@ -3103,7 +3103,7 @@ function switchEditorOnline(forceenable)
else $onlykeys[$langs->defaultlang] = $langs->defaultlang;
if ($object->otherlang) {
$tmparray = explode(',', $object->otherlang);
foreach($tmparray as $key) {
foreach ($tmparray as $key) {
$tmpkey = trim($key);
if (strlen($key) == 2) {
$tmpkey = strtolower($key);
Expand All @@ -3112,7 +3112,7 @@ function switchEditorOnline(forceenable)
}
}
if (empty($object->lang) && empty($object->otherlang)) {
$onlykeys = null; // We keep full list of languages
$onlykeys = null; // We keep full list of languages
}
print $formadmin->select_language($pagelang ? $pagelang : '', 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200', 0, 0, 0, $onlykeys, 1);
$htmltext = $langs->trans("AvailableLanguagesAreDefinedIntoWebsiteProperties");
Expand Down Expand Up @@ -3439,7 +3439,7 @@ function switchEditorOnline(forceenable)
{
print '<tr>';
print '<td>'.$langs->trans("Container").' - ';
print $langs->trans($answerrecord->type_container); // TODO Use label of container
print $langs->trans($answerrecord->type_container); // TODO Use label of container
print '</td>';
print '<td>';
print $answerrecord->getNomUrl(1);
Expand Down Expand Up @@ -3476,7 +3476,7 @@ function switchEditorOnline(forceenable)
'website_readme'=>'WEBSITE_README',
'website_manifestjson'=>'WEBSITE_MANIFEST_JSON'
);
if (! empty($translateofrecordtype[$answerrecord['type']])) {
if (!empty($translateofrecordtype[$answerrecord['type']])) {
print $langs->trans($translateofrecordtype[$answerrecord['type']]);
} else {
print $answerrecord['type'];
Expand Down