Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2012-03-17 00:23:17 +01:00
commit a458ea3582
9 changed files with 362 additions and 328 deletions

View File

@ -1044,6 +1044,67 @@ else if ($action == 'down' && $user->rights->propale->creer)
exit;
}
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
if ($action == 'addcontact' && $user->rights->propale->creer)
{
$result = $object->fetch($id);
if ($result > 0 && $id > 0)
{
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
}
if ($result >= 0)
{
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
}
else
{
$mesg = '<div class="error">'.$object->error.'</div>';
}
}
}
// Bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->propale->creer)
{
if ($object->fetch($id) > 0)
{
$result=$object->swapContactStatus(GETPOST('ligne'));
}
else
{
dol_print_error($db);
}
}
// Efface un contact
else if ($action == 'deletecontact' && $user->rights->propale->creer)
{
$object->fetch($id);
$result = $object->delete_contact($lineid);
if ($result >= 0)
{
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
dol_print_error($db);
}
}
}
/*
* View
@ -1479,9 +1540,21 @@ if ($id > 0 || ! empty($ref))
print '</table><br>';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
$formcompany= new FormCompany($db);
$blocname = 'contacts';
$title = $langs->trans('ContactsAddresses');
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
}
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
$blocname = 'notes';
$title = $langs->trans('Notes');
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
}
/*

View File

@ -93,7 +93,7 @@ else if ($action == 'swapstatut' && $user->rights->propale->creer)
}
// Efface un contact
else if ($action == 'deleteline' && $user->rights->propale->creer)
else if ($action == 'deletecontact' && $user->rights->propale->creer)
{
$object->fetch($id);
$result = $object->delete_contact($lineid);
@ -126,8 +126,6 @@ llxHeader('', $langs->trans("Proposal"), "Propal");
$form = new Form($db);
$formcompany= new FormCompany($db);
$formother = new FormOther($db);
$contactstatic=new Contact($db);
$userstatic=new User($db);
/* *************************************************************************** */
@ -205,185 +203,10 @@ if ($id > 0 || ! empty($ref))
/*
* Lignes de contacts
*/
print '<br><table class="noborder" width="100%">';
/*
* Ajouter une ligne de contact
* Non affiche en mode modification de ligne
*/
if ($action != 'editline' && $user->rights->propale->creer)
{
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
print '<td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("Contacts").'</td>';
print '<td>'.$langs->trans("ContactType").'</td>';
print '<td colspan="3">&nbsp;</td>';
print "</tr>\n";
$var = false;
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addcontact">';
print '<input type="hidden" name="source" value="internal">';
// Line to add an internal contact
print "<tr ".$bc[$var].">";
print '<td nowrap="nowrap">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td>';
print $conf->global->MAIN_INFO_SOCIETE_NOM;
print '</td>';
print '<td>';
// On recupere les id des users deja selectionnes
//$userAlreadySelected = $object->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le selectionner une deuxieme fois pour un autre type
$form->select_users($user->id,'contactid',0,$userAlreadySelected);
print '</td>';
print '<td>';
$formcompany->selectTypeContact($object, '', 'type','internal');
print '</td>';
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
print '</form>';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addcontact">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="source" value="external">';
// Line to add an external contact
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td>';
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->client->id;
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany');
print '</td>';
print '<td>';
$nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid');
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>';
print '<td>';
$formcompany->selectTypeContact($object, '', 'type','external');
print '</td>';
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
if (! $nbofcontacts) print ' disabled="disabled"';
print '></td>';
print '</tr>';
print '</form>';
print '<tr><td colspan="7">&nbsp;</td></tr>';
}
// Liste des contacts lies
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
print '<td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("Contacts").'</td>';
print '<td>'.$langs->trans("ContactType").'</td>';
print '<td align="center">'.$langs->trans("Status").'</td>';
print '<td colspan="2">&nbsp;</td>';
print "</tr>\n";
$companystatic = new Societe($db);
$var = true;
foreach(array('internal','external') as $source)
{
$tab = $object->liste_contact(-1,$source);
$num=count($tab);
$i = 0;
while ($i < $num)
{
$var = !$var;
print '<tr '.$bc[$var].' valign="top">';
// Source
print '<td align="left">';
if ($tab[$i]['source']=='internal') print $langs->trans("User");
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
print '</td>';
// Societe
print '<td align="left">';
if ($tab[$i]['socid'] > 0)
{
$companystatic->fetch($tab[$i]['socid']);
print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
print $conf->global->MAIN_INFO_SOCIETE_NOM;
}
if (! $tab[$i]['socid'])
{
print '&nbsp;';
}
print '</td>';
// Contact
print '<td>';
if ($tab[$i]['source']=='internal')
{
$userstatic->id=$tab[$i]['id'];
$userstatic->lastname=$tab[$i]['lastname'];
$userstatic->firstname=$tab[$i]['firstname'];
print $userstatic->getNomUrl(1);
}
if ($tab[$i]['source']=='external')
{
$contactstatic->id=$tab[$i]['id'];
$contactstatic->lastname=$tab[$i]['lastname'];
$contactstatic->firstname=$tab[$i]['firstname'];
print $contactstatic->getNomUrl(1);
}
print '</td>';
// Type de contact
print '<td>'.$tab[$i]['libelle'].'</td>';
// Statut
print '<td align="center">';
// Activation desativation du contact
if ($object->statut >= 0) print '<a href="contact.php?id='.$object->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">';
print $contactstatic->LibStatut($tab[$i]['status'],3);
if ($object->statut >= 0) print '</a>';
print '</td>';
// Icon update et delete
print '<td align="center" nowrap="nowrap" colspan="2">';
if ($user->rights->propale->creer)
{
print '&nbsp;';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deleteline&amp;lineid='.$tab[$i]['rowid'].'">';
print img_delete();
print '</a>';
}
print '</td>';
print "</tr>\n";
$i ++;
}
}
print "</table>";
print '<br>';
include(DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php');
}
else
{

View File

@ -32,54 +32,33 @@ $langs->load('propal');
$langs->load('compta');
$langs->load('bills');
$id = isset($_GET["id"])?$_GET["id"]:'';
$id = GETPOST('id','int');
$ref=GETPOST('ref','alpha');
$action=GETPOST('action','alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'propale', $id, 'propal');
$object = new Propal($db);
/******************************************************************************/
/* Actions */
/******************************************************************************/
if ($_POST["action"] == 'update_public' && $user->rights->propale->creer)
{
$propal = new Propal($db);
$propal->fetch($_GET["id"]);
$db->begin();
$res=$propal->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg='<div class="error">'.$propal->error.'</div>';
$db->rollback();
}
else
{
$db->commit();
}
}
if ($_POST['action'] == 'update' && $user->rights->propale->creer)
{
$propal = new Propal($db);
$propal->fetch($_GET["id"]);
$db->begin();
$res=$propal->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg='<div class="error">'.$propal->error.'</div>';
$db->rollback();
}
else
{
$db->commit();
}
if ($action == 'setnote_public' && $user->rights->propale->creer)
{
$object->fetch($id);
$result=$object->update_note_public(GETPOST('note_public','alpha'));
if ($result < 0) dol_print_error($db,$object->error);
}
else if ($action == 'setnote' && $user->rights->propale->creer)
{
$object->fetch($id);
$result=$object->update_note(GETPOST('note','alpha'));
if ($result < 0) dol_print_error($db,$object->error);
}
@ -92,21 +71,18 @@ llxHeader();
$form = new Form($db);
$id = $_GET["id"];
$ref= $_GET["ref"];
if ($id > 0 || ! empty($ref))
{
if ($mesg) print $mesg;
$now=gmmktime();
$propal = new Propal($db);
if ($propal->fetch($id, $ref))
if ($object->fetch($id, $ref))
{
$societe = new Societe($db);
if ( $societe->fetch($propal->socid) )
if ( $societe->fetch($object->socid) )
{
$head = propal_prepare_head($propal);
$head = propal_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal');
print '<table class="border" width="100%">';
@ -115,7 +91,7 @@ if ($id > 0 || ! empty($ref))
// Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($propal,'ref',$linkback,1,'ref','ref','');
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
print '</td></tr>';
// Ref client
@ -125,15 +101,15 @@ if ($id > 0 || ! empty($ref))
print '</td>';
print '</tr></table>';
print '</td><td colspan="3">';
print $propal->ref_client;
print $object->ref_client;
print '</td>';
print '</tr>';
// Customer
if ( is_null($propal->client) )
$propal->fetch_thirdparty();
if ( is_null($object->client) )
$object->fetch_thirdparty();
print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$propal->client->getNomUrl(1).'</td></tr>';
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
@ -148,17 +124,17 @@ if ($id > 0 || ! empty($ref))
// Date
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
print dol_print_date($propal->date,'daytext');
print dol_print_date($object->date,'daytext');
print '</td>';
print '</tr>';
// Date fin propal
print '<tr>';
print '<td>'.$langs->trans('DateEndPropal').'</td><td colspan="3">';
if ($propal->fin_validite)
if ($object->fin_validite)
{
print dol_print_date($propal->fin_validite,'daytext');
if ($propal->statut == 1 && $propal->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print dol_print_date($object->fin_validite,'daytext');
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
}
else
{
@ -166,45 +142,8 @@ if ($id > 0 || ! empty($ref))
}
print '</td>';
print '</tr>';
// Note publique
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
print '<td valign="top" colspan="3">';
if ($_GET["action"] == 'edit')
{
print '<form method="post" action="note.php?id='.$propal->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update_public">';
print '<textarea name="note_public" cols="80" rows="8">'.$propal->note_public."</textarea><br>";
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</form>';
}
else
{
print ($propal->note_public?nl2br($propal->note_public):"&nbsp;");
}
print "</td></tr>";
// Note privee
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
print '<td valign="top" colspan="3">';
if ($_GET["action"] == 'edit')
{
print '<form method="post" action="note.php?id='.$propal->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<textarea name="note" cols="80" rows="8">'.$propal->note."</textarea><br>";
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</form>';
}
else
{
print ($propal->note?nl2br($propal->note):"&nbsp;");
}
print "</td></tr>";
}
include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
print "</table>";
@ -215,15 +154,16 @@ if ($id > 0 || ! empty($ref))
*/
print '<div class="tabsAction">';
if ($user->rights->propale->creer && $_GET['action'] <> 'edit')
if ($user->rights->propale->creer && $action <> 'edit')
{
print '<a class="butAction" href="note.php?id='.$propal->id.'&amp;action=edit">'.$langs->trans('Modify').'</a>';
print '<a class="butAction" href="note.php?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify').'</a>';
}
print '</div>';
}
}
}
$db->close();
llxFooter();
$db->close();
?>

