Qual: Removed TODO and some useless code
This commit is contained in:
parent
1ac5e0887e
commit
17c32809e8
@ -213,6 +213,8 @@ abstract class ActionsContactCardCommon
|
||||
global $conf, $langs, $user, $canvas;
|
||||
global $form, $formcompany, $objsoc;
|
||||
|
||||
if ($action == 'create' || $action == 'edit') $this->assign_post($action);
|
||||
|
||||
foreach($this->object as $key => $value)
|
||||
{
|
||||
$this->tpl[$key] = $value;
|
||||
@ -395,7 +397,7 @@ abstract class ActionsContactCardCommon
|
||||
/**
|
||||
* Assigne les valeurs POST dans l'objet
|
||||
*/
|
||||
function assign_post()
|
||||
function assign_post($action)
|
||||
{
|
||||
global $langs, $mysoc;
|
||||
|
||||
|
||||
@ -51,14 +51,6 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assigne les valeurs POST dans l'objet
|
||||
*/
|
||||
function assign_post()
|
||||
{
|
||||
parent::assign_post();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign custom values for canvas
|
||||
*
|
||||
@ -69,7 +61,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
||||
global $conf, $db, $langs, $user;
|
||||
global $form;
|
||||
|
||||
parent::assign_values($action);
|
||||
parent::assign_values($action);
|
||||
|
||||
$this->tpl['title'] = $this->getTitle($action);
|
||||
$this->tpl['error'] = $this->error;
|
||||
|
||||
@ -47,22 +47,17 @@ if ($user->societe_id) $socid=$user->societe_id;
|
||||
$object = new Contact($db);
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
if ($id) $object->getCanvas($id);
|
||||
$object->getCanvas($id);
|
||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||
if (! empty($canvas))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||
$objcanvas = new Canvas($db,$action);
|
||||
$objcanvas->getCanvas('contact','contactcard',$canvas);
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = $objcanvas->restrictedArea($user, 'contact', $id, 'socpeople');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople'); // If we create a contact with no company (shared contacts), no check on write permission
|
||||
}
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople', '', '', '', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
@ -300,7 +295,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
// -----------------------------------------
|
||||
if ($action == 'create')
|
||||
{
|
||||
$objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values
|
||||
$objcanvas->assign_values($action); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
}
|
||||
@ -313,7 +307,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
$object->fetch($id,$user);
|
||||
$objcanvas->control->object=$object;
|
||||
}
|
||||
$objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values
|
||||
$objcanvas->assign_values($action); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
}
|
||||
|
||||
@ -181,44 +181,12 @@ class Canvas
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check permissions of a user to show a page and an object. Check read permission.
|
||||
* If $_REQUEST['action'] defined, we also check write permission.
|
||||
*
|
||||
* @param user User to check
|
||||
* @param features Features to check (in most cases, it's module name)
|
||||
* @param objectid Object ID if we want to check permission on a particular record (optionnal)
|
||||
* @param dbtablename Table name where object is stored. Not used if objectid is null (optionnal)
|
||||
* @param feature2 Feature to check (second level of permission)
|
||||
* @param dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal)
|
||||
* @param dbt_select Field name for select if not rowid. (optionnal)
|
||||
* @return int 1
|
||||
*/
|
||||
function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
|
||||
{
|
||||
// If function to check permission is overwritten, we use new one
|
||||
if (method_exists($this->control,'restrictedArea')) return $this->control->restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
|
||||
else return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign values into POST into object
|
||||
*
|
||||
* // TODO This should be useless. POST is already visible from everywhere.
|
||||
*/
|
||||
function assign_post()
|
||||
{
|
||||
if (empty($_POST)) return;
|
||||
if (method_exists($this->control,'assign_post')) $this->control->assign_post();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared method for canvas to assign values for templates
|
||||
*/
|
||||
function assign_values()
|
||||
function assign_values($action)
|
||||
{
|
||||
if (method_exists($this->control,'assign_values')) $this->control->assign_values($this->action);
|
||||
if (method_exists($this->control,'assign_values')) $this->control->assign_values($action);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2038,27 +2038,34 @@ function info_admin($text,$infoonimgalt=0)
|
||||
* @param objectid Object ID if we want to check permission on a particular record (optionnal)
|
||||
* @param dbtablename Table name where object is stored. Not used if objectid is null (optionnal)
|
||||
* @param feature2 Feature to check, second level of permission (optionnal)
|
||||
* @param dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal)
|
||||
* @param dbt_select Field name for select if not rowid. (optionnal)
|
||||
* @param dbt_keyfield Field name for socid foreign key if not fk_soc (optionnal)
|
||||
* @param dbt_select Field name for select if not rowid (optionnal)
|
||||
* @param objcanvas Object canvas
|
||||
* @return int Always 1, die process if not allowed
|
||||
*/
|
||||
function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
|
||||
function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename,$feature2,$dbt_socfield,$dbt_select");
|
||||
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
|
||||
|
||||
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
|
||||
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
|
||||
//print ", perm: ".$features."->".$feature2."=".$user->rights->$features->$feature2->lire."<br>";
|
||||
|
||||
// If we use canvas, we try to use function that overlod restrictarea if provided with canvas
|
||||
if (is_object($objcanvas))
|
||||
{
|
||||
if (method_exists($objcanvas->control,'restrictedArea')) return $objcanvas->control->restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
|
||||
}
|
||||
|
||||
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
|
||||
|
||||
// More features to check
|
||||
$features = explode("&",$features);
|
||||
//var_dump($features);
|
||||
|
||||
// Check read permission from module
|
||||
// TODO Replace "feature" param by permission for reading
|
||||
// TODO Replace "feature" param into caller by first level of permission
|
||||
$readok=1;
|
||||
foreach ($features as $feature)
|
||||
{
|
||||
|
||||
@ -77,11 +77,71 @@ class ActionsCardProduct extends Product
|
||||
*
|
||||
* @param action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
function assign_values($action)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $html, $formproduct;
|
||||
|
||||
// canvas
|
||||
$this->tpl['canvas'] = $this->canvas;
|
||||
|
||||
// id
|
||||
$this->tpl['id'] = $this->id;
|
||||
|
||||
// Ref
|
||||
$this->tpl['ref'] = $this->ref;
|
||||
|
||||
// Label
|
||||
$this->tpl['label'] = $this->libelle;
|
||||
|
||||
// Description
|
||||
$this->tpl['description'] = nl2br($this->description);
|
||||
|
||||
// Statut
|
||||
$this->tpl['status'] = $this->getLibStatut(2);
|
||||
|
||||
// Note
|
||||
$this->tpl['note'] = nl2br($this->note);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
// Price
|
||||
$this->tpl['price'] = $this->price;
|
||||
$this->tpl['price_min'] = $this->price_min;
|
||||
$this->tpl['price_base_type'] = $html->load_PriceBaseType($this->price_base_type, "price_base_type");
|
||||
|
||||
// VAT
|
||||
$this->tpl['tva_tx'] = $html->load_tva("tva_tx",-1,$mysoc,'');
|
||||
}
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
// Status
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$this->tpl['status'] = $html->selectarray('statut',$statutarray,$this->status);
|
||||
|
||||
//To Buy
|
||||
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
|
||||
$this->tpl['tobuy'] = $html->selectarray('tobuy',$statutarray,$this->status_buy);
|
||||
|
||||
$this->tpl['description'] = $this->description;
|
||||
$this->tpl['note'] = $this->note;
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Ref
|
||||
$this->tpl['ref'] = $html->showrefnav($this,'ref','',1,'ref');
|
||||
|
||||
// Accountancy buy code
|
||||
$this->tpl['accountancyBuyCodeKey'] = $html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancyBuyCodeVal'] = $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer);
|
||||
|
||||
// Accountancy sell code
|
||||
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
}
|
||||
|
||||
$this->tpl['finished'] = $this->object->finished;
|
||||
$this->tpl['ref'] = $this->object->ref;
|
||||
$this->tpl['label'] = $this->object->label;
|
||||
|
||||
@ -77,11 +77,71 @@ class ActionsCardService extends Product
|
||||
*
|
||||
* @param action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
function assign_values($action)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $html, $formproduct;
|
||||
|
||||
// canvas
|
||||
$this->tpl['canvas'] = $this->canvas;
|
||||
|
||||
// id
|
||||
$this->tpl['id'] = $this->id;
|
||||
|
||||
// Ref
|
||||
$this->tpl['ref'] = $this->ref;
|
||||
|
||||
// Label
|
||||
$this->tpl['label'] = $this->libelle;
|
||||
|
||||
// Description
|
||||
$this->tpl['description'] = nl2br($this->description);
|
||||
|
||||
// Statut
|
||||
$this->tpl['status'] = $this->getLibStatut(2);
|
||||
|
||||
// Note
|
||||
$this->tpl['note'] = nl2br($this->note);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
// Price
|
||||
$this->tpl['price'] = $this->price;
|
||||
$this->tpl['price_min'] = $this->price_min;
|
||||
$this->tpl['price_base_type'] = $html->load_PriceBaseType($this->price_base_type, "price_base_type");
|
||||
|
||||
// VAT
|
||||
$this->tpl['tva_tx'] = $html->load_tva("tva_tx",-1,$mysoc,'');
|
||||
}
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
// Status
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$this->tpl['status'] = $html->selectarray('statut',$statutarray,$this->status);
|
||||
|
||||
//To Buy
|
||||
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
|
||||
$this->tpl['tobuy'] = $html->selectarray('tobuy',$statutarray,$this->status_buy);
|
||||
|
||||
$this->tpl['description'] = $this->description;
|
||||
$this->tpl['note'] = $this->note;
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Ref
|
||||
$this->tpl['ref'] = $html->showrefnav($this,'ref','',1,'ref');
|
||||
|
||||
// Accountancy buy code
|
||||
$this->tpl['accountancyBuyCodeKey'] = $html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancyBuyCodeVal'] = $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer);
|
||||
|
||||
// Accountancy sell code
|
||||
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
}
|
||||
|
||||
$this->tpl['finished'] = $this->object->finished;
|
||||
$this->tpl['ref'] = $this->object->ref;
|
||||
$this->tpl['label'] = $this->object->label;
|
||||
|
||||
@ -2877,76 +2877,6 @@ class Product extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Affecte les valeurs communes
|
||||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $html;
|
||||
|
||||
// canvas
|
||||
$this->tpl['canvas'] = $this->canvas;
|
||||
|
||||
// id
|
||||
$this->tpl['id'] = $this->id;
|
||||
|
||||
// Ref
|
||||
$this->tpl['ref'] = $this->ref;
|
||||
|
||||
// Label
|
||||
$this->tpl['label'] = $this->libelle;
|
||||
|
||||
// Description
|
||||
$this->tpl['description'] = nl2br($this->description);
|
||||
|
||||
// Statut
|
||||
$this->tpl['status'] = $this->getLibStatut(2);
|
||||
|
||||
// Note
|
||||
$this->tpl['note'] = nl2br($this->note);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
// Price
|
||||
$this->tpl['price'] = $this->price;
|
||||
$this->tpl['price_min'] = $this->price_min;
|
||||
$this->tpl['price_base_type'] = $html->load_PriceBaseType($this->price_base_type, "price_base_type");
|
||||
|
||||
// VAT
|
||||
$this->tpl['tva_tx'] = $html->load_tva("tva_tx",-1,$mysoc,'');
|
||||
}
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
// Status
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$this->tpl['status'] = $html->selectarray('statut',$statutarray,$this->status);
|
||||
|
||||
//To Buy
|
||||
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
|
||||
$this->tpl['tobuy'] = $html->selectarray('tobuy',$statutarray,$this->status_buy);
|
||||
|
||||
$this->tpl['description'] = $this->description;
|
||||
$this->tpl['note'] = $this->note;
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Ref
|
||||
$this->tpl['ref'] = $html->showrefnav($this,'ref','',1,'ref');
|
||||
|
||||
// Accountancy buy code
|
||||
$this->tpl['accountancyBuyCodeKey'] = $html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancyBuyCodeVal'] = $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer);
|
||||
|
||||
// Accountancy sell code
|
||||
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if object is a product
|
||||
* @return boolean True if it's a product
|
||||
|
||||
@ -56,7 +56,7 @@ $object = new Product($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
if ($id || $ref) $object->getCanvas($id,$ref);
|
||||
$object->getCanvas($id,$ref);
|
||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||
if (! empty($canvas))
|
||||
{
|
||||
@ -68,7 +68,7 @@ if (! empty($canvas))
|
||||
// Security check
|
||||
if (isset($id) || isset($ref)) $value = isset($id)?$id:(isset($ref)?$ref:'');
|
||||
$type = isset($ref)?'ref':'rowid';
|
||||
$result=restrictedArea($user,'produit|service',$value,'product','','',$type);
|
||||
$result=restrictedArea($user,'produit|service',$value,'product','','',$type, $objcanvas);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
@ -644,7 +644,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
// -----------------------------------------
|
||||
if ($action == 'create')
|
||||
{
|
||||
$objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values
|
||||
$objcanvas->assign_values($action); // Set value for templates
|
||||
$objcanvas->display_canvas($action,0); // Show template
|
||||
}
|
||||
@ -657,7 +656,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
$object->fetch($id);
|
||||
$objcanvas->control->object=$object;
|
||||
}
|
||||
$objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values
|
||||
$objcanvas->assign_values($action); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
}
|
||||
|
||||
@ -58,26 +58,19 @@ $limit = $conf->liste_limit;
|
||||
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
//if ($id) $object->getCanvas($id);
|
||||
//$object->getCanvas($id);
|
||||
$canvas = GETPOST("canvas");
|
||||
if (! empty($canvas))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||
$objcanvas = new Canvas($db,$action);
|
||||
$objcanvas->getCanvas('product','list',$canvas);
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($type=='0') $result=$objcanvas->restrictedArea($user,'produit');
|
||||
else if ($type=='1') $result=$objcanvas->restrictedArea($user,'service');
|
||||
else $result=$objcanvas->restrictedArea($user,'produit|service');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Security check
|
||||
if ($type=='0') $result=restrictedArea($user,'produit');
|
||||
else if ($type=='1') $result=restrictedArea($user,'service');
|
||||
else $result=restrictedArea($user,'produit|service');
|
||||
}
|
||||
// Security check
|
||||
if ($type=='0') $result=restrictedArea($user,'produit','','','','','',$objcanvas);
|
||||
else if ($type=='1') $result=restrictedArea($user,'service','','','','','',$objcanvas);
|
||||
else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -365,11 +365,13 @@ abstract class ActionsCardCommon
|
||||
* Assigne les valeurs par defaut pour le canvas
|
||||
* @param action Type of template
|
||||
*/
|
||||
function assign_values($action='')
|
||||
function assign_values($action)
|
||||
{
|
||||
global $conf, $langs, $user, $mysoc, $canvas;
|
||||
global $form, $formadmin, $formcompany;
|
||||
|
||||
if ($action == 'create' || $action == 'edit') $this->assign_post();
|
||||
|
||||
if ($_GET["type"]=='f') { $this->object->fournisseur=1; }
|
||||
if ($_GET["type"]=='c') { $this->object->client=1; }
|
||||
if ($_GET["type"]=='p') { $this->object->client=2; }
|
||||
@ -650,7 +652,7 @@ abstract class ActionsCardCommon
|
||||
/**
|
||||
* Assigne les valeurs POST dans l'objet
|
||||
*/
|
||||
function assign_post()
|
||||
function assign_post($action)
|
||||
{
|
||||
global $langs, $mysoc;
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ class ActionsCardDefault extends ActionsCardCommon
|
||||
*
|
||||
* @param string $action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
function assign_values($action)
|
||||
{
|
||||
global $conf, $langs, $user, $mysoc;
|
||||
global $form, $formadmin, $formcompany;
|
||||
|
||||
@ -27,9 +27,9 @@
|
||||
<?php echo $this->control->tpl['ajax_selecttype']; ?>
|
||||
<br>
|
||||
<?php echo $langs->trans("ThirdPartyType") ?>:
|
||||
<input type="radio" id="radiocompany" class="flat" name="private" value="0"'<?php echo (! $_REQUEST["private"]?' checked="checked"':''); ?>>
|
||||
<input type="radio" id="radiocompany" class="flat" name="private" value="0" checked="checked">
|
||||
<?php echo $langs->trans("Company/Fundation"); ?>
|
||||
<input type="radio" id="radioprivate" class="flat" name="private" value="1"'<?php echo (! $_REQUEST["private"]?'':' checked="checked"'); ?>> <?php echo $langs->trans("Individual"); ?> (<?php echo $langs->trans("ToCreateContactWithSameName") ?>)
|
||||
<input type="radio" id="radioprivate" class="flat" name="private" value="1"> <?php echo $langs->trans("Individual"); ?> (<?php echo $langs->trans("ToCreateContactWithSameName") ?>)
|
||||
<br>
|
||||
<br>
|
||||
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
||||
|
||||
@ -84,7 +84,7 @@ class ActionsCardIndividual extends ActionsCardCommon
|
||||
*
|
||||
* @param string $action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
function assign_values($action)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $form, $formcompany;
|
||||
|
||||
@ -29,9 +29,9 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
|
||||
<?php echo $this->control->tpl['ajax_selecttype']; ?>
|
||||
<br>
|
||||
<?php echo $langs->trans("ThirdPartyType") ?>:
|
||||
<input type="radio" id="radiocompany" class="flat" name="private" value="0"'<?php echo (! $_REQUEST["private"]?' checked="checked"':''); ?>>
|
||||
<input type="radio" id="radiocompany" class="flat" name="private" value="0">
|
||||
<?php echo $langs->trans("Company/Fundation"); ?>
|
||||
<input type="radio" id="radioprivate" class="flat" name="private" value="1"'<?php echo (! $_REQUEST["private"]?'':' checked="checked"'); ?>> <?php echo $langs->trans("Individual"); ?> (<?php echo $langs->trans("ToCreateContactWithSameName") ?>)
|
||||
<input type="radio" id="radioprivate" class="flat" name="private" value="1" checked="checked"> <?php echo $langs->trans("Individual"); ?> (<?php echo $langs->trans("ToCreateContactWithSameName") ?>)
|
||||
<br>
|
||||
<br>
|
||||
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
||||
|
||||
@ -56,22 +56,18 @@ $object = new Societe($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
if ($socid) $object->getCanvas($socid);
|
||||
$object->getCanvas($socid);
|
||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||
if (! empty($canvas))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||
$objcanvas = new Canvas($db,$action);
|
||||
$objcanvas->getCanvas('thirdparty','card',$canvas);
|
||||
// Security check
|
||||
$result = $objcanvas->restrictedArea($user, 'societe', $socid);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'societe', $socid);
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'societe', $socid, '', '', '', '', $objcanvas);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($db);
|
||||
@ -492,7 +488,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
// -----------------------------------------
|
||||
if ($action == 'create')
|
||||
{
|
||||
$objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values
|
||||
$objcanvas->assign_values($action); // Set value for templates
|
||||
$objcanvas->display_canvas($action,0); // Show template
|
||||
}
|
||||
@ -505,7 +500,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
$object->fetch($socid);
|
||||
$objcanvas->control->object=$object;
|
||||
}
|
||||
$objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values
|
||||
$objcanvas->assign_values($action); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
}
|
||||
|
||||
@ -36,23 +36,23 @@ $socid = GETPOST("socid");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user,'societe',$socid,'');
|
||||
|
||||
$search_nom=trim(isset($_GET["search_nom"])?$_GET["search_nom"]:$_POST["search_nom"]);
|
||||
$search_nom_only=trim(isset($_GET["search_nom_only"])?$_GET["search_nom_only"]:$_POST["search_nom_only"]);
|
||||
$search_all=trim(isset($_GET["search_all"])?$_GET["search_all"]:$_POST["search_all"]);
|
||||
$search_ville=trim(isset($_GET["search_ville"])?$_GET["search_ville"]:$_POST["search_ville"]);
|
||||
$socname=trim(isset($_GET["socname"])?$_GET["socname"]:$_POST["socname"]);
|
||||
$search_idprof1=trim($_REQUEST['search_idprof1']);
|
||||
$search_idprof2=trim($_REQUEST['search_idprof2']);
|
||||
$search_idprof3=trim($_REQUEST['search_idprof3']);
|
||||
$search_idprof4=trim($_REQUEST['search_idprof4']);
|
||||
$search_nom=trim(GETPOST("search_nom"));
|
||||
$search_nom_only=trim(GETPOST("search_nom_only"));
|
||||
$search_all=trim(GETPOST("search_all"));
|
||||
$search_ville=trim(GETPOT("search_ville"));
|
||||
$socname=trim(GETPOST("socname"));
|
||||
$search_idprof1=trim(GETPOST('search_idprof1'));
|
||||
$search_idprof2=trim(GETPOST('search_idprof2'));
|
||||
$search_idprof3=trim(GETPOST('search_idprof3'));
|
||||
$search_idprof4=trim(GETPOST('search_idprof4'));
|
||||
$search_sale=trim(GETPOST("search_sale"));
|
||||
$search_categ=trim(GETPOST("search_categ"));
|
||||
$mode=GETPOST("mode");
|
||||
$modesearch=GETPOST("mode-search");
|
||||
|
||||
// Load sale and categ filters
|
||||
$search_sale = GETPOST("search_sale");
|
||||
$search_categ = GETPOST("search_categ");
|
||||
|
||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$page=isset($_GET["page"])?$_GET["page"]:$_POST["page"];
|
||||
$sortfield=GETPOST("sortfield");
|
||||
$sortorder=GETPOST("sortorder");
|
||||
$page=GETPOST("page");
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="s.nom";
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
@ -66,12 +66,9 @@ $pagenext = $page + 1;
|
||||
*/
|
||||
|
||||
// Recherche
|
||||
$mode=isset($_GET["mode"])?$_GET["mode"]:$_POST["mode"];
|
||||
$modesearch=isset($_GET["mode-search"])?$_GET["mode-search"]:$_POST["mode-search"];
|
||||
|
||||
if ($mode == 'search')
|
||||
{
|
||||
$_POST["search_nom"]=$socname;
|
||||
$search_nom=$socname;
|
||||
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -117,13 +114,6 @@ if ($mode == 'search')
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user