Fix: move class in template

This commit is contained in:
Regis Houssin 2012-10-18 10:35:55 +02:00
parent 4afdf2f2d2
commit 446a81b4c4
8 changed files with 37 additions and 55 deletions

View File

@ -1591,9 +1591,6 @@ print '</table><br>';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany= new FormCompany($db);
$blocname = 'contacts'; $blocname = 'contacts';
$title = $langs->trans('ContactsAddresses'); $title = $langs->trans('ContactsAddresses');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';

View File

@ -1260,9 +1260,9 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
} }
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
{ {
if ($action == 'addcontact' && $user->rights->commande->creer) if ($action == 'addcontact')
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
@ -1290,7 +1290,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
} }
// bascule du statut d'un contact // bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->commande->creer) else if ($action == 'swapstatut')
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
@ -1303,7 +1303,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
} }
// Efface un contact // Efface un contact
else if ($action == 'deletecontact' && $user->rights->commande->creer) else if ($action == 'deletecontact')
{ {
$result = $object->delete_contact($lineid); $result = $object->delete_contact($lineid);
@ -2101,9 +2101,6 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany= new FormCompany($db);
$blocname = 'contacts'; $blocname = 'contacts';
$title = $langs->trans('ContactsAddresses'); $title = $langs->trans('ContactsAddresses');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';

View File

@ -1629,9 +1629,9 @@ else if ($action == 'remove_file')
} }
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer)
{ {
if ($action == 'addcontact' && $user->rights->facture->creer) if ($action == 'addcontact')
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -1661,7 +1661,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// bascule du statut d'un contact // bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->facture->creer) else if ($action == 'swapstatut')
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
@ -1674,7 +1674,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// Efface un contact // Efface un contact
else if ($action == 'deletecontact' && $user->rights->facture->creer) else if ($action == 'deletecontact')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->delete_contact($lineid); $result = $object->delete_contact($lineid);
@ -2980,10 +2980,6 @@ else if ($id > 0 || ! empty($ref))
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany= new FormCompany($db);
$blocname = 'contacts'; $blocname = 'contacts';
$title = $langs->trans('ContactsAddresses'); $title = $langs->trans('ContactsAddresses');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';

View File

@ -486,9 +486,9 @@ else if ($action == 'setnote' && $user->rights->contrat->creer)
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer)
{ {
if ($action == 'addcontact' && $user->rights->contrat->creer) if ($action == 'addcontact')
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -518,7 +518,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// bascule du statut d'un contact // bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->contrat->creer) else if ($action == 'swapstatut')
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
@ -531,7 +531,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// Efface un contact // Efface un contact
else if ($action == 'deletecontact' && $user->rights->contrat->creer) else if ($action == 'deletecontact')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->delete_contact(GETPOST('lineid')); $result = $object->delete_contact(GETPOST('lineid'));
@ -814,9 +814,6 @@ else
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany= new FormCompany($db);
$blocname = 'contacts'; $blocname = 'contacts';
$title = $langs->trans('ContactsAddresses'); $title = $langs->trans('ContactsAddresses');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
@ -830,7 +827,7 @@ else
} }
$servicepos=(isset($_REQUEST["servicepos"])?$_REQUEST["servicepos"]:1); $servicepos=(GETPOST('servicepos')?GETPOST('servicepos'):1); // FIXME : not used ?
$colorb='666666'; $colorb='666666';
$arrayothercontracts=$object->getListOfContracts('others'); $arrayothercontracts=$object->getListOfContracts('others');

View File

@ -16,6 +16,13 @@
* *
*/ */
if (! class_exists('Contact')) {
require DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
}
if (! class_exists('FormCompany')) {
require DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
}
$module = $object->element; $module = $object->element;
// Special cases // Special cases
@ -25,6 +32,7 @@ elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur-
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; }
elseif (! isset($permission)) { $permission=$user->rights->$module->creer; } // If already defined by caller page elseif (! isset($permission)) { $permission=$user->rights->$module->creer; } // If already defined by caller page
$formcompany= new FormCompany($db);
$companystatic=new Societe($db); $companystatic=new Societe($db);
$contactstatic=new Contact($db); $contactstatic=new Contact($db);
$userstatic=new User($db); $userstatic=new User($db);

View File