View File

@ -61,12 +61,14 @@ if(! empty($id) && ! empty($element) && ! empty($htmlelement) && ! empty($type))
dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php');
$classname = ucfirst($subelement);
$object = new $classname($db);
$object->id = $id;
$classname = ucfirst($subelement);
$object = new $classname($db);
$object->fetch($id);
$params[$htmlelement] = array($type => $value);
$result=$object->setExtraParameters($params);
$object->extraparams = array_merge($object->extraparams, $params);
$result=$object->setExtraParameters();
}
?>

View File

@ -2131,13 +2131,11 @@ abstract class CommonObject
/**
* Set extra parameters
*
* @param array $params Extra parameters
* @return void
*/
function setExtraParameters($params)
function setExtraParameters()
{
$this->db->begin();
$this->extraparams = array_merge($this->extraparams, (array) $params);
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' SET extraparams = "'.$this->db->escape(dol_json_encode($this->extraparams)).'"';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-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
@ -62,11 +62,14 @@ function propal_prepare_head($object)
$head[$h][2] = 'preview';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
$head[$h][2] = 'contact';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
$head[$h][2] = 'contact';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line

View File

@ -0,0 +1,62 @@
<?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/>.
*
*/
// Hide by default
$hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false);
?>
<!-- BEGIN PHP TEMPLATE BLOC SHOW/HIDE -->
<script type="text/javascript">
$(document).ready(function() {
$("#hide-<?php echo $blocname ?>").click(function(){
setShowHide(0);
$("#<?php echo $blocname ?>_bloc").hide("blind", {direction: "vertical"}, 800).removeClass("nohideobject");
$(this).hide();
$("#show-<?php echo $blocname ?>").show();
});
$("#show-<?php echo $blocname ?>").click(function(){
setShowHide(1);
$("#<?php echo $blocname ?>_bloc").show("blind", {direction: "vertical"}, 800).addClass("nohideobject");
$(this).hide();
$("#hide-<?php echo $blocname ?>").show();
});
function setShowHide(status) {
var id = <?php echo $object->id; ?>;
var element = '<?php echo $object->element; ?>';
var htmlelement = '<?php echo $blocname ?>';
var type = 'showhide';
$.get("<?php echo dol_buildpath('/core/ajax/extraparams.php', 1); ?>?id="+id+"&element="+element+"&htmlelement="+htmlelement+"&type="+type+"&value="+status);
}
});
</script>
<div style="float:right; position: relative; top: 3px; right:5px;" id="hide-<?php echo $blocname ?>" class="linkobject<?php echo ($hide ? ' hideobject' : ''); ?>"><?php echo img_picto('', '1uparrow.png'); ?></div>
<div style="float:right; position: relative; top: 3px; right:5px;" id="show-<?php echo $blocname ?>" class="linkobject<?php echo ($hide ? '' : ' hideobject'); ?>"><?php echo img_picto('', '1downarrow.png'); ?></div>
<div id="<?php echo $blocname ?>_title" class="liste_titre"><?php echo $title; ?></div>
<div id="<?php echo $blocname ?>_bloc" class="<?php echo ($hide ? 'hideobject' : 'nohideobject'); ?>">
<?php include(DOL_DOCUMENT_ROOT.'/core/tpl/'.$blocname.'.tpl.php'); ?>
</div>
<br>
<!-- END PHP TEMPLATE BLOC SHOW/HIDE -->

