New: testing a new method to avoid reloading the page
This commit is contained in:
parent
3cdff5361f
commit
808c4b5732
@ -1051,8 +1051,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
|||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -35,10 +35,10 @@ $langs->load("orders");
|
|||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$id=GETPOST('id', 'int');
|
$id=GETPOST('id','int');
|
||||||
$ref= GETPOST('ref', 'alpha');
|
$ref= GETPOST('ref','alpha');
|
||||||
$lineid=GETPOST('lineid', 'int');
|
$lineid=GETPOST('lineid','int');
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
@ -57,7 +57,8 @@ if ($action == 'addcontact' && $user->rights->propale->creer)
|
|||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -54,7 +54,8 @@ if ($action == 'addcontact' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -1198,8 +1198,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
|||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -1513,8 +1513,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
|||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -55,7 +55,8 @@ if ($action == 'addcontact' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -56,7 +56,8 @@ if ($action == 'addcontact' && $user->rights->contrat->creer)
|
|||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -483,8 +483,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
|||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
58
htdocs/core/ajax/contacts.php
Normal file
58
htdocs/core/ajax/contacts.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/ajax/contacts.php
|
||||||
|
* \brief File to load contacts combobox
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
|
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
|
||||||
|
require('../../main.inc.php');
|
||||||
|
|
||||||
|
$id = GETPOST('id','int');
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$htmlname = GETPOST('htmlname','alpha');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
top_httphead();
|
||||||
|
|
||||||
|
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||||
|
|
||||||
|
// Load original field value
|
||||||
|
if (! empty($id) && ! empty($action) && ! empty($htmlname))
|
||||||
|
{
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$return=array();
|
||||||
|
|
||||||
|
$return['value'] = $form->selectcontacts($id,'','contactid',0,'','',0,'',true);
|
||||||
|
$return['num'] = $form->num;
|
||||||
|
$return['error'] = $form->error;
|
||||||
|
|
||||||
|
echo json_encode($return);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@ -42,6 +42,7 @@ class Form
|
|||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
|
var $num;
|
||||||
|
|
||||||
// Cache arrays
|
// Cache arrays
|
||||||
var $cache_types_paiements=array();
|
var $cache_types_paiements=array();
|
||||||
@ -785,23 +786,45 @@ class Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of all contacts (for a third party or all)
|
||||||
|
*
|
||||||
|
* @param int $socid Id ot third party or 0 for all
|
||||||
|
* @param string $selected Id contact pre-selectionne
|
||||||
|
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||||
|
* @param int $show_empty 0=no empty value, 1=add an empty value
|
||||||
|
* @param string $exclude List of contacts id to exclude
|
||||||
|
* @param string $limitto Disable answers that are not id in this array list
|
||||||
|
* @param string $showfunction Add function into label
|
||||||
|
* @param string $moreclass Add more class to class style
|
||||||
|
* @return int <0 if KO, Nb of contact in list if OK
|
||||||
|
*/
|
||||||
|
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='')
|
||||||
|
{
|
||||||
|
print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of all contacts (for a third party or all)
|
* Return list of all contacts (for a third party or all)
|
||||||
*
|
*
|
||||||
* @param int $socid Id ot third party or 0 for all
|
* @param int $socid Id ot third party or 0 for all
|
||||||
* @param string $selected Id contact pre-selectionne
|
* @param string $selected Id contact pre-selectionne
|
||||||
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||||
* @param int $show_empty 0=no empty value, 1=add an empty value
|
* @param int $show_empty 0=no empty value, 1=add an empty value
|
||||||
* @param string $exclude List of contacts id to exclude
|
* @param string $exclude List of contacts id to exclude
|
||||||
* @param string $limitto Disable answers that are not id in this array list
|
* @param string $limitto Disable answers that are not id in this array list
|
||||||
* @param string $showfunction Add function into label
|
* @param string $showfunction Add function into label
|
||||||
* @param string $moreclass Add more class to class style
|
* @param string $moreclass Add more class to class style
|
||||||
* @return int <0 if KO, Nb of contact in list if OK
|
* @param bool $options_only Return options only (for ajax treatment)
|
||||||
|
* @return int <0 if KO, Nb of contact in list if OK
|
||||||
*/
|
*/
|
||||||
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='')
|
function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$langs->load('companies');
|
||||||
|
|
||||||
|
$out='';
|
||||||
|
|
||||||
// On recherche les societes
|
// On recherche les societes
|
||||||
$sql = "SELECT sp.rowid, sp.name as name, sp.firstname, sp.poste";
|
$sql = "SELECT sp.rowid, sp.name as name, sp.firstname, sp.poste";
|
||||||
@ -815,10 +838,9 @@ class Form
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num=$this->db->num_rows($resql);
|
$num=$this->db->num_rows($resql);
|
||||||
$disable=($num==0 ? ' disabled="disabled"' : '');
|
|
||||||
|
|
||||||
if ($htmlname != 'none') print '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disable.'>';
|
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
if ($showempty) print '<option value="0"></option>';
|
if ($showempty) $out.= '<option value="0"></option>';
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num)
|
if ($num)
|
||||||
@ -842,29 +864,29 @@ class Form
|
|||||||
if (is_array($limitto) && count($limitto) && ! in_array($obj->rowid,$limitto)) $disabled=1;
|
if (is_array($limitto) && count($limitto) && ! in_array($obj->rowid,$limitto)) $disabled=1;
|
||||||
if ($selected && $selected == $obj->rowid)
|
if ($selected && $selected == $obj->rowid)
|
||||||
{
|
{
|
||||||
print '<option value="'.$obj->rowid.'"';
|
$out.= '<option value="'.$obj->rowid.'"';
|
||||||
if ($disabled) print ' disabled="disabled"';
|
if ($disabled) $out.= ' disabled="disabled"';
|
||||||
print ' selected="selected">';
|
$out.= ' selected="selected">';
|
||||||
print $contactstatic->getFullName($langs);
|
$out.= $contactstatic->getFullName($langs);
|
||||||
if ($showfunction && $obj->poste) print ' ('.$obj->poste.')';
|
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
|
||||||
print '</option>';
|
$out.= '</option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<option value="'.$obj->rowid.'"';
|
$out.= '<option value="'.$obj->rowid.'"';
|
||||||
if ($disabled) print ' disabled="disabled"';
|
if ($disabled) $out.= ' disabled="disabled"';
|
||||||
print '>';
|
$out.= '>';
|
||||||
print $contactstatic->getFullName($langs);
|
$out.= $contactstatic->getFullName($langs);
|
||||||
if ($showfunction && $obj->poste) print ' ('.$obj->poste.')';
|
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
|
||||||
print '</option>';
|
$out.= '</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($selected == $obj->rowid)
|
if ($selected == $obj->rowid)
|
||||||
{
|
{
|
||||||
print $contactstatic->getFullName($langs);
|
$out.= $contactstatic->getFullName($langs);
|
||||||
if ($showfunction && $obj->poste) print ' ('.$obj->poste.')';
|
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
@ -872,13 +894,15 @@ class Form
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<option value="-1" selected="selected">'.$langs->trans("NoContactDefined").'</option>';
|
$out.= '<option value="-1" selected="selected" disabled="disabled">'.$langs->trans("NoContactDefined").'</option>';
|
||||||
}
|
}
|
||||||
if ($htmlname != 'none')
|
if ($htmlname != 'none' || $options_only)
|
||||||
{
|
{
|
||||||
print '</select>';
|
$out.= '</select>';
|
||||||
}
|
}
|
||||||
return $num;
|
|
||||||
|
$this->num = $num;
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -225,14 +225,24 @@ function ajax_combobox($htmlname, $event=array())
|
|||||||
var method = obj.method;
|
var method = obj.method;
|
||||||
var url = obj.url;
|
var url = obj.url;
|
||||||
var htmlname = obj.htmlname;
|
var htmlname = obj.htmlname;
|
||||||
$.get(url,
|
$.getJSON(url,
|
||||||
{
|
{
|
||||||
action: method,
|
action: method,
|
||||||
id: id,
|
id: id,
|
||||||
htmlname: htmlname
|
htmlname: htmlname
|
||||||
},
|
},
|
||||||
function(response) {
|
function(response) {
|
||||||
$("select#" + htmlname).html(response);
|
$.each(obj.params, function(key,action) {
|
||||||
|
if (key.length) {
|
||||||
|
var num = response.num;
|
||||||
|
if (num > 0) {
|
||||||
|
$("#" + key).removeAttr(action);
|
||||||
|
} else {
|
||||||
|
$("#" + key).attr(action, action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("select#" + htmlname).html(response.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});';
|
});';
|
||||||
|
|||||||
@ -54,7 +54,7 @@ $userstatic=new User($db);
|
|||||||
<tr <?php echo $bc[$var]; ?>>
|
<tr <?php echo $bc[$var]; ?>>
|
||||||
<td nowrap="nowrap"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></td>
|
<td nowrap="nowrap"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></td>
|
||||||
<td><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></td>
|
<td><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></td>
|
||||||
<td><?php echo $form->select_users($user->id,'contactid',0,$userAlreadySelected); ?></td>
|
<td><?php echo $form->select_users($user->id,'userid',0,$userAlreadySelected); ?></td>
|
||||||
<td><?php echo $formcompany->selectTypeContact($object, '', 'type','internal'); ?></td>
|
<td><?php echo $formcompany->selectTypeContact($object, '', 'type','internal'); ?></td>
|
||||||
<td align="right" colspan="3" ><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></td>
|
<td align="right" colspan="3" ><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -71,17 +71,23 @@ $userstatic=new User($db);
|
|||||||
<tr <?php echo $bc[$var]; ?>>
|
<tr <?php echo $bc[$var]; ?>>
|
||||||
<td nowrap="nowrap"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></td>
|
<td nowrap="nowrap"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?>
|
<?php //$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?>
|
||||||
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany'); ?>
|
<?php //$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany'); ?>
|
||||||
|
<?php
|
||||||
|
$events=array();
|
||||||
|
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||||
|
print $form->select_company($object->socid,'socid','',1,0,0,$events);
|
||||||
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php $nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid'); ?>
|
<?php //$nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid'); ?>
|
||||||
|
<?php $nbofcontacts=$form->select_contacts($object->socid, '', 'contactid'); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php $formcompany->selectTypeContact($object, '', 'type','external'); ?>
|
<?php $formcompany->selectTypeContact($object, '', 'type','external'); ?>
|
||||||
</td>
|
</td>
|
||||||
<td align="right" colspan="3" >
|
<td align="right" colspan="3" >
|
||||||
<input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled="disabled"'; ?>>
|
<input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled="disabled"'; ?>>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -55,7 +55,8 @@ if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer)
|
|||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -819,8 +819,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
|||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -55,7 +55,8 @@ if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer)
|
|||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
@ -838,8 +838,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
|||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
|
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user