@ -648,9 +648,9 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA
$action='presend'; $action='presend';
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer)
{ {
if ($action == 'addcontact' && $user->rights->ficheinter->creer) if ($action == 'addcontact')
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -680,7 +680,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// bascule du statut d'un contact // bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->ficheinter->creer) else if ($action == 'swapstatut')
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
@ -693,7 +693,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// Efface un contact // Efface un contact
else if ($action == 'deletecontact' && $user->rights->ficheinter->creer) else if ($action == 'deletecontact')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->delete_contact(GETPOST('lineid','int')); $result = $object->delete_contact(GETPOST('lineid','int'));
@ -957,10 +957,6 @@ else if ($id > 0 || ! empty($ref))
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany= new FormCompany($db);
$blocname = 'contacts'; $blocname = 'contacts';
$title = $langs->trans('ContactsAddresses'); $title = $langs->trans('ContactsAddresses');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';

View File

@ -876,9 +876,9 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
} }
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fournisseur->commande->creer)
{ {
if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer) if ($action == 'addcontact')
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -908,7 +908,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// bascule du statut d'un contact // bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer) else if ($action == 'swapstatut')
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
@ -921,7 +921,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// Efface un contact // Efface un contact
else if ($action == 'deletecontact' && $user->rights->fournisseur->commande->creer) else if ($action == 'deletecontact')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]); $result = $object->delete_contact($_GET["lineid"]);
@ -1253,10 +1253,6 @@ if ($id > 0 || ! empty($ref))
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$formcompany= new FormCompany($db);
$blocname = 'contacts'; $blocname = 'contacts';
$title = $langs->trans('ContactsAddresses'); $title = $langs->trans('ContactsAddresses');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';

View File

@ -443,7 +443,7 @@ elseif ($action == 'update_line')
$localtax1tx= get_localtax($_POST['tauxtva'], 1, $object->thirdparty); $localtax1tx= get_localtax($_POST['tauxtva'], 1, $object->thirdparty);
$localtax2tx= get_localtax($_POST['tauxtva'], 2, $object->thirdparty); $localtax2tx= get_localtax($_POST['tauxtva'], 2, $object->thirdparty);
$remise_percent=GETPOST('remise_percent'); $remise_percent=GETPOST('remise_percent');
$result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent);
if ($result >= 0) if ($result >= 0)
{ {
@ -500,7 +500,7 @@ elseif ($action == 'addline')
$localtax1tx= get_localtax($tauxtva, 1, $object->thirdparty); $localtax1tx= get_localtax($tauxtva, 1, $object->thirdparty);
$localtax2tx= get_localtax($tauxtva, 2, $object->thirdparty); $localtax2tx= get_localtax($tauxtva, 2, $object->thirdparty);
$remise_percent=GETPOST('remise_percent'); $remise_percent=GETPOST('remise_percent');
if (! $_POST['dp_desc']) if (! $_POST['dp_desc'])
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")).'</div>';
@ -842,9 +842,9 @@ elseif ($action == 'remove_file')
} }
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fournisseur->facture->creer)
{ {
if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer) if ($action == 'addcontact')
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -874,7 +874,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// bascule du statut d'un contact // bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->fournisseur->facture->creer) else if ($action == 'swapstatut')
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
@ -887,7 +887,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
} }
// Efface un contact // Efface un contact
else if ($action == 'deletecontact' && $user->rights->fournisseur->facture->creer) else if ($action == 'deletecontact')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]); $result = $object->delete_contact($_GET["lineid"]);
@ -1526,11 +1526,6 @@ else
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
print '<br>'; print '<br>';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$formcompany= new FormCompany($db);
$blocname = 'contacts'; $blocname = 'contacts';
$title = $langs->trans('ContactsAddresses'); $title = $langs->trans('ContactsAddresses');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
@ -1643,7 +1638,7 @@ else
print '<td align="right"><input size="1" name="qty" type="text" value="'.$object->lines[$i]->qty.'"></td>'; print '<td align="right"><input size="1" name="qty" type="text" value="'.$object->lines[$i]->qty.'"></td>';
print '<td align="right" nowrap="nowrap"><input size="1" name="remise_percent" type="text" value="'.$object->lines[$i]->remise_percent.'">%</td>'; print '<td align="right" nowrap="nowrap"><input size="1" name="remise_percent" type="text" value="'.$object->lines[$i]->remise_percent.'">%</td>';
print '<td align="right" nowrap="nowrap">&nbsp;</td>'; print '<td align="right" nowrap="nowrap">&nbsp;</td>';
print '<td align="right" nowrap="nowrap">&nbsp;</td>'; print '<td align="right" nowrap="nowrap">&nbsp;</td>';
@ -1701,7 +1696,7 @@ else
print '<td align="right">'.$object->lines[$i]->qty.'</td>'; print '<td align="right">'.$object->lines[$i]->qty.'</td>';
print '<td align="right">'.(($object->lines[$i]->remise_percent > 0)?$object->lines[$i]->remise_percent.'%':'').'</td>'; print '<td align="right">'.(($object->lines[$i]->remise_percent > 0)?$object->lines[$i]->remise_percent.'%':'').'</td>';
print '<td align="right" nowrap="nowrap">'.price($object->lines[$i]->total_ht).'</td>'; print '<td align="right" nowrap="nowrap">'.price($object->lines[$i]->total_ht).'</td>';
print '<td align="right" nowrap="nowrap">'.price($object->lines[$i]->total_ttc).'</td>'; print '<td align="right" nowrap="nowrap">'.price($object->lines[$i]->total_ttc).'</td>';