[ task #652 ] Reduce clicks into creaton of orders, invoices, etc.

This commit is contained in:
simnandez 2013-01-12 22:08:52 +01:00
parent 980bfde83e
commit b1369a2f01

View File

@ -593,6 +593,7 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
*/ */
else if ($action == 'add' && $user->rights->facture->creer) else if ($action == 'add' && $user->rights->facture->creer)
{ {
if ($socid>0)
$object->socid=GETPOST('socid','int'); $object->socid=GETPOST('socid','int');
$db->begin(); $db->begin();
@ -732,6 +733,12 @@ else if ($action == 'add' && $user->rights->facture->creer)
// Standard or deposit or proforma invoice // Standard or deposit or proforma invoice
if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0) if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0)
{ {
if (GETPOST('socid','int')<1)
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors');
}
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) if (empty($datefacture))
{ {
@ -1727,7 +1734,7 @@ if ($action == 'create')
print_fiche_titre($langs->trans('NewBill')); print_fiche_titre($langs->trans('NewBill'));
$soc = new Societe($db); $soc = new Societe($db);
if ($socid) $res=$soc->fetch($socid); if ($socid>1) $res=$soc->fetch($socid);
if (! empty($origin) && ! empty($originid)) if (! empty($origin) && ! empty($originid))
{ {
@ -1804,7 +1811,7 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
// Factures predefinies // Factures predefinies
if (empty($origin) && empty($originid) && $socid) if (empty($origin) && empty($originid) && $socid>1)
{ {
$sql = 'SELECT r.rowid, r.titre, r.total_ttc'; $sql = 'SELECT r.rowid, r.titre, r.total_ttc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as r'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as r';
@ -1842,7 +1849,7 @@ if ($action == 'create')
// Tiers // Tiers
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>'; print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
if($socid) if($socid>1)
{ {
print '<td colspan="2">'; print '<td colspan="2">';
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
@ -1928,7 +1935,7 @@ if ($action == 'create')
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
if ($socid) if ($socid>1)
{ {
// Replacement // Replacement
print '<tr height="18"><td valign="middle">'; print '<tr height="18"><td valign="middle">';
@ -1982,7 +1989,7 @@ if ($action == 'create')
print '</table>'; print '</table>';
print '</td></tr>'; print '</td></tr>';
if($socid) if($socid>1)
{ {
// Discounts for third party // Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
@ -2014,7 +2021,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Project // Project
if (! empty($conf->projet->enabled) && $socid) if (! empty($conf->projet->enabled) && $socid>1)
{ {
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';