Qual: Reduce size of form.class
This commit is contained in:
parent
db7ac346e8
commit
475bba2ea7
@ -92,9 +92,9 @@ $hookmanager->callHooks(array('propalcard'));
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/*
|
||||||
/* Actions */
|
* Actions
|
||||||
/******************************************************************************/
|
*/
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -1358,11 +1358,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($action == 'editdelivery_address')
|
if ($action == 'editdelivery_address')
|
||||||
{
|
{
|
||||||
$form->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid'),'fk_address','propal',$object->id);
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid'),'fk_address','propal',$object->id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$form->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid'),'none','propal',$object->id);
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid'),'none','propal',$object->id);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formorder.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formorder.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/modules/commande/modules_commande.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/modules/commande/modules_commande.php");
|
||||||
@ -1185,6 +1186,7 @@ llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
$formorder = new FormOrder($db);
|
$formorder = new FormOrder($db);
|
||||||
|
|
||||||
|
|
||||||
@ -1324,9 +1326,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
// Delivery address
|
// Delivery address
|
||||||
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
|
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
|
||||||
{
|
{
|
||||||
// Link to edit: $form->form_address($_SERVER['PHP_SELF'].'?action=create','',$soc->id,'adresse_livraison_id','commande','');
|
|
||||||
print '<tr><td nowrap="nowrap">'.$langs->trans('DeliveryAddress').'</td><td colspan="2">';
|
print '<tr><td nowrap="nowrap">'.$langs->trans('DeliveryAddress').'</td><td colspan="2">';
|
||||||
$numaddress = $form->select_address($soc->fk_delivery_address, $socid,'fk_address',1);
|
$numaddress = $formother->select_address($soc->fk_delivery_address, $socid,'fk_address',1);
|
||||||
print ' <a href="../comm/address.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddAddress").'</a>';
|
print ' <a href="../comm/address.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddAddress").'</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2721,50 +2721,6 @@ class Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show form to select addresse
|
|
||||||
*
|
|
||||||
* @param page Page
|
|
||||||
* @param selected Id condition pre-selectionne
|
|
||||||
* @param htmlname Nom du formulaire select
|
|
||||||
* @param origin Origine de l'appel pour pouvoir creer un retour
|
|
||||||
* @param originid Id de l'origine
|
|
||||||
* @return void
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
function form_address($page, $selected='', $socid, $htmlname='address_id', $origin='', $originid='')
|
|
||||||
{
|
|
||||||
global $langs,$conf;
|
|
||||||
if ($htmlname != "none")
|
|
||||||
{
|
|
||||||
print '<form method="post" action="'.$page.'">';
|
|
||||||
print '<input type="hidden" name="action" value="setaddress">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
|
||||||
print '<tr><td>';
|
|
||||||
$this->select_address($selected, $socid, $htmlname, 1);
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
|
||||||
$langs->load("companies");
|
|
||||||
print ' <a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$socid.'&action=create&origin='.$origin.'&originid='.$originid.'>'.$langs->trans("AddAddress").'</a>';
|
|
||||||
print '</td></tr></table></form>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($selected)
|
|
||||||
{
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/societe/class/address.class.php");
|
|
||||||
$address=new Address($this->db);
|
|
||||||
$result=$address->fetch_address($selected);
|
|
||||||
print '<a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$address->socid.'&id='.$address->id.'&action=edit&origin='.$origin.'&originid='.$originid.'>'.$address->label.'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne la liste des devises, dans la langue de l'utilisateur
|
* Retourne la liste des devises, dans la langue de l'utilisateur
|
||||||
*
|
*
|
||||||
|
|||||||
@ -542,7 +542,7 @@ class FormOther
|
|||||||
function select_month($selected='',$htmlname='monthid',$useempty=0)
|
function select_month($selected='',$htmlname='monthid',$useempty=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||||
|
|
||||||
$montharray = monthArray($langs); // Get array
|
$montharray = monthArray($langs); // Get array
|
||||||
@ -713,6 +713,52 @@ function PLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selecte
|
|||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show form to select addresse
|
||||||
|
*
|
||||||
|
* @param int $page Page
|
||||||
|
* @param string $selected Id condition pre-selectionne
|
||||||
|
* @param string $htmlname Nom du formulaire select
|
||||||
|
* @param string $origin Origine de l'appel pour pouvoir creer un retour
|
||||||
|
* @param int $originid Id de l'origine
|
||||||
|
* @return void
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
function form_address($page, $selected='', $socid, $htmlname='address_id', $origin='', $originid='')
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
if ($htmlname != "none")
|
||||||
|
{
|
||||||
|
print '<form method="post" action="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="action" value="setaddress">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||||
|
print '<tr><td>';
|
||||||
|
$this->select_address($selected, $socid, $htmlname, 1);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
$langs->load("companies");
|
||||||
|
print ' <a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$socid.'&action=create&origin='.$origin.'&originid='.$originid.'>'.$langs->trans("AddAddress").'</a>';
|
||||||
|
print '</td></tr></table></form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($selected)
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/societe/class/address.class.php");
|
||||||
|
$address=new Address($this->db);
|
||||||
|
$result=$address->fetch_address($selected);
|
||||||
|
print '<a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$address->socid.'&id='.$address->id.'&action=edit&origin='.$origin.'&originid='.$originid.'>'.$address->label.'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -28,8 +28,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/sendings.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/sendings.lib.php");
|
||||||
@ -482,6 +483,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
llxHeader('',$langs->trans('Sending'),'Expedition');
|
llxHeader('',$langs->trans('Sending'),'Expedition');
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
$formproduct = new FormProduct($db);
|
$formproduct = new FormProduct($db);
|
||||||
|
|
||||||
@ -580,7 +582,7 @@ if ($action == 'create')
|
|||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if (!empty($object->fk_delivery_address))
|
if (!empty($object->fk_delivery_address))
|
||||||
{
|
{
|
||||||
$form->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$_GET['socid'],'none','commande',$object->id);
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$_GET['socid'],'none','commande',$object->id);
|
||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
@ -1006,7 +1008,7 @@ else
|
|||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if (!empty($object->fk_delivery_address))
|
if (!empty($object->fk_delivery_address))
|
||||||
{
|
{
|
||||||
$form->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->deliveryaddress->socid,'none','shipment',$object->id);
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->deliveryaddress->socid,'none','shipment',$object->id);
|
||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,8 +25,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/order.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/order.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/sendings.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/sendings.lib.php");
|
||||||
@ -117,21 +118,20 @@ if ($_POST['action'] == 'setconditions' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formproduct = new FormProduct($db);
|
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
$formproduct = new FormProduct($db);
|
||||||
/* *************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* Mode vue et edition */
|
|
||||||
/* */
|
|
||||||
/* *************************************************************************** */
|
|
||||||
|
|
||||||
llxHeader('',$langs->trans('OrderCard'),'');
|
llxHeader('',$langs->trans('OrderCard'),'');
|
||||||
|
|
||||||
$id = $_GET['id'];
|
$id = GETPSOT('id');
|
||||||
$ref= $_GET['ref'];
|
$ref= GETPOST('ref');
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
@ -287,11 +287,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($_GET['action'] == 'editdelivery_adress')
|
if ($_GET['action'] == 'editdelivery_adress')
|
||||||
{
|
{
|
||||||
$form->form_address($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'delivery_address_id','commande',$commande->id);
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'delivery_address_id','commande',$commande->id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$form->form_address($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'none','commande',$commande->id);
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'none','commande',$commande->id);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -440,7 +440,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||||
{
|
{
|
||||||
$commande->fetch_thirdparty();
|
$commande->fetch_thirdparty();
|
||||||
$prod = new Product($db, $objp->fk_product);
|
$prod = new Product($db, $objp->fk_product);
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
@ -452,7 +452,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label;
|
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user