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

This commit is contained in:
simnandez 2013-01-12 09:58:21 +01:00
parent 22dcb7ee6a
commit 96c5eacf4a
2 changed files with 92 additions and 76 deletions

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -1804,7 +1804,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)) if (empty($origin) && empty($originid) && $socid)
{ {
$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';
@ -1834,16 +1834,27 @@ if ($action == 'create')
$db->free($resql); $db->free($resql);
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
} }
// Tiers // Tiers
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td><td colspan="2">'; print '<tr>';
print $soc->getNomUrl(1); print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
print '<input type="hidden" name="socid" value="'.$soc->id.'">'; if($socid)
print '</td>'; {
print '<td colspan="2">';
print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
print '</td>';
}
else
{
print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1',1);
print '</td>';
}
print '</tr>'."\n"; print '</tr>'."\n";
// Type de facture // Type de facture
@ -1916,72 +1927,77 @@ if ($action == 'create')
print $desc; print $desc;
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
// Replacement if ($socid)
print '<tr height="18"><td valign="middle">'; {
print '<input type="radio" name="type" value="1"'.(GETPOST('type')==1?' checked="checked"':''); // Replacement
if (! $options) print ' disabled="disabled"'; print '<tr height="18"><td valign="middle">';
print '>'; print '<input type="radio" name="type" value="1"'.(GETPOST('type')==1?' checked="checked"':'');
print '</td><td valign="middle">'; if (! $options) print ' disabled="disabled"';
$text=$langs->trans("InvoiceReplacementAsk").' '; print '>';
$text.='<select class="flat" name="fac_replacement" id="fac_replacement"'; print '</td><td valign="middle">';
if (! $options) $text.=' disabled="disabled"'; $text=$langs->trans("InvoiceReplacementAsk").' ';
$text.='>'; $text.='<select class="flat" name="fac_replacement" id="fac_replacement"';
if ($options) if (! $options) $text.=' disabled="disabled"';
{ $text.='>';
$text.='<option value="-1"></option>'; if ($options)
$text.=$options; {
} $text.='<option value="-1"></option>';
else $text.=$options;
{ }
$text.='<option value="-1">'.$langs->trans("NoReplacableInvoice").'</option>'; else
} {
$text.='</select>'; $text.='<option value="-1">'.$langs->trans("NoReplacableInvoice").'</option>';
$desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); }
print $desc; $text.='</select>';
print '</td></tr>'."\n"; $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1);
print $desc;
// Credit note print '</td></tr>'."\n";
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="2"'.(GETPOST('type')==2?' checked=true':''); // Credit note
if (! $optionsav) print ' disabled="disabled"'; print '<tr height="18"><td valign="middle">';
print '>'; print '<input type="radio" name="type" value="2"'.(GETPOST('type')==2?' checked=true':'');
print '</td><td valign="middle">'; if (! $optionsav) print ' disabled="disabled"';
$text=$langs->transnoentities("InvoiceAvoirAsk").' '; print '>';
// $text.='<input type="text" value="">'; print '</td><td valign="middle">';
$text.='<select class="flat" name="fac_avoir" id="fac_avoir"'; $text=$langs->transnoentities("InvoiceAvoirAsk").' ';
if (! $optionsav) $text.=' disabled="disabled"'; // $text.='<input type="text" value="">';
$text.='>'; $text.='<select class="flat" name="fac_avoir" id="fac_avoir"';
if ($optionsav) if (! $optionsav) $text.=' disabled="disabled"';
{ $text.='>';
$text.='<option value="-1"></option>'; if ($optionsav)
$text.=$optionsav; {
} $text.='<option value="-1"></option>';
else $text.=$optionsav;
{ }
$text.='<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>'; else
} {
$text.='</select>'; $text.='<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>';
$desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); }
print $desc; $text.='</select>';
print '</td></tr>'."\n"; $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1);
print $desc;
print '</table>'; print '</td></tr>'."\n";
print '</td></tr>'; }
print '</table>';
// Discounts for third party print '</td></tr>';
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.$soc->remise_client.'</a>'); if($socid)
else print $langs->trans("CompanyHasNoRelativeDiscount"); {
print ' <a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">('.$langs->trans("EditRelativeDiscount").')</a>'; // Discounts for third party
print '. '; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
print '<br>'; if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.$soc->remise_client.'</a>');
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.price($absolute_discount).'</a>',$langs->trans("Currency".$conf->currency)); else print $langs->trans("CompanyHasNoRelativeDiscount");
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); print ' <a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">('.$langs->trans("EditRelativeDiscount").')</a>';
print ' <a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">('.$langs->trans("EditGlobalDiscounts").')</a>'; print '. ';
print '.'; print '<br>';
print '</td></tr>'; if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.price($absolute_discount).'</a>',$langs->trans("Currency".$conf->currency));
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
print ' <a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">('.$langs->trans("EditGlobalDiscounts").')</a>';
print '.';
print '</td></tr>';
}
// Date invoice // Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">'; print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
$form->select_date($dateinvoice,'','','','',"add",1,1); $form->select_date($dateinvoice,'','','','',"add",1,1);
@ -1998,7 +2014,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled) && $socid)
{ {
$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">';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -913,7 +913,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills');
if (empty($user->societe_id)) if (empty($user->societe_id))
{ {
$newmenu->add("/compta/clients.php?action=facturer&amp;leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer); $newmenu->add("/compta/facture.php?action=create&amp;leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer);
} }
$newmenu->add("/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),1,$user->rights->facture->lire); $newmenu->add("/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),1,$user->rights->facture->lire);