Qual: Fix architecture problem with canvas
This commit is contained in:
parent
daaffd5f14
commit
d72f417868
@ -53,8 +53,148 @@ class ActionsContactCardCommon
|
|||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigne les valeurs par defaut pour le canvas
|
* Load data control
|
||||||
|
*/
|
||||||
|
function doActions($id)
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
|
// Creation utilisateur depuis contact
|
||||||
|
if (GETPOST("action") == 'confirm_create_user' && GETPOST("confirm") == 'yes')
|
||||||
|
{
|
||||||
|
// Recuperation contact actuel
|
||||||
|
$result = $this->object->fetch($id);
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
// Creation user
|
||||||
|
$nuser = new User($this->db);
|
||||||
|
$result=$nuser->create_from_contact($this->object,$_POST["login"]);
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$result2=$nuser->setPassword($user,$_POST["password"],0,1,1);
|
||||||
|
if ($result2)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors=$nuser->error;
|
||||||
|
|
||||||
|
$this->db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors=$this->object->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creation contact
|
||||||
|
if ($_POST["action"] == 'add')
|
||||||
|
{
|
||||||
|
$this->assign_post();
|
||||||
|
|
||||||
|
if (! $_POST["name"])
|
||||||
|
{
|
||||||
|
array_push($this->errors,$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")));
|
||||||
|
$_GET["action"] = $_POST["action"] = 'create';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["name"])
|
||||||
|
{
|
||||||
|
$id = $this->object->create($user);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors=$this->object->errors;
|
||||||
|
$_GET["action"] = $_POST["action"] = 'create';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
||||||
|
{
|
||||||
|
$result=$this->object->fetch($id);
|
||||||
|
|
||||||
|
$this->object->old_name = $_POST["old_name"];
|
||||||
|
$this->object->old_firstname = $_POST["old_firstname"];
|
||||||
|
|
||||||
|
$result = $this->object->delete();
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
Header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors=$this->object->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||||
|
{
|
||||||
|
if (empty($_POST["name"]))
|
||||||
|
{
|
||||||
|
$this->error=array($langs->trans("ErrorFieldRequired",$langs->transnoentities("Name").' / '.$langs->transnoentities("Label")));
|
||||||
|
$_GET["action"] = $_POST["action"] = 'edit';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->error))
|
||||||
|
{
|
||||||
|
$this->object->fetch($_POST["contactid"]);
|
||||||
|
|
||||||
|
$this->object->oldcopy=dol_clone($this->object);
|
||||||
|
|
||||||
|
$this->assign_post();
|
||||||
|
|
||||||
|
$result = $this->object->update($_POST["contactid"], $user);
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$this->object->old_name='';
|
||||||
|
$this->object->old_firstname='';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors=$this->object->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the title of card
|
||||||
|
*/
|
||||||
|
function getTitle($action)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$out='';
|
||||||
|
|
||||||
|
if ($action == 'view' || $action == 'edit') $out.= $langs->trans("Contact");
|
||||||
|
if ($action == 'create') $out.= $langs->trans("AddContact");
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set content of ->tpl array, to use into template
|
||||||
* @param action Type of template
|
* @param action Type of template
|
||||||
*/
|
*/
|
||||||
function assign_values($action='')
|
function assign_values($action='')
|
||||||
@ -67,6 +207,10 @@ class ActionsContactCardCommon
|
|||||||
$this->tpl[$key] = $value;
|
$this->tpl[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->tpl['title']=$this->getTitle($action);
|
||||||
|
$this->tpl['error']=$this->error;
|
||||||
|
$this->tpl['errors']=$this->errors;
|
||||||
|
|
||||||
if ($action == 'create' || $action == 'edit')
|
if ($action == 'create' || $action == 'edit')
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
@ -293,129 +437,6 @@ class ActionsContactCardCommon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load data control
|
|
||||||
*/
|
|
||||||
function doActions($id)
|
|
||||||
{
|
|
||||||
global $conf, $user, $langs;
|
|
||||||
|
|
||||||
// Creation utilisateur depuis contact
|
|
||||||
if (GETPOST("action") == 'confirm_create_user' && GETPOST("confirm") == 'yes')
|
|
||||||
{
|
|
||||||
// Recuperation contact actuel
|
|
||||||
$result = $this->object->fetch($id);
|
|
||||||
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
// Creation user
|
|
||||||
$nuser = new User($this->db);
|
|
||||||
$result=$nuser->create_from_contact($this->object,$_POST["login"]);
|
|
||||||
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$result2=$nuser->setPassword($user,$_POST["password"],0,1,1);
|
|
||||||
if ($result2)
|
|
||||||
{
|
|
||||||
$this->db->commit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->db->rollback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->errors=$nuser->error;
|
|
||||||
|
|
||||||
$this->db->rollback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->errors=$this->object->errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creation contact
|
|
||||||
if ($_POST["action"] == 'add')
|
|
||||||
{
|
|
||||||
$this->assign_post();
|
|
||||||
|
|
||||||
if (! $_POST["name"])
|
|
||||||
{
|
|
||||||
array_push($this->errors,$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")));
|
|
||||||
$_GET["action"] = $_POST["action"] = 'create';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST["name"])
|
|
||||||
{
|
|
||||||
$id = $this->object->create($user);
|
|
||||||
if ($id > 0)
|
|
||||||
{
|
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->errors=$this->object->errors;
|
|
||||||
$_GET["action"] = $_POST["action"] = 'create';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
|
||||||
{
|
|
||||||
$result=$this->object->fetch($id);
|
|
||||||
|
|
||||||
$this->object->old_name = $_POST["old_name"];
|
|
||||||
$this->object->old_firstname = $_POST["old_firstname"];
|
|
||||||
|
|
||||||
$result = $this->object->delete();
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
Header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->errors=$this->object->errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|
||||||
{
|
|
||||||
if (empty($_POST["name"]))
|
|
||||||
{
|
|
||||||
$this->error=array($langs->trans("ErrorFieldRequired",$langs->transnoentities("Name").' / '.$langs->transnoentities("Label")));
|
|
||||||
$_GET["action"] = $_POST["action"] = 'edit';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($this->error))
|
|
||||||
{
|
|
||||||
$this->object->fetch($_POST["contactid"]);
|
|
||||||
|
|
||||||
$this->object->oldcopy=dol_clone($this->object);
|
|
||||||
|
|
||||||
$this->assign_post();
|
|
||||||
|
|
||||||
$result = $this->object->update($_POST["contactid"], $user);
|
|
||||||
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$this->object->old_name='';
|
|
||||||
$this->object->old_firstname='';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->errors=$this->object->errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -44,19 +45,23 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
|||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute actions
|
||||||
|
* @param Id of object (may be empty for creation)
|
||||||
|
*/
|
||||||
|
function doActions($id)
|
||||||
|
{
|
||||||
|
$return = parent::doActions($id);
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the title of card
|
* Return the title of card
|
||||||
*/
|
*/
|
||||||
function getTitle($action)
|
function getTitle($action)
|
||||||
{
|
{
|
||||||
global $langs;
|
return parent::getTitle($action);
|
||||||
|
|
||||||
$out='';
|
|
||||||
|
|
||||||
if ($action == 'view' || $action == 'edit') $out.= $langs->trans("Contact");
|
|
||||||
if ($action == 'create') $out.= $langs->trans("AddContact");
|
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,17 +83,6 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
|||||||
parent::assign_post();
|
parent::assign_post();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute actions
|
|
||||||
* @param Id of object (may be empty for creation)
|
|
||||||
*/
|
|
||||||
function doActions($id)
|
|
||||||
{
|
|
||||||
$return = parent::doActions($id);
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign custom values for canvas
|
* Assign custom values for canvas
|
||||||
* @param action Type of action
|
* @param action Type of action
|
||||||
@ -100,8 +94,15 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
|||||||
|
|
||||||
parent::assign_values($action);
|
parent::assign_values($action);
|
||||||
|
|
||||||
|
$this->tpl['title'] = $this->getTitle($action);
|
||||||
|
$this->tpl['error'] = $this->error;
|
||||||
|
$this->tpl['errors']= $this->errors;
|
||||||
|
|
||||||
if ($action == 'view')
|
if ($action == 'view')
|
||||||
{
|
{
|
||||||
|
// Card header
|
||||||
|
$this->tpl['showhead']=$this->showHead($action);
|
||||||
|
|
||||||
// Confirm delete contact
|
// Confirm delete contact
|
||||||
if ($user->rights->societe->contact->supprimer)
|
if ($user->rights->societe->contact->supprimer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,7 +21,12 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
<?php
|
||||||
|
print_fiche_titre($this->control->tpl['title']);
|
||||||
|
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
|
||||||
|
echo $this->control->tpl['ajax_selectcountry']; ?>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,13 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
<?php
|
||||||
|
print_fiche_titre($this->control->tpl['title']);
|
||||||
|
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
|
||||||
|
echo $this->control->tpl['ajax_selectcountry'];
|
||||||
|
?>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,10 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if ($this->control->tpl['action_create_user']) echo $this->control->tpl['action_create_user']; ?>
|
<?php if ($this->control->tpl['action_create_user']) echo $this->control->tpl['action_create_user']; ?>
|
||||||
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
||||||
|
|
||||||
|
|||||||
@ -81,6 +81,16 @@ if (method_exists($objcanvas->control,'doActions'))
|
|||||||
// When used with CANVAS
|
// When used with CANVAS
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
$objcanvas->doActions($id);
|
$objcanvas->doActions($id);
|
||||||
|
if (empty($objcanvas->error) && (empty($objcanvas->errors) || sizeof($objcanvas->errors) == 0))
|
||||||
|
{
|
||||||
|
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
||||||
|
if ($action=='update') { $objcanvas->action='view'; $action='view'; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
||||||
|
if ($action=='update') { $objcanvas->action='edit'; $action='edit'; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -297,94 +307,27 @@ if (! empty($objcanvas->template_dir))
|
|||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
/*
|
$objcanvas->assign_post(); // Assign POST data
|
||||||
* Mode creation
|
$objcanvas->assign_values($action); // Set value for templates
|
||||||
*/
|
$objcanvas->display_canvas($action); // Show template
|
||||||
|
|
||||||
// Assign _POST data to objcanvas->object->xxx
|
|
||||||
$objcanvas->assign_post();
|
|
||||||
|
|
||||||
// Assign template values into objcanvas->control->tpl
|
|
||||||
$objcanvas->assign_values();
|
|
||||||
|
|
||||||
// Card header TODO This should be done into canvas_display
|
|
||||||
$title = $objcanvas->getTitle();
|
|
||||||
print_fiche_titre($title);
|
|
||||||
|
|
||||||
// Show errors TODO This should be done into assign_values()
|
|
||||||
// that should get string of dol_htmloutput_errors and
|
|
||||||
// assigne it into objcanvas->control->tpl like other strings to show
|
|
||||||
// by templates, then output of string should be done into display_canvas
|
|
||||||
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
|
|
||||||
|
|
||||||
// Display canvas
|
|
||||||
$objcanvas->display_canvas('create');
|
|
||||||
}
|
}
|
||||||
else if ($action == 'edit')
|
else if ($action == 'edit')
|
||||||
{
|
{
|
||||||
/*
|
$objcanvas->fetch($id); // Reload object
|
||||||
* Mode edition
|
$objcanvas->assign_post(); // Assign POST data
|
||||||
*/
|
$objcanvas->assign_values($action); // Set value for templates
|
||||||
|
$objcanvas->display_canvas($action); // Show template
|
||||||
// Fetch object
|
|
||||||
$result=$objcanvas->fetch($id);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
// Card header
|
|
||||||
$objcanvas->showHead();
|
|
||||||
|
|
||||||
if ($_POST["name"])
|
|
||||||
{
|
|
||||||
// Assign _POST data
|
|
||||||
$objcanvas->assign_post();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign values
|
|
||||||
$objcanvas->assign_values();
|
|
||||||
|
|
||||||
// Display canvas
|
|
||||||
$objcanvas->display_canvas('edit');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
$result=$objcanvas->fetch($id); // Reload object
|
||||||
* Mode view
|
$objcanvas->assign_values('view'); // Assign values
|
||||||
*/
|
$objcanvas->display_canvas('view'); // Show template
|
||||||
// Fetch object
|
|
||||||
$result=$objcanvas->fetch($id);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
// Assign values
|
|
||||||
$objcanvas->assign_values();
|
|
||||||
|
|
||||||
// FIXME div of tab is shown by showHead but /div is closed by
|
// TODO Move this also into template
|
||||||
// display_canvas. All output should be processed by template so
|
print show_actions_todo($conf,$langs,$db,$objsoc,$objcanvas->control->object);
|
||||||
// showHead and dol_htmloutput_errors should be moved into
|
|
||||||
// display_canvas.
|
|
||||||
|
|
||||||
// Card header
|
print show_actions_done($conf,$langs,$db,$objsoc,$objcanvas->control->object);
|
||||||
$objcanvas->showHead();
|
|
||||||
|
|
||||||
// Show errors TODO This output string should be set by
|
|
||||||
// assign_values and output by template into display_canvas
|
|
||||||
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
|
|
||||||
|
|
||||||
// Display canvas
|
|
||||||
$objcanvas->display_canvas('view');
|
|
||||||
|
|
||||||
print show_actions_todo($conf,$langs,$db,$objsoc,$objcanvas->control->object);
|
|
||||||
|
|
||||||
print show_actions_done($conf,$langs,$db,$objsoc,$objcanvas->control->object);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,8 +103,7 @@ class Canvas
|
|||||||
/*print 'canvas='.$this->canvas.'<br>';
|
/*print 'canvas='.$this->canvas.'<br>';
|
||||||
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>';
|
||||||
print 'childmodule='.$conf->$childmodule->enabled.' targetmodule='.$conf->$targetmodule->enabled.'<br>';
|
print 'childmodule='.$conf->$childmodule->enabled.' targetmodule='.$conf->$targetmodule->enabled.'<br>';*/
|
||||||
*/
|
|
||||||
|
|
||||||
if (! $conf->$childmodule->enabled || ! $conf->$targetmodule->enabled) accessforbidden();
|
if (! $conf->$childmodule->enabled || ! $conf->$targetmodule->enabled) accessforbidden();
|
||||||
|
|
||||||
@ -132,7 +131,7 @@ class Canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Include specific library
|
// Include specific library
|
||||||
// FIXME Specific libraries must be included by files that need them only, so by actions and/or dao files.
|
// TODO Specific libraries must be included by files that need them only, so by actions and/or dao files.
|
||||||
$libfile = dol_buildpath('/'.$this->aliasmodule.'/lib/'.$this->aliasmodule.'.lib.php');
|
$libfile = dol_buildpath('/'.$this->aliasmodule.'/lib/'.$this->aliasmodule.'.lib.php');
|
||||||
if (file_exists($libfile)) require_once($libfile);
|
if (file_exists($libfile)) require_once($libfile);
|
||||||
|
|
||||||
@ -142,6 +141,8 @@ class Canvas
|
|||||||
{
|
{
|
||||||
$this->template_dir='';
|
$this->template_dir='';
|
||||||
}
|
}
|
||||||
|
//print '/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/tpl/';
|
||||||
|
//print 'template_dir='.$this->template_dir.'<br>';
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -195,19 +196,8 @@ class Canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the title of card
|
|
||||||
* // FIXME An output function is stored inside an action class. Must change this.
|
|
||||||
*/
|
|
||||||
function getTitle()
|
|
||||||
{
|
|
||||||
if (method_exists($this->control,'getTitle')) return $this->control->getTitle($this->action);
|
|
||||||
else return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the head of card (tabs)
|
* Return the head of card (tabs)
|
||||||
* // FIXME An output function is stored inside an action class. Must change this.
|
|
||||||
*/
|
*/
|
||||||
function showHead()
|
function showHead()
|
||||||
{
|
{
|
||||||
@ -217,7 +207,7 @@ class Canvas
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigne les valeurs POST dans l'objet
|
* Assigne les valeurs POST dans l'objet
|
||||||
* // FIXME This is useless. POST is already visible from everywhere.
|
* // TODO This should be useless. POST is already visible from everywhere.
|
||||||
*/
|
*/
|
||||||
function assign_post()
|
function assign_post()
|
||||||
{
|
{
|
||||||
@ -230,7 +220,7 @@ class Canvas
|
|||||||
*/
|
*/
|
||||||
function assign_values()
|
function assign_values()
|
||||||
{
|
{
|
||||||
$this->control->assign_values($this->action);
|
if (method_exists($this->control,'assign_values')) $this->control->assign_values($this->action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -53,7 +54,317 @@ class ActionsCardCommon
|
|||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Load data control
|
||||||
|
*/
|
||||||
|
function doActions($socid)
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
|
if ($_POST["getcustomercode"])
|
||||||
|
{
|
||||||
|
// We defined value code_client
|
||||||
|
$_POST["code_client"]="Acompleter";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["getsuppliercode"])
|
||||||
|
{
|
||||||
|
// We defined value code_fournisseur
|
||||||
|
$_POST["code_fournisseur"]="Acompleter";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new third party
|
||||||
|
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||||
|
&& ($_POST["action"] == 'add' || $_POST["action"] == 'update'))
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'update')
|
||||||
|
{
|
||||||
|
// Load properties of company
|
||||||
|
$this->object->fetch($socid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["private"] == 1)
|
||||||
|
{
|
||||||
|
$this->object->particulier = $_REQUEST["private"];
|
||||||
|
|
||||||
|
$this->object->nom = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]);
|
||||||
|
$this->object->nom_particulier = $_POST["nom"];
|
||||||
|
$this->object->prenom = $_POST["prenom"];
|
||||||
|
$this->object->civilite_id = $_POST["civilite_id"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->object->nom = $_POST["nom"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->object->address = $_POST["adresse"];
|
||||||
|
$this->object->adresse = $_POST["adresse"]; // TODO obsolete
|
||||||
|
$this->object->cp = $_POST["zipcode"];
|
||||||
|
$this->object->ville = $_POST["town"];
|
||||||
|
$this->object->pays_id = $_POST["pays_id"];
|
||||||
|
$this->object->departement_id = $_POST["departement_id"];
|
||||||
|
$this->object->tel = $_POST["tel"];
|
||||||
|
$this->object->fax = $_POST["fax"];
|
||||||
|
$this->object->email = trim($_POST["email"]);
|
||||||
|
$this->object->url = $_POST["url"];
|
||||||
|
$this->object->siren = $_POST["idprof1"];
|
||||||
|
$this->object->siret = $_POST["idprof2"];
|
||||||
|
$this->object->ape = $_POST["idprof3"];
|
||||||
|
$this->object->idprof4 = $_POST["idprof4"];
|
||||||
|
$this->object->prefix_comm = $_POST["prefix_comm"];
|
||||||
|
$this->object->code_client = $_POST["code_client"];
|
||||||
|
$this->object->code_fournisseur = $_POST["code_fournisseur"];
|
||||||
|
$this->object->capital = $_POST["capital"];
|
||||||
|
$this->object->gencod = $_POST["gencod"];
|
||||||
|
$this->object->canvas = $_REQUEST["canvas"];
|
||||||
|
|
||||||
|
$this->object->tva_assuj = $_POST["assujtva_value"];
|
||||||
|
|
||||||
|
// Local Taxes
|
||||||
|
$this->object->localtax1_assuj = $_POST["localtax1assuj_value"];
|
||||||
|
$this->object->localtax2_assuj = $_POST["localtax2assuj_value"];
|
||||||
|
$this->object->tva_intra = $_POST["tva_intra"];
|
||||||
|
|
||||||
|
$this->object->forme_juridique_code = $_POST["forme_juridique_code"];
|
||||||
|
$this->object->effectif_id = $_POST["effectif_id"];
|
||||||
|
if ($_REQUEST["private"] == 1)
|
||||||
|
{
|
||||||
|
$this->object->typent_id = 8; // TODO predict another method if the field "special" change of rowid
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->object->typent_id = $_POST["typent_id"];
|
||||||
|
}
|
||||||
|
$this->object->client = $_POST["client"];
|
||||||
|
$this->object->fournisseur = $_POST["fournisseur"];
|
||||||
|
$this->object->fournisseur_categorie = $_POST["fournisseur_categorie"];
|
||||||
|
|
||||||
|
$this->object->commercial_id = $_POST["commercial_id"];
|
||||||
|
$this->object->default_lang = $_POST["default_lang"];
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (empty($_POST["cancel"]))
|
||||||
|
{
|
||||||
|
if (! empty($this->object->email) && ! isValidEMail($this->object->email))
|
||||||
|
{
|
||||||
|
$error = 1;
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error = $langs->trans("ErrorBadEMail",$this->object->email);
|
||||||
|
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
|
||||||
|
}
|
||||||
|
if (! empty($this->object->url) && ! isValidUrl($this->object->url))
|
||||||
|
{
|
||||||
|
$error = 1;
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error = $langs->trans("ErrorBadUrl",$this->object->url);
|
||||||
|
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
|
||||||
|
}
|
||||||
|
if ($this->object->fournisseur && ! $conf->fournisseur->enabled)
|
||||||
|
{
|
||||||
|
$error = 1;
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error = $langs->trans("ErrorSupplierModuleNotEnabled");
|
||||||
|
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if ($_POST["action"] == 'add')
|
||||||
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (empty($this->object->client)) $this->object->code_client='';
|
||||||
|
if (empty($this->object->fournisseur)) $this->object->code_fournisseur='';
|
||||||
|
|
||||||
|
$result = $this->object->create($user);
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
if ($this->object->particulier)
|
||||||
|
{
|
||||||
|
dol_syslog("This thirdparty is a personal people",LOG_DEBUG);
|
||||||
|
$contact=new Contact($this->db);
|
||||||
|
|
||||||
|
$contact->civilite_id = $this->object->civilite_id;
|
||||||
|
$contact->name = $this->object->nom_particulier;
|
||||||
|
$contact->firstname = $this->object->prenom;
|
||||||
|
$contact->address = $this->object->address;
|
||||||
|
$contact->cp = $this->object->cp;
|
||||||
|
$contact->ville = $this->object->ville;
|
||||||
|
$contact->fk_pays = $this->object->fk_pays;
|
||||||
|
$contact->socid = $this->object->id; // fk_soc
|
||||||
|
$contact->status = 1;
|
||||||
|
$contact->email = $this->object->email;
|
||||||
|
$contact->priv = 0;
|
||||||
|
|
||||||
|
$result=$contact->create($user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors=$this->object->errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
if ( $this->object->client == 1 )
|
||||||
|
{
|
||||||
|
Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=".$this->object->id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( $this->object->fournisseur == 1 )
|
||||||
|
{
|
||||||
|
Header("Location: ".DOL_URL_ROOT."/fourn/fiche.php?socid=".$this->object->id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$this->object->id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
$this->errors=$this->object->errors;
|
||||||
|
$_GET["action"]='create';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'update')
|
||||||
|
{
|
||||||
|
if ($_POST["cancel"])
|
||||||
|
{
|
||||||
|
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oldsoccanvas = new Canvas($this->db);
|
||||||
|
$oldsoccanvas->getCanvas('thirdparty','card',$this->object->canvas);
|
||||||
|
$result=$oldsoccanvas->fetch($socid);
|
||||||
|
|
||||||
|
// To not set code if third party is not concerned. But if it had values, we keep them.
|
||||||
|
if (empty($this->object->client) && empty($oldsoccanvas->control->object->code_client)) $this->object->code_client='';
|
||||||
|
if (empty($this->object->fournisseur)&& empty($oldsoccanvas->control->object->code_fournisseur)) $this->object->code_fournisseur='';
|
||||||
|
//var_dump($soccanvas);exit;
|
||||||
|
|
||||||
|
$result = $this->object->update($socid,$user,1,$oldsoccanvas->control->object->codeclient_modifiable(),$oldsoccanvas->control->object->codefournisseur_modifiable());
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->object->id = $socid;
|
||||||
|
$reload = 0;
|
||||||
|
$this->errors = $this->object->errors;
|
||||||
|
$_GET["action"]= "edit";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
||||||
|
{
|
||||||
|
$this->object->fetch($socid);
|
||||||
|
|
||||||
|
$result = $this->object->delete($socid);
|
||||||
|
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
Header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$this->object->nom."");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$reload = 0;
|
||||||
|
$this->errors=$this->object->errors;
|
||||||
|
$_GET["action"]='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generate document
|
||||||
|
*/
|
||||||
|
if (GETPOST('action') == 'builddoc') // En get ou en post
|
||||||
|
{
|
||||||
|
if (is_numeric(GETPOST('model')))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/societe/modules_societe.class.php');
|
||||||
|
|
||||||
|
$this->object->fetch($socid);
|
||||||
|
$this->object->fetch_thirdparty();
|
||||||
|
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id') ) $newlang=GETPOST('lang_id');
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$this->object->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
$result=thirdparty_doc_create($this->db, $this->object->id, '', GETPOST('model'), $outputlangs);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dol_print_error($this->db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Header ('Location: '.$_SERVER["PHP_SELF"].'?socid='.$this->object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the title of card
|
||||||
|
*/
|
||||||
|
function getTitle($action)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$out='';
|
||||||
|
|
||||||
|
if ($action == 'view') $out.= $langs->trans("Individual");
|
||||||
|
if ($action == 'edit') $out.= $langs->trans("EditIndividual");
|
||||||
|
if ($action == 'create') $out.= $langs->trans("NewIndividual");
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the head of card (tabs)
|
||||||
|
*/
|
||||||
|
function showHead($action)
|
||||||
|
{
|
||||||
|
$head = societe_prepare_head($this->object);
|
||||||
|
$title = $this->getTitle($action);
|
||||||
|
|
||||||
|
return dol_fiche_head($head, 'card', $title, 0, 'company');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Assigne les valeurs par defaut pour le canvas
|
* Assigne les valeurs par defaut pour le canvas
|
||||||
* @param action Type of template
|
* @param action Type of template
|
||||||
*/
|
*/
|
||||||
@ -73,6 +384,10 @@ class ActionsCardCommon
|
|||||||
$this->tpl[$key] = $value;
|
$this->tpl[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->tpl['title'] = $this->getTitle($action);
|
||||||
|
$this->tpl['error'] = $this->error;
|
||||||
|
$this->tpl['errors']= $this->errors;
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
@ -226,7 +541,9 @@ class ActionsCardCommon
|
|||||||
|
|
||||||
if ($action == 'view')
|
if ($action == 'view')
|
||||||
{
|
{
|
||||||
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom');
|
$this->tpl['showhead']=$this->showHead($action);
|
||||||
|
|
||||||
|
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom');
|
||||||
|
|
||||||
$this->tpl['checkcustomercode'] = $this->object->check_codeclient();
|
$this->tpl['checkcustomercode'] = $this->object->check_codeclient();
|
||||||
$this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
|
$this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
|
||||||
@ -392,287 +709,6 @@ class ActionsCardCommon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load data control
|
|
||||||
*/
|
|
||||||
function doActions($socid)
|
|
||||||
{
|
|
||||||
global $conf, $user, $langs;
|
|
||||||
|
|
||||||
if ($_POST["getcustomercode"])
|
|
||||||
{
|
|
||||||
// We defined value code_client
|
|
||||||
$_POST["code_client"]="Acompleter";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST["getsuppliercode"])
|
|
||||||
{
|
|
||||||
// We defined value code_fournisseur
|
|
||||||
$_POST["code_fournisseur"]="Acompleter";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new third party
|
|
||||||
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
|
||||||
&& ($_POST["action"] == 'add' || $_POST["action"] == 'update'))
|
|
||||||
{
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'update')
|
|
||||||
{
|
|
||||||
// Load properties of company
|
|
||||||
$this->object->fetch($socid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_REQUEST["private"] == 1)
|
|
||||||
{
|
|
||||||
$this->object->particulier = $_REQUEST["private"];
|
|
||||||
|
|
||||||
$this->object->nom = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]);
|
|
||||||
$this->object->nom_particulier = $_POST["nom"];
|
|
||||||
$this->object->prenom = $_POST["prenom"];
|
|
||||||
$this->object->civilite_id = $_POST["civilite_id"];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->object->nom = $_POST["nom"];
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->object->address = $_POST["adresse"];
|
|
||||||
$this->object->adresse = $_POST["adresse"]; // TODO obsolete
|
|
||||||
$this->object->cp = $_POST["zipcode"];
|
|
||||||
$this->object->ville = $_POST["town"];
|
|
||||||
$this->object->pays_id = $_POST["pays_id"];
|
|
||||||
$this->object->departement_id = $_POST["departement_id"];
|
|
||||||
$this->object->tel = $_POST["tel"];
|
|
||||||
$this->object->fax = $_POST["fax"];
|
|
||||||
$this->object->email = trim($_POST["email"]);
|
|
||||||
$this->object->url = $_POST["url"];
|
|
||||||
$this->object->siren = $_POST["idprof1"];
|
|
||||||
$this->object->siret = $_POST["idprof2"];
|
|
||||||
$this->object->ape = $_POST["idprof3"];
|
|
||||||
$this->object->idprof4 = $_POST["idprof4"];
|
|
||||||
$this->object->prefix_comm = $_POST["prefix_comm"];
|
|
||||||
$this->object->code_client = $_POST["code_client"];
|
|
||||||
$this->object->code_fournisseur = $_POST["code_fournisseur"];
|
|
||||||
$this->object->capital = $_POST["capital"];
|
|
||||||
$this->object->gencod = $_POST["gencod"];
|
|
||||||
$this->object->canvas = $_REQUEST["canvas"];
|
|
||||||
|
|
||||||
$this->object->tva_assuj = $_POST["assujtva_value"];
|
|
||||||
|
|
||||||
// Local Taxes
|
|
||||||
$this->object->localtax1_assuj = $_POST["localtax1assuj_value"];
|
|
||||||
$this->object->localtax2_assuj = $_POST["localtax2assuj_value"];
|
|
||||||
$this->object->tva_intra = $_POST["tva_intra"];
|
|
||||||
|
|
||||||
$this->object->forme_juridique_code = $_POST["forme_juridique_code"];
|
|
||||||
$this->object->effectif_id = $_POST["effectif_id"];
|
|
||||||
if ($_REQUEST["private"] == 1)
|
|
||||||
{
|
|
||||||
$this->object->typent_id = 8; // TODO predict another method if the field "special" change of rowid
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->object->typent_id = $_POST["typent_id"];
|
|
||||||
}
|
|
||||||
$this->object->client = $_POST["client"];
|
|
||||||
$this->object->fournisseur = $_POST["fournisseur"];
|
|
||||||
$this->object->fournisseur_categorie = $_POST["fournisseur_categorie"];
|
|
||||||
|
|
||||||
$this->object->commercial_id = $_POST["commercial_id"];
|
|
||||||
$this->object->default_lang = $_POST["default_lang"];
|
|
||||||
|
|
||||||
// Check parameters
|
|
||||||
if (empty($_POST["cancel"]))
|
|
||||||
{
|
|
||||||
if (! empty($this->object->email) && ! isValidEMail($this->object->email))
|
|
||||||
{
|
|
||||||
$error = 1;
|
|
||||||
$langs->load("errors");
|
|
||||||
$this->error = $langs->trans("ErrorBadEMail",$this->object->email);
|
|
||||||
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
|
|
||||||
}
|
|
||||||
if (! empty($this->object->url) && ! isValidUrl($this->object->url))
|
|
||||||
{
|
|
||||||
$error = 1;
|
|
||||||
$langs->load("errors");
|
|
||||||
$this->error = $langs->trans("ErrorBadUrl",$this->object->url);
|
|
||||||
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
|
|
||||||
}
|
|
||||||
if ($this->object->fournisseur && ! $conf->fournisseur->enabled)
|
|
||||||
{
|
|
||||||
$error = 1;
|
|
||||||
$langs->load("errors");
|
|
||||||
$this->error = $langs->trans("ErrorSupplierModuleNotEnabled");
|
|
||||||
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
if ($_POST["action"] == 'add')
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
if (empty($this->object->client)) $this->object->code_client='';
|
|
||||||
if (empty($this->object->fournisseur)) $this->object->code_fournisseur='';
|
|
||||||
|
|
||||||
$result = $this->object->create($user);
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
if ($this->object->particulier)
|
|
||||||
{
|
|
||||||
dol_syslog("This thirdparty is a personal people",LOG_DEBUG);
|
|
||||||
$contact=new Contact($this->db);
|
|
||||||
|
|
||||||
$contact->civilite_id = $this->object->civilite_id;
|
|
||||||
$contact->name = $this->object->nom_particulier;
|
|
||||||
$contact->firstname = $this->object->prenom;
|
|
||||||
$contact->address = $this->object->address;
|
|
||||||
$contact->cp = $this->object->cp;
|
|
||||||
$contact->ville = $this->object->ville;
|
|
||||||
$contact->fk_pays = $this->object->fk_pays;
|
|
||||||
$contact->socid = $this->object->id; // fk_soc
|
|
||||||
$contact->status = 1;
|
|
||||||
$contact->email = $this->object->email;
|
|
||||||
$contact->priv = 0;
|
|
||||||
|
|
||||||
$result=$contact->create($user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->errors=$this->object->errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
$this->db->commit();
|
|
||||||
|
|
||||||
if ( $this->object->client == 1 )
|
|
||||||
{
|
|
||||||
Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=".$this->object->id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( $this->object->fournisseur == 1 )
|
|
||||||
{
|
|
||||||
Header("Location: ".DOL_URL_ROOT."/fourn/fiche.php?socid=".$this->object->id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$this->object->id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->db->rollback();
|
|
||||||
|
|
||||||
$this->errors=$this->object->errors;
|
|
||||||
$_GET["action"]='create';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'update')
|
|
||||||
{
|
|
||||||
if ($_POST["cancel"])
|
|
||||||
{
|
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$oldsoccanvas = new Canvas($this->db);
|
|
||||||
$oldsoccanvas->getCanvas('thirdparty','card',$this->object->canvas);
|
|
||||||
$result=$oldsoccanvas->fetch($socid);
|
|
||||||
|
|
||||||
// To not set code if third party is not concerned. But if it had values, we keep them.
|
|
||||||
if (empty($this->object->client) && empty($oldsoccanvas->control->object->code_client)) $this->object->code_client='';
|
|
||||||
if (empty($this->object->fournisseur)&& empty($oldsoccanvas->control->object->code_fournisseur)) $this->object->code_fournisseur='';
|
|
||||||
//var_dump($soccanvas);exit;
|
|
||||||
|
|
||||||
$result = $this->object->update($socid,$user,1,$oldsoccanvas->control->object->codeclient_modifiable(),$oldsoccanvas->control->object->codefournisseur_modifiable());
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->object->id = $socid;
|
|
||||||
$reload = 0;
|
|
||||||
$this->errors = $this->object->errors;
|
|
||||||
$_GET["action"]= "edit";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
|
||||||
{
|
|
||||||
$this->object->fetch($socid);
|
|
||||||
|
|
||||||
$result = $this->object->delete($socid);
|
|
||||||
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
Header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$this->object->nom."");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$reload = 0;
|
|
||||||
$this->errors=$this->object->errors;
|
|
||||||
$_GET["action"]='';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Generate document
|
|
||||||
*/
|
|
||||||
if (GETPOST('action') == 'builddoc') // En get ou en post
|
|
||||||
{
|
|
||||||
if (is_numeric(GETPOST('model')))
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/societe/modules_societe.class.php');
|
|
||||||
|
|
||||||
$this->object->fetch($socid);
|
|
||||||
$this->object->fetch_thirdparty();
|
|
||||||
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang='';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id') ) $newlang=GETPOST('lang_id');
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$this->object->default_lang;
|
|
||||||
if (! empty($newlang))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate("",$conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
$result=thirdparty_doc_create($this->db, $this->object->id, '', GETPOST('model'), $outputlangs);
|
|
||||||
if ($result <= 0)
|
|
||||||
{
|
|
||||||
dol_print_error($this->db,$result);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?socid='.$this->object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -44,32 +45,22 @@ class ActionsCardDefault extends ActionsCardCommon
|
|||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the title of card
|
* Return the title of card
|
||||||
*/
|
*/
|
||||||
function getTitle($action)
|
function getTitle($action)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
if ($action == 'view') $out.= $langs->trans("ThirdParty");
|
if ($action == 'view') $out.= $langs->trans("ThirdParty");
|
||||||
if ($action == 'edit') $out.= $langs->trans("EditCompany");
|
if ($action == 'edit') $out.= $langs->trans("EditCompany");
|
||||||
if ($action == 'create') $out.= $langs->trans("NewCompany");
|
if ($action == 'create') $out.= $langs->trans("NewCompany");
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the head of card (tabs)
|
|
||||||
*/
|
|
||||||
function showHead($action)
|
|
||||||
{
|
|
||||||
$head = societe_prepare_head($this->object);
|
|
||||||
$title = $this->getTitle($action);
|
|
||||||
|
|
||||||
return dol_fiche_head($head, 'card', $title, 0, 'company');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigne les valeurs POST dans l'objet
|
* Assigne les valeurs POST dans l'objet
|
||||||
|
|||||||
@ -21,6 +21,12 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
print_fiche_titre($this->control->tpl['title']);
|
||||||
|
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if ($conf->use_javascript_ajax) { ?>
|
<?php if ($conf->use_javascript_ajax) { ?>
|
||||||
<?php echo $this->control->tpl['ajax_selecttype']; ?>
|
<?php echo $this->control->tpl['ajax_selecttype']; ?>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@ -21,6 +21,12 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
print_fiche_titre($this->control->tpl['title']);
|
||||||
|
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
||||||
<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?>
|
<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?>
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,10 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
||||||
<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?>
|
<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?>
|
||||||
|
|
||||||
|
|||||||
@ -44,32 +44,23 @@ class ActionsCardIndividual extends ActionsCardCommon
|
|||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the title of card
|
|
||||||
*/
|
|
||||||
function getTitle($action)
|
|
||||||
{
|
|
||||||
global $langs;
|
|
||||||
|
|
||||||
$out='';
|
/**
|
||||||
|
* Return the title of card
|
||||||
|
*/
|
||||||
|
function getTitle($action)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
if ($action == 'view') $out.= $langs->trans("Individual");
|
$out='';
|
||||||
if ($action == 'edit') $out.= $langs->trans("EditIndividual");
|
|
||||||
if ($action == 'create') $out.= $langs->trans("NewIndividual");
|
|
||||||
|
|
||||||
return $out;
|
if ($action == 'view') $out.= $langs->trans("Individual");
|
||||||
}
|
if ($action == 'edit') $out.= $langs->trans("EditIndividual");
|
||||||
|
if ($action == 'create') $out.= $langs->trans("NewIndividual");
|
||||||
|
|
||||||
/**
|
return $out;
|
||||||
* Return the head of card (tabs)
|
}
|
||||||
*/
|
|
||||||
function showHead($action)
|
|
||||||
{
|
|
||||||
$head = societe_prepare_head($this->object);
|
|
||||||
$title = $this->getTitle($action);
|
|
||||||
|
|
||||||
return dol_fiche_head($head, 'card', $title, 0, 'company');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigne les valeurs POST dans l'objet
|
* Assigne les valeurs POST dans l'objet
|
||||||
|
|||||||
@ -21,6 +21,12 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
print_fiche_titre($this->control->tpl['title']);
|
||||||
|
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if ($conf->use_javascript_ajax) { ?>
|
<?php if ($conf->use_javascript_ajax) { ?>
|
||||||
<?php echo $this->control->tpl['ajax_selecttype']; ?>
|
<?php echo $this->control->tpl['ajax_selecttype']; ?>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@ -21,6 +21,12 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
print_fiche_titre($this->control->tpl['title']);
|
||||||
|
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
||||||
|
|
||||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id']; ?>" method="POST" name="formsoc">
|
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id']; ?>" method="POST" name="formsoc">
|
||||||
|
|||||||
@ -21,6 +21,10 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
||||||
|
|
||||||
<form name="formsoc" method="POST">
|
<form name="formsoc" method="POST">
|
||||||
|
|||||||
@ -83,6 +83,16 @@ if (method_exists($objcanvas->control,'doActions'))
|
|||||||
// When used with CANVAS
|
// When used with CANVAS
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
$objcanvas->doActions($socid);
|
$objcanvas->doActions($socid);
|
||||||
|
if (empty($objcanvas->error) && (empty($objcanvas->errors) || sizeof($objcanvas->errors) == 0))
|
||||||
|
{
|
||||||
|
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
||||||
|
if ($action=='update') { $objcanvas->action='view'; $action='view'; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
||||||
|
if ($action=='update') { $objcanvas->action='edit'; $action='edit'; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -374,112 +384,55 @@ if (! empty($objcanvas->template_dir))
|
|||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
/*
|
$objcanvas->assign_post(); // Assign POST data
|
||||||
* Mode creation
|
$objcanvas->assign_values($action); // Set value for templates
|
||||||
*/
|
$objcanvas->display_canvas($action); // Show template
|
||||||
|
|
||||||
// Assign _POST data
|
|
||||||
$objcanvas->assign_post();
|
|
||||||
|
|
||||||
// Assign template values
|
|
||||||
$objcanvas->assign_values();
|
|
||||||
|
|
||||||
// Card header
|
|
||||||
$title = $objcanvas->getTitle();
|
|
||||||
print_fiche_titre($title);
|
|
||||||
|
|
||||||
// Show errors
|
|
||||||
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
|
|
||||||
|
|
||||||
// Display canvas
|
|
||||||
$objcanvas->display_canvas('create');
|
|
||||||
}
|
}
|
||||||
elseif ($action == 'edit')
|
elseif ($action == 'edit')
|
||||||
{
|
{
|
||||||
/*
|
$objcanvas->fetch($socid); // Reload object
|
||||||
* Mode edition
|
$objcanvas->assign_post(); // Assign POST data
|
||||||
*/
|
$objcanvas->assign_values($action); // Set value for templates
|
||||||
|
$objcanvas->display_canvas($action); // Show template
|
||||||
// Card header
|
|
||||||
$title = $objcanvas->getTitle();
|
|
||||||
print_fiche_titre($title);
|
|
||||||
|
|
||||||
if (! $_POST["nom"])
|
|
||||||
{
|
|
||||||
//Reload object
|
|
||||||
$objcanvas->fetch($socid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Assign _POST data
|
|
||||||
$objcanvas->assign_post();
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
|
|
||||||
|
|
||||||
// Assign values
|
|
||||||
$objcanvas->assign_values();
|
|
||||||
|
|
||||||
// Display canvas
|
|
||||||
$objcanvas->display_canvas('edit');
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$result=$objcanvas->fetch($socid); // Relaod object
|
||||||
|
$objcanvas->assign_values('view'); // Assign values
|
||||||
|
$objcanvas->display_canvas('view'); // Show template
|
||||||
|
|
||||||
|
// TODO Move this also into template
|
||||||
|
print '<table width="100%"><tr><td valign="top" width="50%">';
|
||||||
|
print '<a name="builddoc"></a>'; // ancre
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode view
|
* Documents generes
|
||||||
*/
|
*/
|
||||||
|
$filedir=$conf->societe->dir_output.'/'.$socid;
|
||||||
|
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid;
|
||||||
|
$genallowed=$user->rights->societe->creer;
|
||||||
|
$delallowed=$user->rights->societe->supprimer;
|
||||||
|
|
||||||
// Fetch object
|
$var=true;
|
||||||
$result=$objcanvas->fetch($socid);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
// Card header
|
|
||||||
$objcanvas->showHead();
|
|
||||||
|
|
||||||
// Assign values
|
$somethingshown=$formfile->show_documents('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang);
|
||||||
$objcanvas->assign_values();
|
|
||||||
|
|
||||||
// Display canvas
|
print '</td>';
|
||||||
$objcanvas->display_canvas('view');
|
print '<td></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
print '<table width="100%"><tr><td valign="top" width="50%">';
|
// Subsidiaries list
|
||||||
print '<a name="builddoc"></a>'; // ancre
|
$result=show_subsidiaries($conf,$langs,$db,$objcanvas->control->object);
|
||||||
|
|
||||||
/*
|
// Contacts list
|
||||||
* Documents generes
|
$result=show_contacts($conf,$langs,$db,$objcanvas->control->object);
|
||||||
*/
|
|
||||||
$filedir=$conf->societe->dir_output.'/'.$socid;
|
|
||||||
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid;
|
|
||||||
$genallowed=$user->rights->societe->creer;
|
|
||||||
$delallowed=$user->rights->societe->supprimer;
|
|
||||||
|
|
||||||
$var=true;
|
// Projects list
|
||||||
|
$result=show_projects($conf,$langs,$db,$objcanvas->control->object);
|
||||||
$somethingshown=$formfile->show_documents('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang);
|
|
||||||
|
|
||||||
print '</td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '</tr>';
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
// Subsidiaries list
|
|
||||||
$result=show_subsidiaries($conf,$langs,$db,$objcanvas->control->object);
|
|
||||||
|
|
||||||
// Contacts list
|
|
||||||
$result=show_contacts($conf,$langs,$db,$objcanvas->control->object);
|
|
||||||
|
|
||||||
// Projects list
|
|
||||||
$result=show_projects($conf,$langs,$db,$objcanvas->control->object);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user