2
0
forked from Wavyzz/dolibarr

Maxi debug for UTF8 support

This commit is contained in:
Laurent Destailleur
2008-10-28 23:36:36 +00:00
parent 3e8a91a1b1
commit 45d8c67e6c
14 changed files with 311 additions and 251 deletions

View File

@@ -102,7 +102,9 @@ if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes
$propal = new Propal($db); $propal = new Propal($db);
$propal->fetch($_GET['propalid']); $propal->fetch($_GET['propalid']);
$result = $propal->delete_product($_GET['lineid']); $result = $propal->delete_product($_GET['lineid']);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -123,7 +125,8 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
$result=$propal->valid($user); $result=$propal->valid($user);
if ($result >= 0) if ($result >= 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -199,7 +202,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
$propal->note = $_POST['note']; $propal->note = $_POST['note'];
$propal->ref = $_POST['ref']; $propal->ref = $_POST['ref'];
$propal->statut = 0; $propal->statut = 0;
$id = $propal->create_from($user); $id = $propal->create_from($user);
} }
else else
@@ -263,7 +266,8 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
$db->commit(); $db->commit();
// Generation document PDF // Generation document PDF
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -521,8 +525,8 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
$propal->fetch($_GET['propalid']); $propal->fetch($_GET['propalid']);
$propal->set_draft($user); $propal->set_draft($user);
//reg<65>n<EFBFBD>ration pdf $outputlangs = $langs;
if ($_REQUEST['lang_id']) if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -577,10 +581,10 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
{ {
$prod = new Product($db, $_POST['idprod']); $prod = new Product($db, $_POST['idprod']);
$prod->fetch($_POST['idprod']); $prod->fetch($_POST['idprod']);
$tva_tx = get_default_tva($mysoc,$propal->client,$prod->tva_tx); $tva_tx = get_default_tva($mysoc,$propal->client,$prod->tva_tx);
$tva_npr = get_default_npr($mysoc,$propal->client,$prod->tva_tx); $tva_npr = get_default_npr($mysoc,$propal->client,$prod->tva_tx);
// On defini prix unitaire // On defini prix unitaire
if ($conf->global->PRODUIT_MULTIPRICES == 1) if ($conf->global->PRODUIT_MULTIPRICES == 1)
{ {
@@ -608,7 +612,7 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
} }
} }
$desc = $prod->description; $desc = $prod->description;
$desc.= ($prod->description && $_POST['np_desc']) ? "\n" : ""; $desc.= ($prod->description && $_POST['np_desc']) ? "\n" : "";
$desc.= $_POST['np_desc']; $desc.= $_POST['np_desc'];
@@ -643,10 +647,11 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
$pu_ttc, $pu_ttc,
$info_bits $info_bits
); );
if ($result > 0) if ($result > 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -668,7 +673,7 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save")) if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
{ {
$propal = new Propal($db); $propal = new Propal($db);
if (! $propal->fetch($_POST['propalid']) > 0) if (! $propal->fetch($_POST['propalid']) > 0)
{ {
dolibarr_print_error($db,$propal->error); dolibarr_print_error($db,$propal->error);
exit; exit;
@@ -703,8 +708,9 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
$_POST['desc'], $_POST['desc'],
'HT', 'HT',
$info_bits); $info_bits);
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -725,7 +731,8 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
$propal->setDocModel($user, $_REQUEST['model']); $propal->setDocModel($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -793,13 +800,16 @@ if ($_GET['action'] == 'up' && $user->rights->propale->creer)
$propal = new Propal($db, '', $_GET["propalid"]); $propal = new Propal($db, '', $_GET["propalid"]);
$propal->fetch($_GET['propalid']); $propal->fetch($_GET['propalid']);
$propal->line_up($_GET['rowid']); $propal->line_up($_GET['rowid']);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']);
exit;
} }
if ($_GET['action'] == 'down' && $user->rights->propale->creer) if ($_GET['action'] == 'down' && $user->rights->propale->creer)
@@ -807,7 +817,9 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
$propal = new Propal($db, '', $_GET["propalid"]); $propal = new Propal($db, '', $_GET["propalid"]);
$propal->fetch($_GET['propalid']); $propal->fetch($_GET['propalid']);
$propal->line_down($_GET['rowid']); $propal->line_down($_GET['rowid']);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -1220,7 +1232,7 @@ if ($_GET['propalid'] > 0)
{ {
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):''; print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
} }
print '</td>'; print '</td>';
} }
else else
@@ -1282,7 +1294,7 @@ if ($_GET['propalid'] > 0)
print '<td align="right">'."\n"; print '<td align="right">'."\n";
print '<div id="calc_markup'.$i.'" style="display:none">'."\n"; print '<div id="calc_markup'.$i.'" style="display:none">'."\n";
print $formMarkup."\n"; print $formMarkup."\n";
print '</div>'."\n"; print '</div>'."\n";
@@ -1588,7 +1600,7 @@ if ($_GET['propalid'] > 0)
$html->select_produits('','idprod','',$conf->produit->limit_size); $html->select_produits('','idprod','',$conf->produit->limit_size);
} }
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>'; if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
// editeur wysiwyg // editeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{ {
@@ -1866,9 +1878,9 @@ else
$sortfield=$_GET['sortfield']; $sortfield=$_GET['sortfield'];
$page=$_GET['page']; $page=$_GET['page'];
$viewstatut=addslashes($_GET['viewstatut']); $viewstatut=addslashes($_GET['viewstatut']);
$propal_statut = addslashes($_GET['propal_statut']); $propal_statut = addslashes($_GET['propal_statut']);
if($propal_statut != '') if($propal_statut != '')
$viewstatut=$propal_statut; $viewstatut=$propal_statut;
if (! $sortfield) $sortfield='p.datep'; if (! $sortfield) $sortfield='p.datep';
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
@@ -1910,9 +1922,9 @@ else
if ($month > 0) if ($month > 0)
{ {
if ($year > 0) if ($year > 0)
$sql .= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; $sql .= " AND date_format(p.datep, '%Y-%m') = '$year-$month'";
else else
$sql .= " AND date_format(p.datep, '%m') = '$month'"; $sql .= " AND date_format(p.datep, '%m') = '$month'";
} }
if ($year > 0) if ($year > 0)
{ {
@@ -1930,14 +1942,14 @@ else
if ($result) if ($result)
{ {
$propalstatic=new Propal($db); $propalstatic=new Propal($db);
$num = $db->num_rows($result); $num = $db->num_rows($result);
$param='&amp;socid='.$socid.'&amp;viewstatut='.$viewstatut; $param='&amp;socid='.$socid.'&amp;viewstatut='.$viewstatut;
if ($month) $param.='&amp;month='.$month; if ($month) $param.='&amp;month='.$month;
if ($year) $param.='&amp;year='.$year; if ($year) $param.='&amp;year='.$year;
print_barre_liste($langs->trans('ListOfProposals'), $page,'propal.php',$param,$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans('ListOfProposals'), $page,'propal.php',$param,$sortfield,$sortorder,'',$num);
$i = 0; $i = 0;
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@@ -1948,7 +1960,7 @@ else
print_liste_field_titre($langs->trans('Price'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Price'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
@@ -1959,21 +1971,21 @@ else
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="40" name="search_societe" value="'.$_GET['search_societe'].'">'; print '<input class="flat" type="text" size="40" name="search_societe" value="'.$_GET['search_societe'].'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" colspan="1" align="right">'; print '<td class="liste_titre" colspan="1" align="right">';
print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">'; print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
print '&nbsp;'.$langs->trans('Year').': '; print '&nbsp;'.$langs->trans('Year').': ';
$max_year = date("Y"); $max_year = date("Y");
$syear = $year; $syear = $year;
//if($syear == '') $syear = date("Y"); //if($syear == '') $syear = date("Y");
$html->select_year($syear,'year',1, '', $max_year); $html->select_year($syear,'year',1, '', $max_year);
print '</td>'; print '</td>';
print '<td class="liste_titre" colspan="1">&nbsp;</td>'; print '<td class="liste_titre" colspan="1">&nbsp;</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$_GET['search_montant_ht'].'">'; print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$_GET['search_montant_ht'].'">';
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
$html->select_propal_statut($viewstatut); $html->select_propal_statut($viewstatut);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">'; print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@@ -2048,7 +2060,7 @@ else
print '<td align="right">'.price($objp->total_ht)."</td>\n"; print '<td align="right">'.price($objp->total_ht)."</td>\n";
$propal=New Propal($db); $propal=New Propal($db);
print '<td align="right">'.$propal->LibStatut($objp->fk_statut,5)."</td>\n"; print '<td align="right">'.$propal->LibStatut($objp->fk_statut,5)."</td>\n";
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
print "</tr>\n"; print "</tr>\n";
$total = $total + $objp->total_ht; $total = $total + $objp->total_ht;

View File

@@ -95,7 +95,8 @@ if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes
$result = $commande->delete_line($_GET['lineid']); $result = $commande->delete_line($_GET['lineid']);
if ($result > 0) if ($result > 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -164,17 +165,17 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
// Insertion contact par defaut si defini // Insertion contact par defaut si defini
if ($_POST["contactidp"]) if ($_POST["contactidp"])
{ {
$result=$commande->add_contact($_POST["contactidp"],'CUSTOMER','external'); $result=$commande->add_contact($_POST["contactidp"],'CUSTOMER','external');
if ($result > 0) if ($result > 0)
{ {
$error=0; $error=0;
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>'; $mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
$error=1; $error=1;
} }
} }
$_GET['id'] = $commande->id; $_GET['id'] = $commande->id;
@@ -401,7 +402,8 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
if ($result > 0) if ($result > 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -474,10 +476,11 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
if ($result >= 0) if ($result >= 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs); commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
} }
@@ -504,7 +507,8 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
$result=$commande->valid($user); $result=$commande->valid($user);
if ($result >= 0) if ($result >= 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -538,8 +542,9 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
$result = $commande->set_draft($user); $result = $commande->set_draft($user);
if ($result >= 0) if ($result >= 0)
{ //regeneration pdf {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -557,7 +562,9 @@ if ($_GET['action'] == 'up' && $user->rights->commande->creer)
$commande = new Commande($db,'',$_GET['id']); $commande = new Commande($db,'',$_GET['id']);
$commande->fetch($_GET['id']); $commande->fetch($_GET['id']);
$commande->line_up($_GET['rowid']); $commande->line_up($_GET['rowid']);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -572,7 +579,9 @@ if ($_GET['action'] == 'down' && $user->rights->commande->creer)
$commande = new Commande($db,'',$_GET['id']); $commande = new Commande($db,'',$_GET['id']);
$commande->fetch($_GET['id']); $commande->fetch($_GET['id']);
$commande->line_down($_GET['rowid']); $commande->line_down($_GET['rowid']);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -597,12 +606,12 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
$commande->setDocModel($user, $_REQUEST['model']); $commande->setDocModel($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs); $result=commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
@@ -1896,7 +1905,7 @@ else
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$_GET['id'].'&amp;action=create&amp;commande_id='.$_GET["id"].'&entrepot_id='.$user->entrepots[0]['id'].'">'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$_GET['id'].'&amp;action=create&amp;commande_id='.$_GET["id"].'&entrepot_id='.$user->entrepots[0]['id'].'">';
print $langs->trans('ShipProduct').'</a>'; print $langs->trans('ShipProduct').'</a>';
} }
else else
{ {

View File

@@ -121,12 +121,12 @@ if (($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'ye
$result = $fac->deleteline($_GET['rowid'], $user); $result = $fac->deleteline($_GET['rowid'], $user);
if ($result > 0) if ($result > 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); $result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
if ($result > 0) if ($result > 0)
{ {
@@ -263,12 +263,13 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
$result = $fac->set_valid($user); $result = $fac->set_valid($user);
if ($result >= 0) if ($result >= 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
} }
else else
{ {
@@ -311,13 +312,14 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier && $conf->glo
if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0) if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0)
{ {
$fac->set_draft($user); $fac->set_draft($user);
//reg<65>n<EFBFBD>ration PDF
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
} }
} }
@@ -900,12 +902,13 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
if ($result > 0) if ($result > 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
facture_pdf_create($db, $fac->id, $fac->modelpdf, $outputlangs); }
facture_pdf_create($db, $fac->id, $fac->modelpdf, $outputlangs);
} }
else else
{ {
@@ -971,12 +974,13 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
$info_bits $info_bits
); );
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); }
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
} }
$_GET['facid']=$_POST['facid']; // Pour r<>affichage de la fiche en cours d'<27>dition $_GET['facid']=$_POST['facid']; // Pour r<>affichage de la fiche en cours d'<27>dition
@@ -998,11 +1002,13 @@ if ($_GET['action'] == 'up' && $user->rights->facture->creer)
$fac = new Facture($db,'',$_GET['facid']); $fac = new Facture($db,'',$_GET['facid']);
$fac->fetch($_GET['facid']); $fac->fetch($_GET['facid']);
$fac->line_up($_GET['rowid']); $fac->line_up($_GET['rowid']);
if ($_REQUEST['lang_id'])
{ $outputlangs = $langs;
$outputlangs = new Translate("",$conf); if (! empty($_REQUEST['lang_id']))
$outputlangs->setDefaultLang($_REQUEST['lang_id']); {
} $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']);
exit; exit;
@@ -1013,11 +1019,13 @@ if ($_GET['action'] == 'down' && $user->rights->facture->creer)
$fac = new Facture($db,'',$_GET['facid']); $fac = new Facture($db,'',$_GET['facid']);
$fac->fetch($_GET['facid']); $fac->fetch($_GET['facid']);
$fac->line_down($_GET['rowid']); $fac->line_down($_GET['rowid']);
if ($_REQUEST['lang_id'])
{ $outputlangs = $langs;
$outputlangs = new Translate("",$conf); if (! empty($_REQUEST['lang_id']))
$outputlangs->setDefaultLang($_REQUEST['lang_id']); {
} $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']);
exit; exit;
@@ -1238,12 +1246,12 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$fac->setDocModel($user, $_REQUEST['model']); $fac->setDocModel($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); $result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
@@ -3138,7 +3146,8 @@ else
// Construit PDF si non existant // Construit PDF si non existant
if (! is_readable($file)) if (! is_readable($file))
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -3204,7 +3213,8 @@ else
// Construit PDF si non existant // Construit PDF si non existant
if (! is_readable($file)) if (! is_readable($file))
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);

View File

@@ -79,7 +79,9 @@ if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user-
{ {
$fac = new Facture($db); $fac = new Facture($db);
$fac->fetch($id); $fac->fetch($id);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);

View File

@@ -181,8 +181,8 @@ for ($mois = 1 ; $mois < 13 ; $mois++)
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
$casenow = dolibarr_print_date(mktime(),"%Y-%m"); $casenow = dolibarr_print_date(mktime(),"%Y-%m");
$case = dolibarr_print_date(mktime(1,1,1,$mois,1,$annee),"%Y-%m"); $case = dolibarr_print_date(dolibarr_mktime(1,1,1,$mois,1,$annee),"%Y-%m");
$caseprev = dolibarr_print_date(mktime(1,1,1,$mois,1,$annee-1),"%Y-%m"); $caseprev = dolibarr_print_date(dolibarr_mktime(1,1,1,$mois,1,$annee-1),"%Y-%m");
if ($annee == $year_current) { if ($annee == $year_current) {
$total_CA += $cum[$case]; $total_CA += $cum[$case];

View File

@@ -286,7 +286,8 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
if ($result > 0) if ($result > 0)
{ {
/* /*
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);

View File

@@ -72,13 +72,13 @@ if ($_POST["action"] == 'add')
$expedition->note = $_POST["note"]; $expedition->note = $_POST["note"];
$expedition->origin = $origin; $expedition->origin = $origin;
$expedition->origin_id = $origin_id; $expedition->origin_id = $origin_id;
$expedition->weight = $_POST["weight"]==""?"NULL":$_POST["weight"]; $expedition->weight = $_POST["weight"]==""?"NULL":$_POST["weight"];
$expedition->sizeH = $_POST["sizeH"]==""?"NULL":$_POST["sizeH"]; $expedition->sizeH = $_POST["sizeH"]==""?"NULL":$_POST["sizeH"];
$expedition->sizeW = $_POST["sizeW"]==""?"NULL":$_POST["sizeW"]; $expedition->sizeW = $_POST["sizeW"]==""?"NULL":$_POST["sizeW"];
$expedition->sizeS = $_POST["sizeS"]==""?"NULL":$_POST["sizeS"]; $expedition->sizeS = $_POST["sizeS"]==""?"NULL":$_POST["sizeS"];
$expedition->size_units = $_POST["size_units"]; $expedition->size_units = $_POST["size_units"];
$expedition->weight_units = $_POST["weight_units"]; $expedition->weight_units = $_POST["weight_units"];
// On boucle sur chaque ligne du document d'origine pour completer objet expedition // On boucle sur chaque ligne du document d'origine pour completer objet expedition
// avec qte a livrer // avec qte a livrer
$class = ucfirst($expedition->origin); $class = ucfirst($expedition->origin);
@@ -163,7 +163,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
if ($_REQUEST['action'] == 'builddoc') // En get ou en post if ($_REQUEST['action'] == 'builddoc') // En get ou en post
{ {
require_once(DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/ModelePdfExpedition.class.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/ModelePdfExpedition.class.php");
// Sauvegarde le dernier modele choisi pour generer un document // Sauvegarde le dernier modele choisi pour generer un document
$expedition = new Expedition($db, 0, $_REQUEST['id']); $expedition = new Expedition($db, 0, $_REQUEST['id']);
$expedition->fetch($_REQUEST['id']); $expedition->fetch($_REQUEST['id']);
@@ -173,7 +173,8 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$expedition->setDocModel($user, $_REQUEST['model']); $expedition->setDocModel($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -293,27 +294,27 @@ if ($_GET["action"] == 'create')
print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>"; print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>";
} }
print "</table>"; print "</table>";
print '<table><tr><td>'; print '<table><tr><td>';
print $langs->trans("Weight"); print $langs->trans("Weight");
print '</td><td><input name="weight" size="4" value=""></td><td>'; print '</td><td><input name="weight" size="4" value=""></td><td>';
print $formproduct->select_measuring_units("weight_units","weight"); print $formproduct->select_measuring_units("weight_units","weight");
print '</td></tr><tr><td>'; print '</td></tr><tr><td>';
print $langs->trans("Width"); print $langs->trans("Width");
print ' </td><td><input name="sizeW" size="4" value=""></td>'; print ' </td><td><input name="sizeW" size="4" value=""></td>';
print '<td>&nbsp;</td></tr><tr><td>'; print '<td>&nbsp;</td></tr><tr><td>';
print $langs->trans("Height"); print $langs->trans("Height");
print '</td><td><input name="sizeH" size="4" value=""></td><td>'; print '</td><td><input name="sizeH" size="4" value=""></td><td>';
print $formproduct->select_measuring_units("size_units","size"); print $formproduct->select_measuring_units("size_units","size");
print '</td></tr><tr><td>'; print '</td></tr><tr><td>';
print $langs->trans("Depth"); print $langs->trans("Depth");
print '</td><td><input name="sizeS" size="4" value=""></td>'; print '</td><td><input name="sizeS" size="4" value=""></td>';
print '<td>&nbsp;</td></tr></table>'; print '<td>&nbsp;</td></tr></table>';
print '<table>'; print '<table>';
// Delivery method // Delivery method
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>"; print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
print '<td colspan="3">'; print '<td colspan="3">';
$expe->fetch_delivery_methods(); $expe->fetch_delivery_methods();
@@ -325,9 +326,9 @@ if ($_GET["action"] == 'create')
print '<td colspan="3">'; print '<td colspan="3">';
print '<input name="tracking_number" size="20">'; print '<input name="tracking_number" size="20">';
print "</td></tr>\n"; print "</td></tr>\n";
print "</table>"; print "</table>";
/* /*
* Lignes de commandes * Lignes de commandes
* *
@@ -366,7 +367,7 @@ if ($_GET["action"] == 'create')
while ($indiceAsked < $numAsked) while ($indiceAsked < $numAsked)
{ {
$product = new Product($db); $product = new Product($db);
$ligne = $object->lignes[$indiceAsked]; $ligne = $object->lignes[$indiceAsked];
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">\n"; print "<tr ".$bc[$var].">\n";
@@ -455,7 +456,7 @@ if ($_GET["action"] == 'create')
$html->select_array('entl'.$i,$array,'',1,0,0); $html->select_array('entl'.$i,$array,'',1,0,0);
print '</td>'; print '</td>';
} }
} }
else else
{ {
@@ -481,7 +482,7 @@ if ($_GET["action"] == 'create')
} }
} }
} }
$indiceAsked++; $indiceAsked++;
} }
@@ -579,19 +580,19 @@ else
// Calcul du poids total et du volume total des produits // Calcul du poids total et du volume total des produits
$totalWeight = ''; $totalWeight = '';
$totalVolume = ''; $totalVolume = '';
for ($i = 0 ; $i < $num_prod ; $i++) for ($i = 0 ; $i < $num_prod ; $i++)
{ {
$weightUnit=0; $weightUnit=0;
$volumeUnit=0; $volumeUnit=0;
if (! empty($lignes[$i]->weight_units)) $weightUnit = $lignes[$i]->weight_units; if (! empty($lignes[$i]->weight_units)) $weightUnit = $lignes[$i]->weight_units;
$trueWeightUnit=pow(10,$weightUnit); $trueWeightUnit=pow(10,$weightUnit);
$totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped*$trueWeightUnit; $totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped*$trueWeightUnit;
if (! empty($lignes[$i]->volume_units)) $volumeUnit = $lignes[$i]->volume_units; if (! empty($lignes[$i]->volume_units)) $volumeUnit = $lignes[$i]->volume_units;
$trueVolumeUnit=pow(10,$volumeUnit); $trueVolumeUnit=pow(10,$volumeUnit);
$totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped*$trueVolumeUnit; $totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped*$trueVolumeUnit;
} }
$totalVolume=$totalVolume; $totalVolume=$totalVolume;
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
@@ -636,27 +637,27 @@ else
print '</tr>'; print '</tr>';
// Weight // Weight
print '<tr><td>'.$langs->trans("TotalWeight").'</td>'; print '<tr><td>'.$langs->trans("TotalWeight").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($expedition->trueWeight) if ($expedition->trueWeight)
{ {
// If sending weigth defined // If sending weigth defined
print $expedition->trueWeight.' '.measuring_units_string($expedition->weight_units,"weight"); print $expedition->trueWeight.' '.measuring_units_string($expedition->weight_units,"weight");
} }
else else
{ {
// If sending Weight not defined we use sum of products // If sending Weight not defined we use sum of products
// TODO Show in best unit // TODO Show in best unit
if ($totalWeight > 0) print $totalWeight.' '.measuring_units_string(0,"weight"); if ($totalWeight > 0) print $totalWeight.' '.measuring_units_string(0,"weight");
else print '&nbsp;'; else print '&nbsp;';
} }
print '</td></tr>'; print '</td></tr>';
// Volume Total // Volume Total
print '<tr><td>'.$langs->trans("TotalVolume").'</td>'; print '<tr><td>'.$langs->trans("TotalVolume").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($expedition->trueVolume) if ($expedition->trueVolume)
{ {
// If sending volume defined // If sending volume defined
print $expedition->trueVolume.' '.measuring_units_string($expedition->volumeUnit,"volume"); print $expedition->trueVolume.' '.measuring_units_string($expedition->volumeUnit,"volume");
} }
@@ -670,18 +671,18 @@ else
print "</td>\n"; print "</td>\n";
print '</tr>'; print '</tr>';
// Taille // Taille
print '<tr><td>'.$langs->trans("Size").'</td>'; print '<tr><td>'.$langs->trans("Size").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($expedition->trueWidth || $expedition->trueHeight || $expedition->trueDepth) if ($expedition->trueWidth || $expedition->trueHeight || $expedition->trueDepth)
{ {
// If sending size defined // If sending size defined
print $expedition->trueSize.' '.measuring_units_string($expedition->size_units,"size"); print $expedition->trueSize.' '.measuring_units_string($expedition->size_units,"size");
} }
else print '&nbsp;'; else print '&nbsp;';
print "</td>\n"; print "</td>\n";
print '</tr>'; print '</tr>';
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td>'; print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="3">'.$expedition->getLibStatut(4)."</td>\n"; print '<td colspan="3">'.$expedition->getLibStatut(4)."</td>\n";

View File

@@ -78,12 +78,12 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
$result = $fichinter->valid($user, $conf->fichinter->outputdir); $result = $fichinter->valid($user, $conf->fichinter->outputdir);
if ($result >= 0) if ($result >= 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs); $result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
} }
else else
@@ -148,12 +148,12 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$fichinter->fetch($_GET['id']); $fichinter->fetch($_GET['id']);
$fichinter->fetch_lines(); $fichinter->fetch_lines();
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs); $result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
@@ -214,7 +214,8 @@ if ($_POST['action'] == "addligne" && $user->rights->ficheinter->creer)
$duration $duration
); );
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -248,11 +249,12 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
$fichinterline->duration=$duration; $fichinterline->duration=$duration;
$result = $fichinterline->update(); $result = $fichinterline->update();
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
} }
@@ -275,11 +277,13 @@ if ($_GET['action'] == 'deleteline' && $user->rights->ficheinter->creer && !$con
dolibarr_print_error($db); dolibarr_print_error($db);
exit; exit;
} }
if ($_REQUEST['lang_id'])
{ $outputlangs = $langs;
$outputlangs = new Translate("",$conf); if (! empty($_REQUEST['lang_id']))
$outputlangs->setDefaultLang($_REQUEST['lang_id']); {
} $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
} }
@@ -303,11 +307,13 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
dolibarr_print_error($db); dolibarr_print_error($db);
exit; exit;
} }
if ($_REQUEST['lang_id'])
{ $outputlangs = $langs;
$outputlangs = new Translate("",$conf); if (! empty($_REQUEST['lang_id']))
$outputlangs->setDefaultLang($_REQUEST['lang_id']); {
} $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
} }
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
@@ -323,11 +329,13 @@ if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer)
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($_GET['id']);
$fichinter->line_up($_GET['rowid']); $fichinter->line_up($_GET['rowid']);
if ($_REQUEST['lang_id'])
{ $outputlangs = $langs;
$outputlangs = new Translate("",$conf); if (! empty($_REQUEST['lang_id']))
$outputlangs->setDefaultLang($_REQUEST['lang_id']); {
} $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit; exit;
@@ -338,11 +346,13 @@ if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer)
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($_GET['id']);
$fichinter->line_down($_GET['rowid']); $fichinter->line_down($_GET['rowid']);
if ($_REQUEST['lang_id'])
{ $outputlangs = $langs;
$outputlangs = new Translate("",$conf); if (! empty($_REQUEST['lang_id']))
$outputlangs->setDefaultLang($_REQUEST['lang_id']); {
} $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit; exit;

View File

@@ -172,7 +172,8 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree
//print "xx".$tva_tx; exit; //print "xx".$tva_tx; exit;
if ($result > 0) if ($result > 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -204,12 +205,13 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
if ($result >= 0) if ($result >= 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
{ if (! empty($_REQUEST['lang_id']))
$outputlangs = new Translate("",$conf); {
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs = new Translate("",$conf);
} $outputlangs->setDefaultLang($_REQUEST['lang_id']);
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs); }
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
} }
else else
{ {
@@ -231,7 +233,9 @@ if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_POST['confirm'] ==
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->fetch($id); $commande->fetch($id);
$result = $commande->delete_line($_GET['lineid']); $result = $commande->delete_line($_GET['lineid']);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -252,7 +256,8 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
$result = $commande->valid($user); $result = $commande->valid($user);
if ($result >= 0) if ($result >= 0)
{ {
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -338,7 +343,9 @@ if ($_GET['action'] == 'up' && $user->rights->fournisseur->commande->creer)
$commande = new CommandeFournisseur($db,'',$id); $commande = new CommandeFournisseur($db,'',$id);
$commande->fetch($id); $commande->fetch($id);
$commande->line_up($_GET['rowid']); $commande->line_up($_GET['rowid']);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -353,7 +360,9 @@ if ($_GET['action'] == 'down' && $user->rights->fournisseur->commande->creer)
$commande = new CommandeFournisseur($db,'',$id); $commande = new CommandeFournisseur($db,'',$id);
$commande->fetch($id); $commande->fetch($id);
$commande->line_down($_GET['rowid']); $commande->line_down($_GET['rowid']);
if ($_REQUEST['lang_id'])
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
@@ -379,7 +388,8 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$commande->setDocModel($user, $_REQUEST['model']); $commande->setDocModel($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);

View File

@@ -206,7 +206,7 @@ function facture_pdf_create($db, $id, $message, $modele, $outputlangs)
facture_meta_create($db, $id); facture_meta_create($db, $id);
// et on supprime l'image correspondant au preview // et on supprime l'image correspondant au preview
facture_delete_preview($db, $id); facture_delete_preview($db, $id);
$outputlangs->charset_output=$sav_charset_output; $outputlangs->charset_output=$sav_charset_output;
return 1; return 1;
} }

View File

@@ -56,7 +56,7 @@ class pdf_crabe extends ModelePDFFactures
$this->db = $db; $this->db = $db;
$this->name = "crabe"; $this->name = "crabe";
$this->description = $langs->trans('PDFCrabeDescription'); $this->description = $langs->trans('PDFCrabeDescription');
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf'; $this->type = 'pdf';
$this->page_largeur = 210; $this->page_largeur = 210;
@@ -105,10 +105,10 @@ class pdf_crabe extends ModelePDFFactures
* \param outputlangs Lang object for output language * \param outputlangs Lang object for output language
* \return int 1=ok, 0=ko * \return int 1=ok, 0=ko
*/ */
function write_file($fac,$outputlangs='') function write_file($fac,$outputlangs)
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
@@ -292,7 +292,7 @@ class pdf_crabe extends ModelePDFFactures
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end)
{ {
// Affichage duree si il y en a une // Affichage duree si il y en a une
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")",1); $libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end,'',false,$outputlangs).")",1);
} }
//if ($i==0) { print $libelleproduitservice; exit; } //if ($i==0) { print $libelleproduitservice; exit; }

View File

@@ -78,7 +78,7 @@ class pdf_soleil extends ModelePDFFicheinter
\param fichinter Object fichinter \param fichinter Object fichinter
\return int 1=ok, 0=ko \return int 1=ok, 0=ko
*/ */
function write_file($fichinter,$outputlangs='') function write_file($fichinter,$outputlangs)
{ {
global $user,$langs,$conf,$mysoc; global $user,$langs,$conf,$mysoc;
@@ -243,7 +243,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetTextColor(0,0,100); $pdf->SetTextColor(0,0,100);
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->Text(11, 94, $langs->trans("InterventionCard")." : ".$fichinter->ref); $pdf->Text(11, 94, $outputlangs->trans("InterventionCard")." : ".$fichinter->ref);
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
@@ -253,7 +253,7 @@ class pdf_soleil extends ModelePDFFicheinter
$tab_height = 16; $tab_height = 16;
$pdf->SetXY (10, $tab_top); $pdf->SetXY (10, $tab_top);
$pdf->MultiCell(190,8,$langs->transnoentities("Description"),0,'L',0); $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0);
$pdf->line(10, $tab_top + 8, 200, $tab_top + 8 ); $pdf->line(10, $tab_top + 8, 200, $tab_top + 8 );
$pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->Rect(10, $tab_top, 190, $tab_height);
@@ -279,7 +279,7 @@ class pdf_soleil extends ModelePDFFicheinter
{ {
$pdf->SetXY (10, $tab_top + 16 + $j * 20); $pdf->SetXY (10, $tab_top + 16 + $j * 20);
$pdf->writeHTMLCell(0, 4, 20, $tab_top + 16 + $j * 20, $pdf->writeHTMLCell(0, 4, 20, $tab_top + 16 + $j * 20,
dol_htmlentitiesbr($langs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei)." - ".$langs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration), 1), 0, 0, 0); dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei,'',false,$outputlangs)." - ".$outputlangs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration), 1), 0, 0, 0);
$pdf->SetXY (10, $tab_top + 22 + $j * 20); $pdf->SetXY (10, $tab_top + 22 + $j * 20);
$pdf->writeHTMLCell(0, 4, 20, $tab_top + 22 + $j * 20, $pdf->writeHTMLCell(0, 4, 20, $tab_top + 22 + $j * 20,
@@ -296,13 +296,13 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->MultiCell(60, 5, '', 0, 'J', 0); $pdf->MultiCell(60, 5, '', 0, 'J', 0);
$pdf->SetXY(20,220); $pdf->SetXY(20,220);
$pdf->MultiCell(66,5, $langs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
$pdf->SetXY(20,225); $pdf->SetXY(20,225);
$pdf->MultiCell(80,30, '', 1); $pdf->MultiCell(80,30, '', 1);
$pdf->SetXY(110,220); $pdf->SetXY(110,220);
$pdf->MultiCell(80,5, $langs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
$pdf->SetXY(110,225); $pdf->SetXY(110,225);
$pdf->MultiCell(80,30, '', 1); $pdf->MultiCell(80,30, '', 1);

View File

@@ -444,11 +444,11 @@ function dolibarr_time_plus_duree($time,$duration_value,$duration_unit)
* "%d/%m/%Y %H:%M:%S", * "%d/%m/%Y %H:%M:%S",
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext" * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext"
* \param to_gmt false=output string if for local server TZ users, true=output string is for GMT users * \param to_gmt false=output string if for local server TZ users, true=output string is for GMT users
* \param convtooutput true=Output string is encoded into encoding defined into $langs->charset_output * \param outputlangs Object lang that contains charset_output property to define output
* This means output is endoded in UTF-8 in default case. * This means output is endoded in UTF-8 in default case.
* \return string Formated date or '' if time is null * \return string Formated date or '' if time is null
*/ */
function dolibarr_print_date($time,$format='',$to_gmt=false,$convtooutput=true) function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='')
{ {
global $conf,$langs; global $conf,$langs;
@@ -496,7 +496,9 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$convtooutput=true)
$localtime=setlocale(LC_TIME,0); $localtime=setlocale(LC_TIME,0);
if (eregi('UTF',$localtime)) $pagecodefrom='UTF-8'; if (eregi('UTF',$localtime)) $pagecodefrom='UTF-8';
return ($convtooutput?$langs->convToOuptutCharset($ret,$pagecodefrom):$ret); if (! is_object($outputlangs)) $outputlangs=$langs;
return $outputlangs->convToOuptutCharset($ret,$pagecodefrom);
} }
@@ -2873,21 +2875,23 @@ function make_substitutions($chaine,$substitutionarray)
* \remarks Updated by Matelli : added format paramter * \remarks Updated by Matelli : added format paramter
* \remarks See http://matelli.fr/showcases/patchs-dolibarr/update-date-range-format.html for details * \remarks See http://matelli.fr/showcases/patchs-dolibarr/update-date-range-format.html for details
*/ */
function print_date_range($date_start,$date_end,$format = '') function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
{ {
global $langs; global $langs;
if (! is_object($outputlangs)) $outputlangs=$langs;
if ($date_start && $date_end) if ($date_start && $date_end)
{ {
print ' ('.$langs->trans('DateFromTo',dolibarr_print_date($date_start, $format, false, false),dolibarr_print_date($date_end, $format, false, false)).')'; print ' ('.$langs->trans('DateFromTo',dolibarr_print_date($date_start, $format, false, $outputlangs),dolibarr_print_date($date_end, $format, false, $outputlangs)).')';
} }
if ($date_start && ! $date_end) if ($date_start && ! $date_end)
{ {
print ' ('.$langs->trans('DateFrom',dolibarr_print_date($date_start, $format, false, false)).')'; print ' ('.$langs->trans('DateFrom',dolibarr_print_date($date_start, $format, false, $outputlangs)).')';
} }
if (! $date_start && $date_end) if (! $date_start && $date_end)
{ {
print ' ('.$langs->trans('DateUntil',dolibarr_print_date($date_end, $format, false, false)).')'; print ' ('.$langs->trans('DateUntil',dolibarr_print_date($date_end, $format, false, $outputlangs)).')';
} }
} }

View File

@@ -143,7 +143,8 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$delivery->setDocModel($user, $_REQUEST['model']); $delivery->setDocModel($user, $_REQUEST['model']);
} }
if ($_REQUEST['lang_id']) $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);