New: Add default language for third parties and use it when multilang is enabled to define default language for document generation.

This commit is contained in:
Laurent Destailleur 2010-02-27 13:37:13 +00:00
parent ff6cb05477
commit d30e65cbaa
16 changed files with 533 additions and 277 deletions

View File

@ -135,13 +135,18 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
{
$propal = new Propal($db);
$propal->fetch($_GET['propalid']);
$propal->fetch_client();
$result = $propal->delete_product($_GET['lineid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
}
@ -161,6 +166,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
$result=$propal->valid($user);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
@ -313,15 +319,18 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
{
$db->commit();
// Generation document PDF
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $id, $_REQUEST['model'], $outputlangs);
dol_syslog('Redirect to '.$_SERVER["PHP_SELF"].'?propalid='.$id);
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id);
exit;
}
@ -615,14 +624,20 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
*/
$propal = new Propal($db);
$propal->fetch($_GET['propalid']);
$propal->fetch_client();
$propal->set_draft($user);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
}
@ -758,11 +773,15 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
if ($result > 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
@ -791,6 +810,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
dol_print_error($db,$propal->error);
exit;
}
$propal->fetch_client();
// Define info_bits
$info_bits=0;
@ -822,11 +842,15 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
'HT',
$info_bits);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
}
@ -839,16 +863,22 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
{
$propal = new Propal($db);
$propal->fetch($_GET['propalid']);
$propal->fetch_client();
if ($_REQUEST['model'])
{
$propal->setDocModel($user, $_REQUEST['model']);
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
if ($result <= 0)
@ -913,15 +943,21 @@ if ($_GET['action'] == 'up' && $user->rights->propale->creer)
{
$propal = new Propal($db, '', $_GET["propalid"]);
$propal->fetch($_GET['propalid']);
$propal->fetch_client();
$propal->line_up($_GET['rowid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']);
exit;
}
@ -930,15 +966,21 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
{
$propal = new Propal($db, '', $_GET["propalid"]);
$propal->fetch($_GET['propalid']);
$propal->fetch_client();
$propal->line_down($_GET['rowid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']);
exit;
}

View File

@ -119,14 +119,20 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
$commande->fetch_client();
$result = $commande->delete_line($_GET['lineid']);
if ($result > 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $_GET['id'], $commande->modelpdf, $outputlangs);
}
@ -445,11 +451,15 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
if ($result > 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
@ -478,6 +488,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
{
$commande = new Commande($db,'',$_POST['id']);
if (! $commande->fetch($_POST['id']) > 0) dol_print_error($db);
$commande->fetch_client();
// Clean parameters
$date_start='';
@ -541,11 +552,15 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
@ -568,15 +583,20 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
{
$commande = new Commande($db);
$commande->fetch($_GET['id']); // Load order and lines
$commande->fetch_client();
$result=$commande->valid($user);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
@ -605,15 +625,20 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
*/
$commande = new Commande($db);
$commande->fetch($_GET['id']); // Load order and lines
$commande->fetch_client();
$result = $commande->set_draft($user);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
@ -627,15 +652,22 @@ if ($_GET['action'] == 'up' && $user->rights->commande->creer)
{
$commande = new Commande($db,'',$_GET['id']);
$commande->fetch($_GET['id']);
$commande->fetch_client();
$commande->line_up($_GET['rowid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
}
@ -644,15 +676,21 @@ if ($_GET['action'] == 'down' && $user->rights->commande->creer)
{
$commande = new Commande($db,'',$_GET['id']);
$commande->fetch($_GET['id']);
$commande->fetch_client();
$commande->line_down($_GET['rowid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
}
@ -667,16 +705,22 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
// Sauvegarde le dernier modele choisi pour generer un document
$commande = new Commande($db, 0, $_REQUEST['id']);
$result=$commande->fetch($_REQUEST['id']);
$commande->fetch_client();
if ($_REQUEST['model'])
{
$commande->setDocModel($user, $_REQUEST['model']);
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
if ($result <= 0)
@ -1274,7 +1318,7 @@ else
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -1302,7 +1346,7 @@ else
$text.='<br>';
$text.=$notify->confirmMessage('NOTIFY_VAL_ORDER',$commande->socid);
}
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', '', 0, 1);
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -1311,7 +1355,7 @@ else
*/
if ($_GET['action'] == 'close')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close', '', 0, 1);
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close', '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -1320,7 +1364,7 @@ else
*/
if ($_GET['action'] == 'cancel')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel', '', 0, 1);
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel', '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -1329,7 +1373,7 @@ else
*/
if ($_GET['action'] == 'ask_deleteline')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
if ($ret == 'html') print '<br>';
}
@ -1371,7 +1415,7 @@ else
print '</td><td colspan="3">';
if ($user->rights->commande->creer && $_GET['action'] == 'refcustomer')
{
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_ref_client">';
print '<input type="text" class="flat" size="20" name="ref_client" value="'.$commande->ref_client.'">';
@ -1737,13 +1781,13 @@ else
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=editline&amp;rowid='.$objp->rowid.'#'.$objp->rowid.'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;action=editline&amp;rowid='.$objp->rowid.'#'.$objp->rowid.'">';
print img_edit();
print '</a>';
}
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=ask_deleteline&amp;lineid='.$objp->rowid.'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;action=ask_deleteline&amp;lineid='.$objp->rowid.'">';
print img_delete();
print '</a></td>';
if ($num > 1)
@ -1777,7 +1821,7 @@ else
print '<form action="'.$_SERVER["PHP_SELF"].'#'.$objp->rowid.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateligne">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="id" value="'.$commande->id.'">';
print '<input type="hidden" name="elrowid" value="'.$_GET['rowid'].'">';
print '<tr '.$bc[$var].'>';
print '<td>';
@ -1886,9 +1930,9 @@ else
print '</tr>';
// Add free products/services form
print '<form action="fiche.php?id='.$id.'#add" method="post">';
print '<form action="fiche.php?id='.$commande->id.'#add" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="id" value="'.$commande->id.'">';
print '<input type="hidden" name="action" value="addline">';
$var=true;
@ -1958,9 +2002,9 @@ else
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
print '<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'#add" method="post">';
print '<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'#add" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="id" value="'.$commande->id.'">';
print '<input type="hidden" name="action" value="addline">';
$var=!$var;

View File

@ -186,11 +186,15 @@ if ($_REQUEST['action'] == 'builddoc')
$donation->setDocModel($user, $_REQUEST['model']);
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$donation->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=don_create($db, $donation->id, '', $donation->modelpdf, $outputlangs);
if ($result <= 0)

View File

@ -143,14 +143,20 @@ if ($_REQUEST['action'] == 'confirm_deleteproductline' && $_REQUEST['confirm'] =
{
$fac = new Facture($db);
$fac->fetch($_GET['facid']);
$fac->fetch_client();
$result = $fac->deleteline($_GET['rowid'], $user);
if ($result > 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
if ($result > 0)
@ -306,11 +312,15 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
$result = $fac->set_valid($user);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
}
@ -325,6 +335,7 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier)
{
$fac = new Facture($db);
$fac->fetch($_GET['facid']);
$fac->fetch_client();
// On verifie si la facture a des paiements
$sql = 'SELECT pf.amount';
@ -359,11 +370,15 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier)
{
$fac->set_draft($user);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
}
@ -987,11 +1002,15 @@ if (($_POST['action'] == 'addline' || $_POST['action'] == 'addline_predef') && $
if ($result > 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
@ -1016,6 +1035,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
{
$fac = new Facture($db,'',$_POST['facid']);
if (! $fac->fetch($_POST['facid']) > 0) dol_print_error($db);
$fac->fetch_client();
// Clean parameters
$date_start='';
@ -1078,11 +1098,15 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
$type
);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
}
@ -1105,15 +1129,21 @@ if ($_GET['action'] == 'up' && $user->rights->facture->creer)
{
$fac = new Facture($db,'',$_GET['facid']);
$fac->fetch($_GET['facid']);
$fac->fetch_client();
$fac->line_up($_GET['rowid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']);
exit;
}
@ -1122,15 +1152,21 @@ if ($_GET['action'] == 'down' && $user->rights->facture->creer)
{
$fac = new Facture($db,'',$_GET['facid']);
$fac->fetch($_GET['facid']);
$fac->fetch_client();
$fac->line_down($_GET['rowid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET["facid"].'#'.$_GET['rowid']);
exit;
}
@ -1390,17 +1426,22 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
{
$fac = new Facture($db, 0, $_GET['facid']);
$fac->fetch($_GET['facid']);
$fac->fetch_client();
if ($_REQUEST['model'])
{
$fac->setDocModel($user, $_REQUEST['model']);
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
if ($result <= 0)
@ -3598,11 +3639,15 @@ else
// Construit PDF si non existant
if (! is_readable($file))
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs);
if ($result <= 0)
@ -3663,11 +3708,15 @@ else
// Construit PDF si non existant
if (! is_readable($file))
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs);
if ($result <= 0)

View File

@ -291,11 +291,15 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
if ($result > 0)
{
/*
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$contrat->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
contrat_pdf_create($db, $contrat->id, $contrat->modelpdf, $outputlangs);
*/

View File

@ -144,8 +144,26 @@ if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $
{
$expedition = new Expedition($db);
$expedition->fetch($_GET["id"]);
$expedition->fetch_client();
$result = $expedition->valid($user);
//$expedition->PdfWrite();
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$expedition->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=expedition_pdf_create($db,$expedition->id,$expedition->modelpdf,$outputlangs);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
}
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
@ -177,17 +195,22 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
// Sauvegarde le dernier modele choisi pour generer un document
$expedition = new Expedition($db, 0, $_REQUEST['id']);
$expedition->fetch($_REQUEST['id']);
$expedition->fetch_client();
if ($_REQUEST['model'])
{
$expedition->setDocModel($user, $_REQUEST['model']);
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$expedition->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=expedition_pdf_create($db,$expedition->id,$expedition->modelpdf,$outputlangs);
if ($result <= 0)

View File

@ -53,13 +53,13 @@ if ($_GET["id"] > 0) {
$fichinter = new Fichinter($db);
if ( $fichinter->fetch($_GET["id"], $user->societe_id) > 0)
{
{
$soc = new Societe($db, $fichinter->socid);
$soc->fetch($fichinter->socid);
$head = fichinter_prepare_head($fichinter);
dol_fiche_head($head, 'preview', $langs->trans("InterventionCard"));
dol_fiche_head($head, 'preview', $langs->trans("InterventionCard"), 0, 'intervention');
/*
@ -86,16 +86,16 @@ if ($_GET["id"] > 0) {
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="18%">'.$langs->trans("Ref")."</td>";
print '<td colspan="2">'.$fichinter->ref.'</td>';
// Ref
print '<tr><td width="18%">'.$langs->trans("Ref")."</td>";
print '<td colspan="2">'.$fichinter->ref.'</td>';
$nbrow=4;
$nbrow=4;
print '<td rowspan="'.$nbrow.'" valign="top" width="50%">';
/*
* Documents
*/
* Documents
*/
$fichinterref = dol_sanitizeFileName($fichinter->ref);
$dir_output = $conf->ficheinter->dir_output . "/";
$filepath = $dir_output . $fichinterref . "/";
@ -104,7 +104,7 @@ if ($_GET["id"] > 0) {
$relativepath = "${fichinterref}/${fichinterref}.pdf";
$relativepathdetail = "${fichinterref}/${fichinterref}-detail.pdf";
// Chemin vers png apercus
// Chemin vers png apercus
$relativepathimage = "${fichinterref}/${fichinterref}.pdf.png";
$fileimage = $file.".png"; // Si PDF d'1 page
$fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page
@ -167,22 +167,22 @@ if ($_GET["id"] > 0) {
print "</td></tr>";
// Client
print "<tr><td>".$langs->trans("Customer")."</td>";
print '<td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id.'">'.$societe->nom.'</a>';
print '</td>';
print '</tr>';
// Client
print "<tr><td>".$langs->trans("Customer")."</td>";
print '<td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id.'">'.$societe->nom.'</a>';
print '</td>';
print '</tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td>';
print "<td colspan=\"2\">".$fichinter->getLibStatut(4)."</td>\n";
print '</tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td>';
print "<td colspan=\"2\">".$fichinter->getLibStatut(4)."</td>\n";
print '</tr>';
// Date
print '<tr><td>'.$langs->trans("Date").'</td>';
print "<td colspan=\"2\">".dol_print_date($fichinter->date,"daytext")."</td>\n";
print '</tr>';
// Date
print '<tr><td>'.$langs->trans("Date").'</td>';
print "<td colspan=\"2\">".dol_print_date($fichinter->date,"daytext")."</td>\n";
print '</tr>';
print '</table>';
}
@ -190,31 +190,31 @@ if ($_GET["id"] > 0) {
dol_print_error($db);
}
} else {
// Intervention non trouv<75>e
print $langs->trans("ErrorFichinterNotFound",$_GET["id"]);
// Intervention non trouv<75>e
print $langs->trans("ErrorFichinterNotFound",$_GET["id"]);
}
}
// Si fichier png PDF d'1 page trouv<75>
if (file_exists($fileimage))
{
{
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufichinter&file='.urlencode($relativepathimage).'">';
}
}
// Si fichier png PDF de plus d'1 page trouv<75>
elseif (file_exists($fileimagebis))
{
$multiple = $relativepathimage . ".";
for ($i = 0; $i < 20; $i++)
{
$multiple = $relativepathimage . ".";
$preview = $multiple.$i;
for ($i = 0; $i < 20; $i++)
if (file_exists($dir_output.$preview))
{
$preview = $multiple.$i;
if (file_exists($dir_output.$preview))
{
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufichinter&file='.urlencode($preview).'"><p>';
}
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufichinter&file='.urlencode($preview).'"><p>';
}
}
}
print '</div>';

View File

@ -172,7 +172,7 @@ if ($id > 0)
$head = fichinter_prepare_head($fichinter);
dol_fiche_head($head, 'contact', $langs->trans("InterventionCard"));
dol_fiche_head($head, 'contact', $langs->trans("InterventionCard"), 0, 'intervention');
/*

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
@ -21,11 +21,11 @@
*/
/**
\file htdocs/contrat/document.php
\ingroup contrat
\brief Page des documents joints sur les contrats
\version $Id$
*/
* \file htdocs/fichinter/document.php
* \ingroup fichinter
* \brief Page des documents joints sur les contrats
* \version $Id$
*/
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/fichinter/fichinter.class.php");
@ -128,7 +128,7 @@ if ($object->id)
$head=fichinter_prepare_head($object, $user);
dol_fiche_head($head, 'documents', $langs->trans("InterventionCard"));
dol_fiche_head($head, 'documents', $langs->trans("InterventionCard"), 0, 'intervention');
// Construit liste des fichiers

View File

@ -85,17 +85,21 @@ if ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && ! ($_REQU
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
{
$fichinter = new Fichinter($db);
$fichinter->id = $_GET["id"];
$fichinter->fetch($_GET["id"]);
$fichinter->fetch_client();
$result = $fichinter->setValid($user, $conf->fichinter->outputdir);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$fichinter->id);
@ -110,17 +114,21 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
if ($_REQUEST['action'] == 'confirm_modify' && $_REQUEST['confirm'] == 'yes')
{
$fichinter = new Fichinter($db);
$fichinter->id = $_GET["id"];
$fichinter->fetch($_GET["id"]);
$fichinter->fetch_client();
$result = $fichinter->setDraft($user);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $fichinter, (empty($_REQUEST['model'])?$fichinter->model:$_REQUEST['model']), $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$fichinter->id);
@ -186,6 +194,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
{
$fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']);
$fichinter->fetch_client();
$fichinter->fetch_lines();
if ($_REQUEST['model'])
@ -193,11 +202,15 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$fichinter->setDocModel($user, $_REQUEST['model']);
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
if ($result <= 0)
@ -243,6 +256,7 @@ if ($_POST['action'] == "addligne" && $user->rights->ficheinter->creer)
{
$fichinter = new Fichinter($db);
$ret=$fichinter->fetch($_POST['fichinterid']);
$fichinter->fetch_client();
$desc=$_POST['np_desc'];
$date_intervention = dol_mktime($_POST["dihour"], $_POST["dimin"], 0, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]);
@ -255,11 +269,15 @@ if ($_POST['action'] == "addligne" && $user->rights->ficheinter->creer)
$duration
);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_POST['fichinterid']);
@ -278,12 +296,15 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
dol_print_error($db);
exit;
}
$fichinter = new Fichinter($db);
if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0)
{
dol_print_error($db);
exit;
}
$fichinter->fetch_client();
$desc=$_POST['np_desc'];
$date_intervention = dol_mktime($_POST["dihour"], $_POST["dimin"], 0, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]);
$duration = ConvertTime2Seconds($_POST['durationhour'],$_POST['durationmin']);
@ -298,11 +319,15 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
exit;
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
@ -339,11 +364,15 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
exit;
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
}
@ -359,13 +388,18 @@ if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer)
{
$fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']);
$fichinter->fetch_client();
$fichinter->line_up($_GET['rowid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
@ -376,13 +410,18 @@ if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer)
{
$fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']);
$fichinter->fetch_client();
$fichinter->line_down($_GET['rowid']);
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
@ -440,11 +479,11 @@ if ($_GET["action"] == 'create')
print '<table class="border" width="100%">';
print '<input type="hidden" name="socid" value='.$_GET["socid"].'>';
print '<tr><td>'.$langs->trans("Company").'</td><td>'.$societe->getNomUrl(1).'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Company").'</td><td>'.$societe->getNomUrl(1).'</td></tr>';
print '<input type="hidden" name="action" value="add">';
print '<tr><td>'.$langs->trans("Ref").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("Ref").'</td>';
print '<td><input name="ref" value="'.$numpr.'"></td></tr>'."\n";
if ($conf->projet->enabled)
@ -476,25 +515,28 @@ if ($_GET["action"] == 'create')
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'"></textarea>';
print '</td></tr>';
print '<tr><td colspan="2" align="center">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
print '</td></tr>';
print '</table>';
print '<center><br>';
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
print '</center>';
print '</form>';
}
else
{
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="GET">';
print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td class="fieldrequired">'.$langs->trans("Company").'</td><td>';
$html->select_societes('','socid','',1,1);
print '</td></tr>';
print '<tr><td colspan="2" align="center">';
print '</table>';
print '<br><center>';
print '<input type="hidden" name="action" value="create">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
print '</td></tr>';
print '</table>';
print '</center>';
print '</form>';
}
@ -513,7 +555,7 @@ elseif ($fichinterid)
$head = fichinter_prepare_head($fichinter);
dol_fiche_head($head, 'card', $langs->trans("InterventionCard"));
dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention');
// Confirmation de la suppression de la fiche d'intervention
if ($_GET['action'] == 'delete')

View File

@ -369,6 +369,30 @@ class Fichinter extends CommonObject
}
}
/**
* \brief Return clicable name (with picto eventually)
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* \return string Chaine avec URL
*/
function getNomUrl($withpicto=0)
{
global $langs;
$result='';
$lien = '<a href="'.DOL_URL_ROOT.'/fichinter/fiche.php?id='.$this->id.'">';
$lienfin='</a>';
$picto='intervention';
$label=$langs->trans("Show").': '.$this->ref;
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
return $result;
}
/**
* \brief Verifie si la ref n'est pas deja utilisee
* \param soc objet societe

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/fichinter/index.php
* \brief Page accueil espace fiches interventions
* \brief List of all interventions
* \ingroup ficheinter
* \version $Id$
*/
@ -87,7 +87,7 @@ if ($result)
{
$num = $db->num_rows($result);
$fichinter_static=new Fichinter($db);
$interventionstatic=new Fichinter($db);
$urlparam="&amp;socid=$socid";
print_barre_liste($langs->trans("ListOfInterventions"), $page, "index.php",$urlparam,$sortfield,$sortorder,'',$num);
@ -127,13 +127,17 @@ if ($result)
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print "<td><a href=\"fiche.php?id=".$objp->fichid."\">".img_object($langs->trans("Show"),"task").' '.$objp->ref."</a></td>\n";
print "<td>";
$interventionstatic->id=$objp->fichid;
$interventionstatic->ref=$objp->ref;
print $interventionstatic->getNomUrl(1);
print "</td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44)."</a></td>\n";
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).'</td>';
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).'</td>';
print '<td align="center">'.dol_print_date($objp->dp,'dayhour')."</td>\n";
print '<td align="right">'.ConvertSecondToTime($objp->duree).'</td>';
print '<td align="right">'.$fichinter_static->LibStatut($objp->fk_statut,5).'</td>';
print '<td align="right">'.$interventionstatic->LibStatut($objp->fk_statut,5).'</td>';
print "</tr>\n";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,11 +18,11 @@
*/
/**
\file htdocs/fichinter/info.php
\ingroup fichinter
\brief Page d'affichage des infos d'une fiche d'intervention
\version $Id$
*/
* \file htdocs/fichinter/info.php
* \ingroup fichinter
* \brief Page d'affichage des infos d'une fiche d'intervention
* \version $Id$
*/
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
@ -51,7 +51,7 @@ $societe = new Societe($db);
$societe->fetch($fichinter->socid);
$head = fichinter_prepare_head($fichinter);
dol_fiche_head($head, 'info', $langs->trans('InterventionCard'));
dol_fiche_head($head, 'info', $langs->trans('InterventionCard'), 0, 'intervention');
$fichinter->info($fichinter->id);

View File

@ -17,10 +17,10 @@
*/
/**
\file htdocs/fichinter/note.php
\ingroup fichinter
\brief Fiche d'information sur une fiche d'intervention
\version $Id$
* \file htdocs/fichinter/note.php
* \ingroup fichinter
* \brief Fiche d'information sur une fiche d'intervention
* \version $Id$
*/
require('./pre.inc.php');
@ -99,13 +99,13 @@ if ($_GET['id'])
if ( $societe->fetch($fichinter->socid) )
{
$head = fichinter_prepare_head($fichinter);
dol_fiche_head($head, 'note', $langs->trans('InterventionCard'));
dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), 0, 'intervention');
print '<table class="border" width="100%">';
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$fichinter->ref.'</td></tr>';
// Société
// Soci<EFBFBD>t<EFBFBD>
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
// Note publique
@ -126,7 +126,7 @@ if ($_GET['id'])
}
print "</td></tr>";
// Note privée
// Note priv<EFBFBD>e
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
@ -146,7 +146,7 @@ if ($_GET['id'])
}
print "</td></tr>";
}
print "</table>";
print '</div>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -28,20 +28,19 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter');
llxHeader();
/*
* Liste
*
* View
*/
llxHeader();
if ($sortorder == "")
{
$sortorder="ASC";
$sortorder="ASC";
}
if ($sortfield == "")
{
$sortfield="f.datei";
$sortfield="f.datei";
}
if ($page == -1) { $page = 0 ; }
@ -61,13 +60,13 @@ $sql.= " AND f.entity = ".$conf->entity;
if ($socid > 0)
{
$sql .= " AND s.rowid = " . $socid;
$sql .= " AND s.rowid = " . $socid;
}
if (empty ($MM))
$MM=strftime("%m",time());
$MM=strftime("%m",time());
if (empty($YY))
$YY=strftime("%Y",time());;
$YY=strftime("%Y",time());;
echo "<div class='noprint'>";
echo "\n<form action='rapport.php'>";
echo "<input type='hidden' name='socid' value='".$socid."'>";
@ -80,13 +79,13 @@ echo "</div>";
$start="$YY-$MM-01 00:00:00";
if ($MM ==12)
{
$y = $YY+1;
$end="$y-01-01 00:00:00";
$y = $YY+1;
$end="$y-01-01 00:00:00";
}
else
{
$m = $MM+1;
$end="$YY-$m-01 00:00:00";
$m = $MM+1;
$end="$YY-$m-01 00:00:00";
}
$sql .= " AND datei >= '".$start."' AND datei < '".$end."'" ;
@ -94,52 +93,51 @@ $sql .= " ORDER BY $sortfield $sortorder ";
if ( $db->query($sql) )
{
$num = $db->num_rows();
$title = $langs->trans("Report")." ".dol_print_date(strtotime($start),"%B %Y");
print_barre_liste($title, $page, "rapport.php","&socid=".$socid,$sortfield,$sortorder,'',$num);
$num = $db->num_rows();
$title = $langs->trans("Report")." ".dol_print_date(strtotime($start),"%B %Y");
print_barre_liste($title, $page, "rapport.php","&socid=".$socid,$sortfield,$sortorder,'',$num);
$i = 0;
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="3">';
print "<tr class=\"liste_titre\">";
print '<td>Num</td>';
if (empty($socid))
print '<td>'.$langs->trans("Customers").'</td>';
print '<td align="center">'.$langs->trans("Description").'</td>';
$i = 0;
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="3">';
print "<tr class=\"liste_titre\">";
print '<td>Num</td>';
if (empty($socid))
print '<td>'.$langs->trans("Customers").'</td>';
print '<td align="center">'.$langs->trans("Description").'</td>';
print '<td align="center">Date</td>';
print '<td align="center">'.$langs->trans("Duration").'</td>';
print "</tr>\n";
$var=True;
$DureeTotal = 0;
while ($i < $num)
{
$objp = $db->fetch_object();
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="fiche.php?id='.$objp->fichid.'">'.$objp->ref.'</a></td>\n';
print '<td align="center">Date</td>';
print '<td align="center">'.$langs->trans("Duration").'</td>';
print "</tr>\n";
$var=True;
$DureeTotal = 0;
while ($i < $num)
{
$objp = $db->fetch_object();
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="fiche.php?id='.$objp->fichid.'">'.$objp->ref.'</a></td>\n';
if (empty($socid))
{
if (!empty($MM))
$filter="&MM=$MM&YY=$YY";
print '<td><a href="rapport.php?socid='.$objp->socid.$filter.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/filter.png" border="0"></a>&nbsp;';
print "<a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->rowid.$filter."\">".$objp->nom."</a></TD>\n";
}
print '<td>'.nl2br($objp->description).'</td>';
print "<td>".dol_print_date($objp->dp,"%d %B %Y")."</td>\n";
print '<td align="center">'.sprintf("%.1f",$objp->duree).'</td>';
$DureeTotal += $objp->duree;
print "</tr>\n";
if (empty($socid))
{
if (!empty($MM)) $filter="&MM=$MM&YY=$YY";
print '<td><a href="rapport.php?socid='.$objp->socid.$filter.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/filter.png" border="0"></a>&nbsp;';
print "<a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->rowid.$filter."\">".$objp->nom."</a></TD>\n";
}
print '<td>'.nl2br($objp->description).'</td>';
print "<td>".dol_print_date($objp->dp,"%d %B %Y")."</td>\n";
print '<td align="center">'.sprintf("%.1f",$objp->duree).'</td>';
$DureeTotal += $objp->duree;
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
print "<br />".$langs->trans("Total")." $DureeTotal jour[s]";
$i++;
}
print "</table>";
$db->free();
print "<br />".$langs->trans("Total")." $DureeTotal jour[s]";
}
else
{
dol_print_error($db);
dol_print_error($db);
}
$db->close();

View File

@ -56,11 +56,11 @@ if ($_POST["action"] == 'add')
$db->begin();
// Creation de l'objet livraison
$livraison = new Livraison($db);
$delivery = new Livraison($db);
$livraison->date_livraison = time();
$livraison->note = $_POST["note"];
$livraison->commande_id = $_POST["commande_id"];
$delivery->date_livraison = time();
$delivery->note = $_POST["note"];
$delivery->commande_id = $_POST["commande_id"];
if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
{
@ -70,7 +70,7 @@ if ($_POST["action"] == 'add')
// On boucle sur chaque ligne de commande pour completer objet livraison
// avec qte a livrer
$commande = new Commande($db);
$commande->fetch($livraison->commande_id);
$commande->fetch($delivery->commande_id);
$commande->fetch_lines();
for ($i = 0 ; $i < sizeof($commande->lignes) ; $i++)
{
@ -78,21 +78,21 @@ if ($_POST["action"] == 'add')
$idl = "idl".$i;
if ($_POST[$qty] > 0)
{
$livraison->addline($_POST[$idl],$_POST[$qty]);
$delivery->addline($_POST[$idl],$_POST[$qty]);
}
}
$ret=$livraison->create($user);
$ret=$delivery->create($user);
if ($ret > 0)
{
$db->commit();
Header("Location: fiche.php?id=".$livraison->id);
Header("Location: fiche.php?id=".$delivery->id);
exit;
}
else
{
$db->rollback();
$mesg='<div class="error">'.$livraison->error.'</div>';
$mesg='<div class="error">'.$delivery->error.'</div>';
$_GET["commande_id"]=$_POST["commande_id"];
$_GET["action"]='create';
}
@ -100,20 +100,38 @@ if ($_POST["action"] == 'add')
if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $user->rights->expedition->livraison->valider)
{
$livraison = new Livraison($db);
$livraison->fetch($_GET["id"]);
$result = $livraison->valid($user);
//$livraison->PdfWrite();
$delivery = new Livraison($db);
$delivery->fetch($_GET["id"]);
$delivery->fetch_client();
$result = $delivery->valid($user);
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$delivery->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=delivery_order_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
}
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->expedition->livraison->supprimer)
{
$livraison = new Livraison($db);
$livraison->fetch($_GET["id"]);
$expedition_id = $livraison->expedition_id;
$delivery = new Livraison($db);
$delivery->fetch($_GET["id"]);
$expedition_id = $delivery->expedition_id;
$db->begin();
$result=$livraison->delete();
$result=$delivery->delete();
if ($result > 0)
{
@ -147,11 +165,15 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$delivery->setDocModel($user, $_REQUEST['model']);
}
// Define output language
$outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$delivery->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$outputlangs->setDefaultLang($newlang);
}
$result=delivery_order_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
if ($result <= 0)
@ -364,34 +386,34 @@ else
{
if ($_GET["id"] > 0)
{
$livraison = new Livraison($db);
$result = $livraison->fetch($_GET["id"]);
$livraison->fetch_client();
$delivery = new Livraison($db);
$result = $delivery->fetch($_GET["id"]);
$delivery->fetch_client();
$expedition=new Expedition($db);
$result = $expedition->fetch($livraison->expedition_id);
$result = $expedition->fetch($delivery->expedition_id);
$typeobject = $expedition->origin;
if ($livraison->origin_id)
if ($delivery->origin_id)
{
$object = $livraison->origin;
$livraison->fetch_object();
$object = $delivery->origin;
$delivery->fetch_object();
}
if ( $livraison->id > 0)
if ( $delivery->id > 0)
{
$soc = new Societe($db);
$soc->fetch($livraison->socid);
$soc->fetch($delivery->socid);
$h=0;
if ($conf->expedition_bon->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$livraison->expedition_id;
$head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$delivery->expedition_id;
$head[$h][1] = $langs->trans("SendingCard");
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$livraison->id;
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$delivery->id;
$head[$h][1] = $langs->trans("DeliveryCard");
$hselected = $h;
$h++;
@ -405,7 +427,7 @@ else
if ($_GET["action"] == 'delete')
{
$expedition_id = $_GET["expid"];
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&amp;expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm"),'confirm_delete','','',1);
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&amp;expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm"),'confirm_delete','','',1);
if ($ret == 'html') print '<br>';
}
@ -415,7 +437,7 @@ else
*/
if ($_GET["action"] == 'valid')
{
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid','','',1);
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid','','',1);
if ($ret == 'html') print '<br>';
}
@ -427,7 +449,7 @@ else
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$livraison->ref.'</td></tr>';
print '<td colspan="3">'.$delivery->ref.'</td></tr>';
// Client
print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
@ -458,24 +480,24 @@ else
// Ref client
print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
print '<td colspan="3">'.$livraison->ref_client."</a></td>\n";
print '<td colspan="3">'.$delivery->ref_client."</a></td>\n";
print '</tr>';
// Date
print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="3">'.dol_print_date($livraison->date_creation,'dayhourtext')."</td>\n";
print '<td colspan="3">'.dol_print_date($delivery->date_creation,'dayhourtext')."</td>\n";
print '</tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="3">'.$livraison->getLibStatut(4)."</td>\n";
print '<td colspan="3">'.$delivery->getLibStatut(4)."</td>\n";
print '</tr>';
if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
{
// Entrepot
$entrepot = new Entrepot($db);
$entrepot->fetch($livraison->entrepot_id);
$entrepot->fetch($delivery->entrepot_id);
print '<tr><td width="20%">'.$langs->trans("Warehouse").'</td>';
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td>';
print '</tr>';
@ -487,7 +509,7 @@ else
* Lignes produits
*/
$num_prod = sizeof($livraison->lignes);
$num_prod = sizeof($delivery->lignes);
$i = 0; $total = 0;
print '<table class="noborder" width="100%">';
@ -508,40 +530,40 @@ else
$var=!$var;
print "<tr $bc[$var]>";
if ($livraison->lignes[$i]->fk_product > 0)
if ($delivery->lignes[$i]->fk_product > 0)
{
$product = new Product($db);
$product->fetch($livraison->lignes[$i]->fk_product);
$product->fetch($delivery->lignes[$i]->fk_product);
print '<td>';
// Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$livraison->lignes[$i]->fk_product.'">';
if ($livraison->lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$delivery->lignes[$i]->fk_product.'">';
if ($delivery->lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$livraison->lignes[$i]->ref.'</a>';
$text.= ' - '.$livraison->lignes[$i]->label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($livraison->lignes[$i]->description));
$text.= ' '.$delivery->lignes[$i]->ref.'</a>';
$text.= ' - '.$delivery->lignes[$i]->label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($delivery->lignes[$i]->description));
//print $description;
print $html->textwithtooltip($text,$description,3,'','',$i);
print_date_range($livraison->lignes[$i]->date_start,$livraison->lignes[$i]->date_end);
print_date_range($delivery->lignes[$i]->date_start,$delivery->lignes[$i]->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print ($livraison->lignes[$i]->description && $livraison->lignes[$i]->description!=$livraison->lignes[$i]->label)?'<br>'.dol_htmlentitiesbr($livraison->lignes[$i]->description):'';
print ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)?'<br>'.dol_htmlentitiesbr($delivery->lignes[$i]->description):'';
}
}
else
{
print "<td>";
if ($livraison->lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
if ($delivery->lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($livraison->lignes[$i]->description);
print $text.' '.nl2br($delivery->lignes[$i]->description);
print_date_range($objp->date_start,$objp->date_end);
print "</td>\n";
}
print '<td align="center">'.$livraison->lignes[$i]->qty_asked.'</td>';
print '<td align="center">'.$livraison->lignes[$i]->qty_shipped.'</td>';
print '<td align="center">'.$delivery->lignes[$i]->qty_asked.'</td>';
print '<td align="center">'.$delivery->lignes[$i]->qty_shipped.'</td>';
print "</tr>";
@ -563,20 +585,20 @@ else
// if (! preg_match('/^(valid|delete)/i',$_REQUEST["action"]))
// {
if ($livraison->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
if ($delivery->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
{
print '<a class="butAction" href="fiche.php?id='.$livraison->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
print '<a class="butAction" href="fiche.php?id='.$delivery->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
}
if ($user->rights->expedition->livraison->supprimer)
{
if ($conf->expedition_bon->enabled)
{
print '<a class="butActionDelete" href="fiche.php?id='.$livraison->id.'&amp;expid='.$livraison->expedition_id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
print '<a class="butActionDelete" href="fiche.php?id='.$delivery->id.'&amp;expid='.$delivery->expedition_id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
else
{
print '<a class="butActionDelete" href="fiche.php?id='.$livraison->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
print '<a class="butActionDelete" href="fiche.php?id='.$delivery->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
}
// }
@ -591,14 +613,14 @@ else
* Documents generated
*/
$livraisonref = dol_sanitizeFileName($livraison->ref);
$filedir = $conf->expedition->dir_output . "/receipt/" . $livraisonref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
$deliveryref = dol_sanitizeFileName($delivery->ref);
$filedir = $conf->expedition->dir_output . "/receipt/" . $deliveryref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$delivery->id;
$genallowed=$user->rights->expedition->livraison->creer;
$delallowed=$user->rights->expedition->livraison->supprimer;
$somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
$somethingshown=$formfile->show_documents('livraison',$deliveryref,$filedir,$urlsource,$genallowed,$delallowed,$delivery->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
if ($genallowed && ! $somethingshown) $somethingshown=1;
print '</td><td valign="top" width="50%">';