Works on contact canvas in relation to the thirdparty canvas module
Fix: more simple
This commit is contained in:
parent
3ca73ad75d
commit
e2a4ad2c96
@ -117,7 +117,7 @@ class ActionsContactCardCommon
|
||||
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
|
||||
// State
|
||||
if ($this->object->fk_pays) $this->tpl['select_state'] = $formcompany->select_state($this->object->departement_id,$this->object->pays_code);
|
||||
if ($this->object->fk_pays) $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement,$this->object->pays_code);
|
||||
else $this->tpl['select_state'] = $countrynotdefined;
|
||||
|
||||
// Public or private
|
||||
@ -240,6 +240,7 @@ class ActionsContactCardCommon
|
||||
$this->object->jabberid = $_POST["jabberid"];
|
||||
$this->object->priv = $_POST["priv"];
|
||||
$this->object->note = $_POST["note"];
|
||||
$this->object->canvas = $_POST["canvas"];
|
||||
|
||||
|
||||
// We set pays_id, and pays_code label of the chosen country
|
||||
|
||||
@ -87,9 +87,9 @@ class DaoContactDefault extends Contact
|
||||
* Delete third party in database
|
||||
* @param id id de la societe a supprimer
|
||||
*/
|
||||
function delete($id)
|
||||
function delete()
|
||||
{
|
||||
$result = parent::delete($id);
|
||||
$result = parent::delete();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ class Contact extends CommonObject
|
||||
$this->name=trim($this->name);
|
||||
if (! $this->socid) $this->socid = 0;
|
||||
if (! $this->priv) $this->priv = 0;
|
||||
if (! $this->canvas) $this->canvas = 'default@contact';
|
||||
if (! $this->canvas) $this->canvas = 'default';
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user_creat, priv, canvas)";
|
||||
$sql.= " VALUES ('".$this->db->idate($now)."',";
|
||||
|
||||
@ -54,7 +54,7 @@ if (! empty($canvas))
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||
$objcanvas = new Canvas($db);
|
||||
|
||||
$objcanvas->getCanvas('thirdparty','contactcard',$canvas);
|
||||
$objcanvas->getCanvas('contact','contactcard',$canvas);
|
||||
|
||||
// Security check
|
||||
$result = $objcanvas->restrictedArea($user, 'contact', $id, 'socpeople');
|
||||
|
||||
@ -111,23 +111,21 @@ class Canvas
|
||||
$error='';
|
||||
$this->card = $card;
|
||||
$this->canvas = $canvas;
|
||||
$childmodule = $this->aliasmodule = $this->module = $module;
|
||||
$targetmodule = $this->aliastargetmodule = $this->targetmodule = $module;
|
||||
$childmodule = $this->aliasmodule = $module;
|
||||
$targetmodule = $this->targetmodule = $module;
|
||||
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
|
||||
{
|
||||
$childmodule = $this->aliasmodule = $this->module = $regs[2];
|
||||
$childmodule = $this->aliasmodule = $regs[2];
|
||||
$this->canvas = $regs[1];
|
||||
}
|
||||
|
||||
// For compatibility
|
||||
if ($childmodule == 'thirdparty') $childmodule = $this->aliasmodule = 'societe';
|
||||
if ($targetmodule == 'thirdparty') $targetmodule = 'societe';
|
||||
if ($childmodule == 'contact')
|
||||
{
|
||||
$childmodule = 'societe';
|
||||
$this->targetmodule = 'contact';
|
||||
}
|
||||
if ($childmodule == 'thirdparty') { $childmodule = $this->aliasmodule = 'societe'; }
|
||||
if ($targetmodule == 'thirdparty') { $targetmodule = 'societe'; }
|
||||
if ($childmodule == 'contact') { $childmodule = 'societe'; }
|
||||
if ($targetmodule == 'contact') { $targetmodule = 'societe'; }
|
||||
|
||||
|
||||
//print 'childmodule='.$childmodule.' targetmodule='.$targetmodule.'<br>';
|
||||
//print 'this->aliasmodule='.$this->aliasmodule.' this->targetmodule='.$this->targetmodule.'<br>';
|
||||
|
||||
@ -97,6 +97,7 @@ ALTER TABLE llx_c_ziptown ADD INDEX idx_c_ziptown_fk_county (fk_county);
|
||||
ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_county FOREIGN KEY (fk_county) REFERENCES llx_c_departements (rowid);
|
||||
|
||||
ALTER TABLE llx_socpeople ADD COLUMN canvas varchar(32) DEFAULT 'default' after default_lang;
|
||||
ALTER TABLE llx_socpeople MODIFY canvas varchar(32) DEFAULT 'default';
|
||||
|
||||
UPDATE llx_socpeople SET canvas = 'default' WHERE canvas = 'default@contact';
|
||||
UPDATE llx_societe SET canvas = 'default' WHERE canvas = 'default@thirdparty';
|
||||
|
||||
@ -77,6 +77,6 @@ create table llx_societe
|
||||
gencod varchar(255), -- barcode
|
||||
price_level integer NULL, -- level of price for multiprices
|
||||
default_lang varchar(6), -- default language
|
||||
canvas varchar(32) DEFAULT 'default@thirdparty', -- type of canvas
|
||||
canvas varchar(32) DEFAULT 'default', -- type of canvas
|
||||
import_key varchar(14) -- import key
|
||||
)type=innodb;
|
||||
|
||||
@ -48,6 +48,6 @@ create table llx_socpeople
|
||||
fk_user_modif integer,
|
||||
note text,
|
||||
default_lang varchar(6),
|
||||
canvas varchar(32) DEFAULT 'default@contact', -- type of canvas
|
||||
canvas varchar(32) DEFAULT 'default', -- type of canvas
|
||||
import_key varchar(14)
|
||||
)type=innodb;
|
||||
|
||||
@ -26,13 +26,13 @@
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#radiocompany").click(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.canvas.value="default@societe";
|
||||
document.formsoc.canvas.value="default";
|
||||
document.formsoc.private.value=0;
|
||||
document.formsoc.submit();
|
||||
});
|
||||
jQuery("#radioprivate").click(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.canvas.value="individual@societe";
|
||||
document.formsoc.canvas.value="individual";
|
||||
document.formsoc.private.value=1;
|
||||
document.formsoc.submit();
|
||||
});
|
||||
|
||||
@ -247,7 +247,7 @@ function CheckVAT(a) {
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($user->rights->societe->contact->creer) { ?>
|
||||
<a class="butAction" href="<?php echo DOL_URL_ROOT.'/contact/fiche.php?socid='.$this->control->tpl['id'].'&action=create&canvas='.$canvas; ?>"><?php echo $langs->trans("AddContact"); ?></a>
|
||||
<a class="butAction" href="<?php echo DOL_URL_ROOT.'/contact/fiche.php?socid='.$this->control->tpl['id']; ?>&action=create&canvas=default@contact"><?php echo $langs->trans("AddContact"); ?></a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($user->rights->societe->supprimer) { ?>
|
||||
|
||||
@ -26,13 +26,13 @@
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#radiocompany").click(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.canvas.value="default@societe";
|
||||
document.formsoc.canvas.value="default";
|
||||
document.formsoc.private.value=0;
|
||||
document.formsoc.submit();
|
||||
});
|
||||
jQuery("#radioprivate").click(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.canvas.value="individual@societe";
|
||||
document.formsoc.canvas.value="individual";
|
||||
document.formsoc.private.value=1;
|
||||
document.formsoc.submit();
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user