New: Add direct link to discount on invoice creation page

This commit is contained in:
Laurent Destailleur 2011-09-08 21:50:41 +00:00
parent 4f0830629a
commit b8558678c2
3 changed files with 42 additions and 25 deletions

View File

@ -19,7 +19,7 @@
/** /**
* \file htdocs/comm/remise.php * \file htdocs/comm/remise.php
* \ingroup societe * \ingroup societe
* \brief Onglet remise de la societe * \brief Page to edit relative discount of a customer
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -30,7 +30,7 @@ $langs->load("companies");
$langs->load("orders"); $langs->load("orders");
$langs->load("bills"); $langs->load("bills");
$_socid = $_GET["id"]; $_socid = GETPOST("id");
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
@ -38,7 +38,17 @@ if ($user->societe_id > 0)
} }
if ($_POST["action"] == 'setremise') /*
* Actions
*/
if (GETPOST('cancel') && GETPOST('backtopage'))
{
Header("Location: ".GETPOST("backtopage"));
exit;
}
if (GETPOST("action") == 'setremise')
{ {
$soc = New Societe($db); $soc = New Societe($db);
$soc->fetch($_GET["id"]); $soc->fetch($_GET["id"]);
@ -110,6 +120,7 @@ if ($_socid > 0)
print '<form method="POST" action="remise.php?id='.$objsoc->id.'">'; print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">'; print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage').'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -123,7 +134,14 @@ if ($_socid > 0)
print "</table>"; print "</table>";
print '<center><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center>'; print '<center>';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
if (GETPOST("backtopage"))
{
print '&nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</center>';
print "</form>"; print "</form>";

View File

@ -33,7 +33,7 @@ $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
// Security check // Security check
$_socid = $_GET["id"]; $_socid = GETPOST("id");
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$_socid = $user->societe_id; $_socid = $user->societe_id;

View File

@ -109,6 +109,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
} }
} }
// Change status of invoice
if ($action == 'reopen' && $user->rights->facture->creer) if ($action == 'reopen' && $user->rights->facture->creer)
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -128,7 +129,7 @@ if ($action == 'reopen' && $user->rights->facture->creer)
} }
} }
// Suppression de la facture // Delete invoice
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer)
{ {
if ($user->rights->facture->supprimer) if ($user->rights->facture->supprimer)
@ -147,9 +148,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->
} }
} }
/* // Delete line
* Supprime une ligne produit AVEC ou SANS confirmation
*/
if ($action == 'confirm_deleteline' && $confirm == 'yes') if ($action == 'confirm_deleteline' && $confirm == 'yes')
{ {
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
@ -185,7 +184,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes')
} }
} }
// Supprime affectation d'un avoir a la facture // Delete link of credit note to invoice
if ($action == 'unlinkdiscount') if ($action == 'unlinkdiscount')
{ {
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
@ -226,8 +225,8 @@ if ($action == 'set_thirdparty')
{ {
$object->updateObjectField('facture',$id,'fk_soc',$socid); $object->updateObjectField('facture',$id,'fk_soc',$socid);
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
exit; exit;
} }
if ($action == 'classin') if ($action == 'classin')
@ -1291,7 +1290,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$object->actionmsg = $actionmsg; // Long text $object->actionmsg = $actionmsg; // Long text
$object->actionmsg2 = $actionmsg2; // Short text $object->actionmsg2 = $actionmsg2; // Short text
$object->fk_element = $object->id; $object->fk_element = $object->id;
$object->elementtype = $object->element; $object->elementtype = $object->element;
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@ -1658,10 +1657,10 @@ if ($action == 'create')
// 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">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); 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>');
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. '; print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie)); 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->monnaie));
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); else print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '.'; print '.';
print '</td></tr>'; print '</td></tr>';
@ -2069,24 +2068,24 @@ else
print '</td></tr>'; print '</td></tr>';
// Third party // Third party
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%">'; print '<table class="nobordernopadding" width="100%">';
print '<tr><td>'.$langs->trans('Company').'</td>'; print '<tr><td>'.$langs->trans('Company').'</td>';
print '</td><td colspan="5">'; print '</td><td colspan="5">';
if ($conf->global->FACTURE_CHANGE_THIRDPARTY && $action != 'editthirdparty' && $object->brouillon && $user->rights->facture->creer) if ($conf->global->FACTURE_CHANGE_THIRDPARTY && $action != 'editthirdparty' && $object->brouillon && $user->rights->facture->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="5">'; print '</td><td colspan="5">';
if ($action == 'editthirdparty') if ($action == 'editthirdparty')
{ {
$html->form_thirdparty($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,'socid'); $html->form_thirdparty($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,'socid');
} }
else else
{ {
print ' &nbsp;'.$soc->getNomUrl(1,'compta'); print ' &nbsp;'.$soc->getNomUrl(1,'compta');
print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)'; print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)';
} }
print '</tr>'; print '</tr>';
// Type // Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';