To change a bill owner if mistaking

This parameters should be used for troubleshooting using FACTURE_CHANGE_THIRDPARTY
This commit is contained in:
Philippe Grand 2011-06-29 15:48:02 +00:00
parent 4f68fc0c23
commit 092a3b6dd6
2 changed files with 64 additions and 6 deletions

View File

@ -26,7 +26,7 @@
* \file htdocs/compta/facture.php
* \ingroup facture
* \brief Page to create/see an invoice
* \version $Id$
* \version $Id: facture.php,v 1.839 2011/06/29 15:48:02 grandoc Exp $
*/
require('../main.inc.php');
@ -232,6 +232,14 @@ if ($action == 'valid')
}
}
if ($action == 'set_thirdparty')
{
$object->updateObjectField('facture',$id,'fk_soc',$socid);
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
exit;
}
if ($action == 'classin')
{
$object->fetch($id);
@ -2063,10 +2071,24 @@ else
print '</td></tr>';
// Third party
print '<tr><td>';
print '<table class="nobordernopadding" width="100%">';
print '<tr><td>'.$langs->trans('Company').'</td>';
print '<td colspan="5">'.$soc->getNomUrl(1,'compta');
print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)</td>';
print '</tr>';
print '</td><td colspan="5">';
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 '</tr></table>';
print '</td><td colspan="5">';
if ($action == 'editthirdparty')
{
$html->form_thirdparty($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,'socid');
}
else
{
print ' &nbsp;'.$soc->getNomUrl(1,'compta');
print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)';
}
print '</tr>';
// Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
@ -3174,5 +3196,5 @@ else
$db->close();
llxFooter('$Date$ - $Revision$');
llxFooter('$Date: 2011/06/29 15:48:02 $ - $Revision: 1.839 $');
?>

View File

@ -31,7 +31,7 @@
* \file htdocs/core/class/html.form.class.php
* \ingroup core
* \brief File of class with all html predefined components
* \version $Id: html.form.class.php,v 1.183 2011/06/29 11:22:36 eldy Exp $
* \version $Id: html.form.class.php,v 1.184 2011/06/29 15:48:03 grandoc Exp $
*/
@ -2511,6 +2511,42 @@ class Form
}
}
}
/**
* \brief Affiche formulaire de selection des tiers
* \param page Page
* \param selected Id contact pre-selectionne
* \param htmlname Nom du formulaire select
*/
function form_thirdparty($page, $selected='', $htmlname='socid')
{
global $langs;
if ($htmlname != "none")
{
print '<form method="post" action="'.$page.'">';
print '<input type="hidden" name="action" value="set_thirdparty">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
$num=$this->select_societes($selected , $htmlname);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
}
else
{
if ($selected)
{
require_once(DOL_DOCUMENT_ROOT ."/societe/class/societe.class.php");
$soc = new Societe($this->db);
$soc->fetch($selected);
print $soc->getNomUrl($langs);
} else {
print "&nbsp;";
}
}
}
/**
* \brief Affiche formulaire de selection de l'adresse