Uniformize code

This commit is contained in:
Laurent Destailleur 2016-02-15 14:27:35 +01:00
parent d4c3258385
commit f1f5c48337

View File

@ -533,12 +533,29 @@ else
$head[$h][1] = $langs->trans("CardBill"); $head[$h][1] = $langs->trans("CardBill");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
dol_fiche_head($head, 'card', $langs->trans("PredefinedInvoices"),0,'bill'); // Add a div dol_fiche_head($head, 'card', $langs->trans("RepeatableInvoice"),0,'bill'); // Add a div
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/fiche-rec.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
print '<td colspan="4">'.$object->titre.'</td>';
// Ref
print '<tr><td width="20%">' . $langs->trans('Ref') . '</td>';
print '<td colspan="5">';
$morehtmlref = '';
/*
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
$discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id);
if ($result > 0) {
$morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
}
if ($result < 0) {
dol_print_error('', $discount->error);
}*/
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Customer").'</td>'; print '<tr><td>'.$langs->trans("Customer").'</td>';
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'customer').'</td></tr>'; print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'customer').'</td></tr>';
@ -651,26 +668,25 @@ else
print "</table>"; print "</table>";
print '</div>'; print '<br>';
/* /*
* Recurrence * Recurrence
*/ */
$title = $langs->trans("Recurrence"); $title = $langs->trans("Recurrence");
print load_fiche_titre($title); print load_fiche_titre($title, '', 'calendar');
print '<div class="tabBar">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// if "frequency" is empty or = 0, the reccurence is disabled // if "frequency" is empty or = 0, the reccurence is disabled
print '<tr><td>'; print '<tr><td width="20%">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Frequency'); print $langs->trans('Frequency');
print '</td>'; print '</td>';
if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer) if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer)
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&amp;facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>'; print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&amp;facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="5">';
if ($action == 'editfrequency') if ($action == 'editfrequency')
{ {
print '<form method="post" action="'.$_SERVER["PHP_SELF"] . '?facid=' . $object->id.'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"] . '?facid=' . $object->id.'">';
@ -685,7 +701,10 @@ else
} }
else else
{ {
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); if ($object->frequency > 0)
{
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
}
} }
print '</td></tr>'; print '</td></tr>';
@ -702,11 +721,13 @@ else
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer); print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
print '</td><td colspan="5">'; print '</td><td colspan="5">';
print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer); if ($object->nb_gen_max > 0) print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr><td width="25%">'.$langs->trans("RestPeriodNumber").'</td>'; print '<tr><td>'.$langs->trans("RestPeriodNumber").'</td>';
print '<td>'.($object->nb_gen_max-$object->nb_gen_done).'</td>'; print '<td>';
print ($object->nb_gen_max-$object->nb_gen_done);
print '</td>';
// Auto validate // Auto validate
print '<tr><td>'; print '<tr><td>';
@ -718,22 +739,14 @@ else
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</div>';
print '<br />'; print '<br>';
/* /*
* Lines * Lines
*/ */
$title = $langs->trans("ProductsAndServices"); print '<table class="noborder noshadow" width="100%">';
if (empty($conf->service->enabled))
$title = $langs->trans("Products");
else if (empty($conf->product->enabled))
$title = $langs->trans("Services");
print load_fiche_titre($title);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td align="right">'.$langs->trans("Price").'</td>'; print '<td align="right">'.$langs->trans("Price").'</td>';
@ -818,6 +831,7 @@ else
} }
print '</table>'; print '</table>';
dol_fiche_end();
/** /**