Works on contact canvas in relation to the thirdparty canvas module

Fix: more simple
This commit is contained in:
Regis Houssin 2010-11-04 09:14:20 +00:00
parent 3ca73ad75d
commit e2a4ad2c96
11 changed files with 22 additions and 22 deletions

View File

@ -117,7 +117,7 @@ class ActionsContactCardCommon
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
// State // 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; else $this->tpl['select_state'] = $countrynotdefined;
// Public or private // Public or private
@ -240,6 +240,7 @@ class ActionsContactCardCommon
$this->object->jabberid = $_POST["jabberid"]; $this->object->jabberid = $_POST["jabberid"];
$this->object->priv = $_POST["priv"]; $this->object->priv = $_POST["priv"];
$this->object->note = $_POST["note"]; $this->object->note = $_POST["note"];
$this->object->canvas = $_POST["canvas"];
// We set pays_id, and pays_code label of the chosen country // We set pays_id, and pays_code label of the chosen country

View File

@ -87,9 +87,9 @@ class DaoContactDefault extends Contact
* Delete third party in database * Delete third party in database
* @param id id de la societe a supprimer * @param id id de la societe a supprimer
*/ */
function delete($id) function delete()
{ {
$result = parent::delete($id); $result = parent::delete();
return $result; return $result;
} }

View File

@ -104,7 +104,7 @@ class Contact extends CommonObject
$this->name=trim($this->name); $this->name=trim($this->name);
if (! $this->socid) $this->socid = 0; if (! $this->socid) $this->socid = 0;
if (! $this->priv) $this->priv = 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 = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user_creat, priv, canvas)";
$sql.= " VALUES ('".$this->db->idate($now)."',"; $sql.= " VALUES ('".$this->db->idate($now)."',";

View File

@ -54,7 +54,7 @@ if (! empty($canvas))
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
$objcanvas = new Canvas($db); $objcanvas = new Canvas($db);
$objcanvas->getCanvas('thirdparty','contactcard',$canvas); $objcanvas->getCanvas('contact','contactcard',$canvas);
// Security check // Security check
$result = $objcanvas->restrictedArea($user, 'contact', $id, 'socpeople'); $result = $objcanvas->restrictedArea($user, 'contact', $id, 'socpeople');

View File

@ -111,23 +111,21 @@ class Canvas
$error=''; $error='';
$this->card = $card; $this->card = $card;
$this->canvas = $canvas; $this->canvas = $canvas;
$childmodule = $this->aliasmodule = $this->module = $module; $childmodule = $this->aliasmodule = $module;
$targetmodule = $this->aliastargetmodule = $this->targetmodule = $module; $targetmodule = $this->targetmodule = $module;
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs)) if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
{ {
$childmodule = $this->aliasmodule = $this->module = $regs[2]; $childmodule = $this->aliasmodule = $regs[2];
$this->canvas = $regs[1]; $this->canvas = $regs[1];
} }
// For compatibility // For compatibility
if ($childmodule == 'thirdparty') $childmodule = $this->aliasmodule = 'societe'; if ($childmodule == 'thirdparty') { $childmodule = $this->aliasmodule = 'societe'; }
if ($targetmodule == 'thirdparty') $targetmodule = 'societe'; if ($targetmodule == 'thirdparty') { $targetmodule = 'societe'; }
if ($childmodule == 'contact') if ($childmodule == 'contact') { $childmodule = 'societe'; }
{ if ($targetmodule == 'contact') { $targetmodule = 'societe'; }
$childmodule = 'societe';
$this->targetmodule = 'contact';
}
//print 'childmodule='.$childmodule.' targetmodule='.$targetmodule.'<br>'; //print 'childmodule='.$childmodule.' targetmodule='.$targetmodule.'<br>';
//print 'this->aliasmodule='.$this->aliasmodule.' this->targetmodule='.$this->targetmodule.'<br>'; //print 'this->aliasmodule='.$this->aliasmodule.' this->targetmodule='.$this->targetmodule.'<br>';

View File

@ -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_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 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_socpeople SET canvas = 'default' WHERE canvas = 'default@contact';
UPDATE llx_societe SET canvas = 'default' WHERE canvas = 'default@thirdparty'; UPDATE llx_societe SET canvas = 'default' WHERE canvas = 'default@thirdparty';

View File

@ -77,6 +77,6 @@ create table llx_societe
gencod varchar(255), -- barcode gencod varchar(255), -- barcode
price_level integer NULL, -- level of price for multiprices price_level integer NULL, -- level of price for multiprices
default_lang varchar(6), -- default language 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 import_key varchar(14) -- import key
)type=innodb; )type=innodb;

View File

@ -48,6 +48,6 @@ create table llx_socpeople
fk_user_modif integer, fk_user_modif integer,
note text, note text,
default_lang varchar(6), 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) import_key varchar(14)
)type=innodb; )type=innodb;

View File

@ -26,13 +26,13 @@
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery("#radiocompany").click(function() { jQuery("#radiocompany").click(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
document.formsoc.canvas.value="default@societe"; document.formsoc.canvas.value="default";
document.formsoc.private.value=0; document.formsoc.private.value=0;
document.formsoc.submit(); document.formsoc.submit();
}); });
jQuery("#radioprivate").click(function() { jQuery("#radioprivate").click(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
document.formsoc.canvas.value="individual@societe"; document.formsoc.canvas.value="individual";
document.formsoc.private.value=1; document.formsoc.private.value=1;
document.formsoc.submit(); document.formsoc.submit();
}); });

View File

@ -247,7 +247,7 @@ function CheckVAT(a) {
<?php } ?> <?php } ?>
<?php if ($user->rights->societe->contact->creer) { ?> <?php if ($user->rights->societe->contact->creer) { ?>
<a class="butAction" href="<?php echo DOL_URL_ROOT.'/contact/fiche.php?socid='.$this->control->tpl['id'].'&amp;action=create&amp;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']; ?>&amp;action=create&amp;canvas=default@contact"><?php echo $langs->trans("AddContact"); ?></a>
<?php } ?> <?php } ?>
<?php if ($user->rights->societe->supprimer) { ?> <?php if ($user->rights->societe->supprimer) { ?>

View File

@ -26,13 +26,13 @@
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery("#radiocompany").click(function() { jQuery("#radiocompany").click(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
document.formsoc.canvas.value="default@societe"; document.formsoc.canvas.value="default";
document.formsoc.private.value=0; document.formsoc.private.value=0;
document.formsoc.submit(); document.formsoc.submit();
}); });
jQuery("#radioprivate").click(function() { jQuery("#radioprivate").click(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
document.formsoc.canvas.value="individual@societe"; document.formsoc.canvas.value="individual";
document.formsoc.private.value=1; document.formsoc.private.value=1;
document.formsoc.submit(); document.formsoc.submit();
}); });