View File

@ -0,0 +1,168 @@
<?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/>.
*
*/
$module = $object->element;
if ($module == 'propal') $module = 'propale';
else if ($module == 'fichinter') { $module = 'ficheinter'; }
$companystatic=new Societe($db);
$contactstatic=new Contact($db);
$userstatic=new User($db);
?>
<!-- BEGIN PHP TEMPLATE CONTACTS -->
<table class="noborder allwidth">
<?php if ($user->rights->$module->creer) { ?>
<tr class="liste_titre">
<td><?php echo $langs->trans("Source"); ?></td>
<td><?php echo $langs->trans("Company"); ?></td>
<td><?php echo $langs->trans("Contacts"); ?></td>
<td><?php echo $langs->trans("ContactType"); ?></td>
<td colspan="3">&nbsp;</td>
</tr>
<?php $var=false; ?>
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
<input type="hidden" name="action" value="addcontact" />
<input type="hidden" name="source" value="internal" />
<tr <?php echo $bc[$var]; ?>>
<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 $form->select_users($user->id,'contactid',0,$userAlreadySelected); ?></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>
</tr>
</form>
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
<input type="hidden" name="action" value="addcontact" />
<input type="hidden" name="source" value="internal" />
<?php $var=!$var; ?>
<tr <?php echo $bc[$var]; ?>>
<td nowrap="nowrap"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></td>
<td>
<?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?>
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany'); ?>
</td>
<td>
<?php $nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid'); ?>
<?php if ($nbofcontacts == 0) echo $langs->trans("NoContactDefined"); ?>
</td>
<td>
<?php $formcompany->selectTypeContact($object, '', 'type','external'); ?>
</td>
<td align="right" colspan="3" >
<input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled="disabled"'; ?>>
</td>
</tr>
</form>
<tr>
<td colspan="7">&nbsp;</td>
</tr>
<?php } ?>
<tr class="liste_titre">
<td><?php echo $langs->trans("Source"); ?></td>
<td><?php echo $langs->trans("Company"); ?></td>
<td><?php echo $langs->trans("Contacts"); ?></td>
<td><?php echo $langs->trans("ContactType"); ?></td>
<td align="center"><?php echo $langs->trans("Status"); ?></td>
<td colspan="2">&nbsp;</td>
</tr>
<?php $var=true; ?>
<?php
foreach(array('internal','external') as $source) {
$tab = $object->liste_contact(-1,$source);
$num=count($tab);
$i = 0;
while ($i < $num) {
$var = !$var;
?>
<tr <?php echo $bc[$var]; ?> valign="top">
<td align="left">
<?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?>
<?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?>
</td>
<td align="left">
<?php
if ($tab[$i]['socid'] > 0)
{
$companystatic->fetch($tab[$i]['socid']);
echo $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
echo $conf->global->MAIN_INFO_SOCIETE_NOM;
}
if (! $tab[$i]['socid'])
{
echo '&nbsp;';
}
?>
</td>
<td>
<?php
if ($tab[$i]['source']=='internal')
{
$userstatic->id=$tab[$i]['id'];
$userstatic->lastname=$tab[$i]['lastname'];
$userstatic->firstname=$tab[$i]['firstname'];
echo $userstatic->getNomUrl(1);
}
if ($tab[$i]['source']=='external')
{
$contactstatic->id=$tab[$i]['id'];
$contactstatic->lastname=$tab[$i]['lastname'];
$contactstatic->firstname=$tab[$i]['firstname'];
echo $contactstatic->getNomUrl(1);
}
?>
</td>
<td><?php echo $tab[$i]['libelle']; ?></td>
<td align="center">
<?php if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">'; ?>
<?php echo $contactstatic->LibStatut($tab[$i]['status'],3); ?>
<?php if ($object->statut >= 0) echo '</a>'; ?>
</td>
<td align="center" nowrap="nowrap" colspan="2">
<?php if ($user->rights->$module->creer) { ?>
&nbsp;<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deletecontact&amp;lineid='.$tab[$i]['rowid']; ?>"><?php echo img_delete(); ?></a>
<?php } ?>
</td>
</tr>
<?php $i++; ?>
<?php } } ?>
</table>
<!-- END PHP TEMPLATE CONTACTS -->

View File

@ -16,7 +16,6 @@
*
*/
$hide = $object->extraparams['notes']['showhide'];
$module = $object->element;
$note_public = 'note_public';
$note_private = 'note';
@ -25,38 +24,7 @@ else if ($module == 'fichinter') { $module = 'ficheinter'; $note_private = 'note
?>
<!-- BEGIN PHP TEMPLATE -->
<script type="text/javascript">
$(document).ready(function() {
$("#hide-notes").click(function(){
setShowHide(1);
$("#notes_bloc").hide("blind", {direction: "vertical"}, 800).removeClass("nohideobject");
$(this).hide();
$("#show-notes").show();
});
$("#show-notes").click(function(){
setShowHide(0);
$("#notes_bloc").show("blind", {direction: "vertical"}, 800).addClass("nohideobject");
$(this).hide();
$("#hide-notes").show();
});
function setShowHide(status) {
var id = <?php echo $object->id; ?>;
var element = '<?php echo $object->element; ?>';
var htmlelement = 'notes';
var type = 'showhide';
$.get("<?php echo dol_buildpath('/core/ajax/extraparams.php', 1); ?>?id="+id+"&element="+element+"&htmlelement="+htmlelement+"&type="+type+"&value="+status);
}
});
</script>
<div style="float:right; position: relative; top: 3px; right:5px;" id="hide-notes" class="linkobject<?php echo ($hide ? ' hideobject' : ''); ?>"><?php echo img_picto('', '1uparrow.png'); ?></div>
<div style="float:right; position: relative; top: 3px; right:5px;" id="show-notes" class="linkobject<?php echo ($hide ? '' : ' hideobject'); ?>"><?php echo img_picto('', '1downarrow.png'); ?></div>
<div class="liste_titre"><?php echo $langs->trans('Notes'); ?></div>
<div id="notes_bloc" class="<?php echo ($hide ? 'hideobject' : 'nohideobject'); ?>">
<!-- BEGIN PHP TEMPLATE NOTES -->
<table class="border allwidth">
<tr>
<td width="25%" valign="top"><?php echo $form->editfieldkey("NotePublic",$note_public,$object->note_public,$object,$user->rights->$module->creer,'textarea'); ?></td>
@ -71,7 +39,4 @@ $(document).ready(function() {
<?php } ?>
</table>
</div>
<br>
<!-- END PHP TEMPLATE -->
<!-- END PHP TEMPLATE NOTES-->