Uniformize code for contacts linking
This commit is contained in:
parent
2db114f18b
commit
c78bd22adc
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||||
|
|
||||||
$langs->load("facture");
|
$langs->load("facture");
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
@ -143,9 +144,14 @@ if ($_GET["action"] == 'deleteline' && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader('', $langs->trans("Proposal"), "Propal");
|
llxHeader('', $langs->trans("Proposal"), "Propal");
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
$formcompany= new FormCompany($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
@ -208,7 +214,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiché en mode modification de ligne
|
* Non affich<EFBFBD> en mode modification de ligne
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] != 'editline' && $user->rights->propale->creer)
|
if ($_GET["action"] != 'editline' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
@ -239,12 +245,12 @@ if ($id > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des users déjà sélectionnés
|
// On r<EFBFBD>cup<EFBFBD>re les id des users d<>j<EFBFBD> s<>lectionn<6E>s
|
||||||
//$userAlreadySelected = $propal->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $propal->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$propal->selectTypeContact($propal, '', 'type','internal');
|
$formcompany->selectTypeContact($propal, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -266,17 +272,16 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$propal->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$propal->client->id;
|
||||||
$selectedCompany = $propal->selectCompaniesForNewContact($propal, 'propalid', $selectedCompany, $htmlname = 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($propal, 'propalid', $selectedCompany, $htmlname = 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
|
||||||
//$contactAlreadySelected = $propal->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$contactAlreadySelected = $propal->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$propal->selectTypeContact($propal, '', 'type','external');
|
$formcompany->selectTypeContact($propal, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="true"';
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
@ -288,7 +293,7 @@ if ($id > 0)
|
|||||||
print '<tr><td colspan="6"> </td></tr>';
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste des contacts liés
|
// Liste des contacts li<EFBFBD>s
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
print '<td>'.$langs->trans("Company").'</td>';
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
@ -382,8 +387,7 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Propale non trouvée
|
print "ErrorRecordNotFound";
|
||||||
print "Propale inexistante ou accès refusé";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||||
* Copyright (C) 2005-2007 Destailleur Laurent <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2009 Destailleur Laurent <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
|
||||||
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||||
|
|
||||||
$langs->load("facture");
|
$langs->load("facture");
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
@ -146,6 +147,7 @@ if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer)
|
|||||||
llxHeader('', $langs->trans("Order"), "Commande");
|
llxHeader('', $langs->trans("Order"), "Commande");
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
$formcompany = new FormCompany($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
@ -210,7 +212,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiché en mode modification de ligne
|
* Non affich<EFBFBD> en mode modification de ligne
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] != 'editline' && $user->rights->facture->creer)
|
if ($_GET["action"] != 'editline' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
@ -241,12 +243,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des users déjà sélectionnés
|
|
||||||
//$userAlreadySelected = $commande->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $commande->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$commande->selectTypeContact($commande, '', 'type','internal');
|
$formcompany->selectTypeContact($commande, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -268,17 +269,16 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id;
|
||||||
$selectedCompany = $commande->selectCompaniesForNewContact($commande, 'id', $selectedCompany, $htmlname = 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($commande, 'id', $selectedCompany, 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
|
||||||
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$commande->selectTypeContact($commande, '', 'type','external');
|
$formcompany->selectTypeContact($commande, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="true"';
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
@ -290,7 +290,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<tr><td colspan="6"> </td></tr>';
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste des contacts liés
|
// List of linked contacts
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
print '<td>'.$langs->trans("Company").'</td>';
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
@ -385,7 +385,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Contrat non trouv
|
// Contrat non trouv
|
||||||
print "Contrat inexistant ou accés refusé";
|
print "ErrorRecordNotFound";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -395,107 +395,6 @@ class CommonObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Retourne la liste d<EFBFBD>roulante des soci<EFBFBD>t<EFBFBD>s
|
|
||||||
* \param object Fetch du document
|
|
||||||
* \param var_id Nom de la variable de l'id du document
|
|
||||||
* \param selected Societe pr<EFBFBD>s<EFBFBD>lectionn<EFBFBD>e
|
|
||||||
* \param htmlname Nom champ formulaire
|
|
||||||
*/
|
|
||||||
function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany')
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
// On recherche les societes
|
|
||||||
$sql = "SELECT s.rowid, s.nom FROM";
|
|
||||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
|
||||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
|
|
||||||
{
|
|
||||||
$sql.= " WHERE rowid = ".$selected;
|
|
||||||
}
|
|
||||||
$sql .= " ORDER BY nom ASC";
|
|
||||||
|
|
||||||
$resql = $object->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
|
|
||||||
{
|
|
||||||
$langs->load("companies");
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$socid = $obj->rowid?$obj->rowid:'';
|
|
||||||
$javaScript = "window.location=\'./contact.php?".$var_id."=".$object->id."&".$htmlname."=\' + document.getElementById(\'newcompany_id\').value;";
|
|
||||||
|
|
||||||
// On applique un delai d'execution pour le bon fonctionnement
|
|
||||||
$htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"';
|
|
||||||
|
|
||||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
|
||||||
print '<td class="nobordernopadding">';
|
|
||||||
print '<div>';
|
|
||||||
if ($obj->rowid == 0)
|
|
||||||
{
|
|
||||||
print '<input type="text" size="30" id="newcompany" name="newcompany" value="'.$langs->trans("SelectCompany").'" '.$htmloption.' />';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<input type="text" size="30" id="newcompany" name="newcompany" value="'.$obj->nom.'" '.$htmloption.' />';
|
|
||||||
}
|
|
||||||
print ajax_autocompleter($socid,'newcompany','/societe/ajaxcompanies.php','');
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="nobordernopadding" align="left" width="16">';
|
|
||||||
print ajax_indicator($htmlname,'working');
|
|
||||||
print '</td></tr>';
|
|
||||||
print '</table>';
|
|
||||||
return $socid;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$javaScript = "window.location='./contact.php?".$var_id."=".$object->id."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
|
|
||||||
print '<select class="flat" name="'.$htmlname.'" onChange="'.$javaScript.'">';
|
|
||||||
$num = $object->db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $object->db->fetch_object($resql);
|
|
||||||
if ($i == 0) $firstCompany = $obj->rowid;
|
|
||||||
if ($selected > 0 && $selected == $obj->rowid)
|
|
||||||
{
|
|
||||||
print '<option value="'.$obj->rowid.'" selected="true">'.dolibarr_trunc($obj->nom,24).'</option>';
|
|
||||||
$firstCompany = $obj->rowid;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<option value="'.$obj->rowid.'">'.dolibarr_trunc($obj->nom,24).'</option>';
|
|
||||||
}
|
|
||||||
$i ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "</select>\n";
|
|
||||||
return $firstCompany;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($object->db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function selectTypeContact($object, $defValue, $htmlname = 'type', $source)
|
|
||||||
{
|
|
||||||
$lesTypes = $object->liste_type_contact($source);
|
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
|
||||||
foreach($lesTypes as $key=>$value)
|
|
||||||
{
|
|
||||||
print '<option value="'.$key.'">'.$value.'</option>';
|
|
||||||
}
|
|
||||||
print "</select>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load properties id_previous and id_next
|
* \brief Load properties id_previous and id_next
|
||||||
|
|||||||
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||||
|
|
||||||
$langs->load("facture");
|
$langs->load("facture");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
@ -144,6 +145,7 @@ if ($_GET["action"] == 'deleteline' && $user->rights->facture->creer)
|
|||||||
llxHeader('', $langs->trans("Bill"), "Facture");
|
llxHeader('', $langs->trans("Bill"), "Facture");
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
$formcompany = new FormCompany($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
@ -182,6 +184,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lignes de contacts
|
* Lignes de contacts
|
||||||
*/
|
*/
|
||||||
@ -189,7 +192,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiché en mode modification de ligne
|
* Non affich<EFBFBD> en mode modification de ligne
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] != 'editline' && $user->rights->facture->creer)
|
if ($_GET["action"] != 'editline' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
@ -220,12 +223,12 @@ if ($id > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des users déjà sélectionnés
|
// On r<EFBFBD>cup<EFBFBD>re les id des users d<>j<EFBFBD> s<>lectionn<6E>s
|
||||||
//$userAlreadySelected = $facture->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $facture->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$facture->selectTypeContact($facture, '', 'type','internal');
|
$formcompany->selectTypeContact($facture, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -247,17 +250,16 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$facture->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$facture->client->id;
|
||||||
$selectedCompany = $facture->selectCompaniesForNewContact($facture, 'facid', $selectedCompany, $htmlname = 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($facture, 'facid', $selectedCompany, $htmlname = 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
|
||||||
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
|
||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$facture->selectTypeContact($facture, '', 'type','external');
|
$formcompany->selectTypeContact($facture, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="true"';
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
@ -269,7 +271,7 @@ if ($id > 0)
|
|||||||
print '<tr><td colspan="6"> </td></tr>';
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste des contacts liés
|
// List of linked contacts
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
print '<td>'.$langs->trans("Company").'</td>';
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
@ -300,7 +302,7 @@ if ($id > 0)
|
|||||||
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
|
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Societe
|
// Third party
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($tab[$i]['socid'] > 0)
|
if ($tab[$i]['socid'] > 0)
|
||||||
{
|
{
|
||||||
@ -332,18 +334,18 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Type de contact
|
// Type of contact
|
||||||
print '<td>'.$tab[$i]['libelle'].'</td>';
|
print '<td>'.$tab[$i]['libelle'].'</td>';
|
||||||
|
|
||||||
// Statut
|
// Status
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
// Activation desativation du contact
|
// Activate/Unactivate contact
|
||||||
if ($facture->statut >= 0) print '<a href="contact.php?facid='.$facture->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
if ($facture->statut >= 0) print '<a href="contact.php?facid='.$facture->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||||
if ($facture->statut >= 0) print '</a>';
|
if ($facture->statut >= 0) print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé)
|
// Icon update et delete
|
||||||
print '<td align="center" nowrap>';
|
print '<td align="center" nowrap>';
|
||||||
if ($user->rights->facture->creer)
|
if ($user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
@ -363,8 +365,8 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Contrat non trouvé
|
// Record not found
|
||||||
print "Contrat inexistant ou accés refusé";
|
print "ErrorRecordNotFound";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||||
|
|
||||||
|
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
@ -143,10 +144,14 @@ if ($_GET["action"] == 'deleteline' && $user->rights->contrat->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ContractCard"), "Contrat");
|
llxHeader('', $langs->trans("ContractCard"), "Contrat");
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
$formcompany= new FormCompany($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
@ -210,7 +215,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiché en mode modification de ligne
|
* Non affich<EFBFBD> en mode modification de ligne
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] != 'editline' && $user->rights->contrat->creer)
|
if ($_GET["action"] != 'editline' && $user->rights->contrat->creer)
|
||||||
{
|
{
|
||||||
@ -241,12 +246,11 @@ if ($id > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des users déjà sélectionnés
|
|
||||||
//$userAlreadySelected = $contrat->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $contrat->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$contrat->selectTypeContact($contrat, '', 'type','internal');
|
$formcompany->selectTypeContact($contrat, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -268,17 +272,16 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$contrat->societe->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$contrat->societe->id;
|
||||||
$selectedCompany = $contrat->selectCompaniesForNewContact($contrat, 'id', $selectedCompany, $htmlname = 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($contrat, 'id', $selectedCompany, 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
|
||||||
//$contactAlreadySelected = $contrat->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$contactAlreadySelected = $contrat->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$contrat->selectTypeContact($contrat, '', 'type','external');
|
$formcompany->selectTypeContact($contrat, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="true"';
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
@ -291,7 +294,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '<tr><td colspan="6"> </td></tr>';
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
|
|
||||||
// Liste des contacts liés
|
// Liste des contacts li<EFBFBD>s
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
print '<td>'.$langs->trans("Company").'</td>';
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
@ -365,9 +368,9 @@ if ($id > 0)
|
|||||||
if ($contrat->statut >= 0) print '</a>';
|
if ($contrat->statut >= 0) print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé)
|
// Icon delete
|
||||||
print '<td align="center" nowrap>';
|
print '<td align="center" nowrap>';
|
||||||
if ($contrat->statut == 0 && $user->rights->contrat->creer)
|
if ($user->rights->contrat->creer)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="contact.php?id='.$contrat->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
print '<a href="contact.php?id='.$contrat->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||||
@ -387,8 +390,7 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Contrat non trouvé
|
print "ErrorRecordNotFound";
|
||||||
print "Contrat inexistant ou accés refusé";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,16 +18,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/fichinter/contact.php
|
* \file htdocs/fichinter/contact.php
|
||||||
\ingroup fichinter
|
* \ingroup fichinter
|
||||||
\brief Onglet de gestion des contacts de fiche d'intervention
|
* \brief Onglet de gestion des contacts de fiche d'intervention
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require ("./pre.inc.php");
|
require ("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/fichinter/fichinter.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/fichinter/fichinter.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||||
|
|
||||||
$langs->load("interventions");
|
$langs->load("interventions");
|
||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
@ -142,9 +143,14 @@ if ($_GET["action"] == 'deleteline' && $user->rights->ficheinter->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
$formcompany = new FormCompany($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
@ -196,7 +202,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiché en mode modification de ligne
|
* Non affiche en mode modification de ligne
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] != 'editline' && $user->rights->ficheinter->creer)
|
if ($_GET["action"] != 'editline' && $user->rights->ficheinter->creer)
|
||||||
{
|
{
|
||||||
@ -227,12 +233,11 @@ if ($id > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des users déjà sélectionnés
|
|
||||||
//$userAlreadySelected = $fichinter->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $fichinter->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$fichinter->selectTypeContact($fichinter, '', 'type','internal');
|
$formcompany->selectTypeContact($fichinter, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -254,17 +259,16 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$fichinter->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$fichinter->client->id;
|
||||||
$selectedCompany = $fichinter->selectCompaniesForNewContact($fichinter, 'id', $selectedCompany, $htmlname = 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($fichinter, 'id', $selectedCompany, $htmlname = 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
|
||||||
//$contactAlreadySelected = $fichinter->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$contactAlreadySelected = $fichinter->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$fichinter->selectTypeContact($fichinter, '', 'type','external');
|
$formcompany->selectTypeContact($fichinter, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="true"';
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
@ -276,7 +280,7 @@ if ($id > 0)
|
|||||||
print '<tr><td colspan="6"> </td></tr>';
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste des contacts liés
|
// Liste des contacts li<EFBFBD>s
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
print '<td>'.$langs->trans("Company").'</td>';
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
@ -370,8 +374,7 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fiche intervention non trouvée
|
print "ErrorRecordNotFound";
|
||||||
print "Fiche intervention inexistante ou accès refusé";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
require_once DOL_DOCUMENT_ROOT."/lib/fourn.lib.php";
|
require_once DOL_DOCUMENT_ROOT."/lib/fourn.lib.php";
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||||
|
|
||||||
$langs->load("facture");
|
$langs->load("facture");
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
@ -151,6 +152,7 @@ if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer)
|
|||||||
llxHeader('', $langs->trans("Order"), "Commande");
|
llxHeader('', $langs->trans("Order"), "Commande");
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
$formcompany = new FormCompany($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
@ -205,7 +207,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiché en mode modification de ligne
|
* Non affich<EFBFBD> en mode modification de ligne
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] != 'editline' && $user->rights->fournisseur->facture->creer)
|
if ($_GET["action"] != 'editline' && $user->rights->fournisseur->facture->creer)
|
||||||
{
|
{
|
||||||
@ -238,12 +240,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des users déjà sélectionnés
|
|
||||||
//$userAlreadySelected = $commande->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $commande->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$commande->selectTypeContact($commande, '', 'type','internal');
|
$formcompany->selectTypeContact($commande, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -265,17 +266,16 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id;
|
||||||
$selectedCompany = $commande->selectCompaniesForNewContact($commande, 'id', $selectedCompany, $htmlname = 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($commande, 'id', $selectedCompany, 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On récupère les id des contacts déjà sélectionnés
|
|
||||||
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$commande->selectTypeContact($commande, '', 'type','external');
|
$formcompany->selectTypeContact($commande, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="true"';
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
@ -287,7 +287,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<tr><td colspan="6"> </td></tr>';
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste des contacts liés
|
// List of linked contacts
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
print '<td>'.$langs->trans("Company").'</td>';
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
|
|||||||
@ -51,7 +51,7 @@ $comclientid = isset($_GET["comid"])?$_GET["comid"]:'';
|
|||||||
$id = isset($_GET["id"])?$_GET["id"]:$_POST["id"];
|
$id = isset($_GET["id"])?$_GET["id"]:$_POST["id"];
|
||||||
|
|
||||||
// Securite acces client
|
// Securite acces client
|
||||||
$socid=0;
|
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -431,11 +431,12 @@ if ($action=='remove_file')
|
|||||||
if ($_GET["action"] == 'create')
|
if ($_GET["action"] == 'create')
|
||||||
{
|
{
|
||||||
$fourn = new Fournisseur($db);
|
$fourn = new Fournisseur($db);
|
||||||
$fourn->fetch($_GET["socid"]);
|
$result=$fourn->fetch($_GET["socid"]);
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$orderid=$fourn->create_commande($user);
|
$orderid=$fourn->create_commande($user);
|
||||||
|
|
||||||
if ($orderid > 0)
|
if ($orderid > 0)
|
||||||
{
|
{
|
||||||
$idc = $fourn->single_open_commande;
|
$idc = $fourn->single_open_commande;
|
||||||
@ -447,6 +448,7 @@ if ($_GET["action"] == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$id=$orderid;
|
$id=$orderid;
|
||||||
|
$_GET['id']=$id;
|
||||||
$_GET['action']='edit';
|
$_GET['action']='edit';
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||||
|
|
||||||
$langs->load("facture");
|
$langs->load("facture");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
@ -148,6 +149,7 @@ if ($_GET["action"] == 'deleteline' && $user->rights->fournisseur->facture->cree
|
|||||||
llxHeader('', $langs->trans("Bill"), "Facture");
|
llxHeader('', $langs->trans("Bill"), "Facture");
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
$formcompany = new FormCompany($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
@ -228,12 +230,11 @@ if ($id > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On r<>cup<75>re les id des users d<>j<EFBFBD> s<>lectionn<6E>s
|
|
||||||
//$userAlreadySelected = $facture->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $facture->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$facture->selectTypeContact($facture, '', 'type','internal');
|
$formcompany->selectTypeContact($facture, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -255,17 +256,16 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$facture->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$facture->client->id;
|
||||||
$selectedCompany = $facture->selectCompaniesForNewContact($facture, 'facid', $selectedCompany, $htmlname = 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($facture, 'facid', $selectedCompany, $htmlname = 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
// On r<>cup<75>re les id des contacts d<>j<EFBFBD> s<>lectionn<6E>s
|
|
||||||
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||||
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
|
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
|
||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$facture->selectTypeContact($facture, '', 'type','external');
|
$formcompany->selectTypeContact($facture, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="true"';
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
@ -277,7 +277,7 @@ if ($id > 0)
|
|||||||
print '<tr><td colspan="6"> </td></tr>';
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste des contacts lies
|
// List of linked contacts
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
print '<td>'.$langs->trans("Company").'</td>';
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
@ -371,7 +371,7 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "Object not found";
|
print "ErrorRecordNotFound";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2009 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
|
||||||
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/html.formcompany.class.php
|
* \file htdocs/html.formcompany.class.php
|
||||||
* \brief Fichier de la classe des fonctions pr<EFBFBD>d<EFBFBD>finie de composants html
|
* \brief File of class to build HTML component for third parties management
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class FormCompany
|
* \class FormCompany
|
||||||
* \brief Classe permettant la g<EFBFBD>n<EFBFBD>ration de composants html
|
* \brief Class to build HTML component for third parties management
|
||||||
* \remarks Only common components must be here.
|
* \remarks Only common components must be here.
|
||||||
*/
|
*/
|
||||||
class FormCompany
|
class FormCompany
|
||||||
@ -436,6 +436,109 @@ class FormCompany
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Return list of third parties
|
||||||
|
* \param object Object we try to find contacts
|
||||||
|
* \param var_id Name of id field
|
||||||
|
* \param selected Pre-selected third party
|
||||||
|
* \param htmlname Name of HTML form
|
||||||
|
*/
|
||||||
|
function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany')
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
// On recherche les societes
|
||||||
|
$sql = "SELECT s.rowid, s.nom FROM";
|
||||||
|
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||||
|
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
|
||||||
|
{
|
||||||
|
$sql.= " WHERE rowid = ".$selected;
|
||||||
|
}
|
||||||
|
$sql .= " ORDER BY nom ASC";
|
||||||
|
|
||||||
|
$resql = $object->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
|
||||||
|
{
|
||||||
|
$langs->load("companies");
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$socid = $obj->rowid?$obj->rowid:'';
|
||||||
|
$javaScript = "window.location=\'./contact.php?".$var_id."=".$object->id."&".$htmlname."=\' + document.getElementById(\'newcompany_id\').value;";
|
||||||
|
|
||||||
|
// On applique un delai d'execution pour le bon fonctionnement
|
||||||
|
$htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"';
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
|
print '<td class="nobordernopadding">';
|
||||||
|
print '<div>';
|
||||||
|
if ($obj->rowid == 0)
|
||||||
|
{
|
||||||
|
print '<input type="text" size="30" id="newcompany" name="newcompany" value="'.$langs->trans("SelectCompany").'" '.$htmloption.' />';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" size="30" id="newcompany" name="newcompany" value="'.$obj->nom.'" '.$htmloption.' />';
|
||||||
|
}
|
||||||
|
print ajax_autocompleter($socid,'newcompany','/societe/ajaxcompanies.php','');
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="nobordernopadding" align="left" width="16">';
|
||||||
|
print ajax_indicator($htmlname,'working');
|
||||||
|
print '</td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
return $socid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$javaScript = "window.location='./contact.php?".$var_id."=".$object->id."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
|
||||||
|
print '<select class="flat" name="'.$htmlname.'" onChange="'.$javaScript.'">';
|
||||||
|
$num = $object->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $object->db->fetch_object($resql);
|
||||||
|
if ($i == 0) $firstCompany = $obj->rowid;
|
||||||
|
if ($selected > 0 && $selected == $obj->rowid)
|
||||||
|
{
|
||||||
|
print '<option value="'.$obj->rowid.'" selected="true">'.dolibarr_trunc($obj->nom,24).'</option>';
|
||||||
|
$firstCompany = $obj->rowid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<option value="'.$obj->rowid.'">'.dolibarr_trunc($obj->nom,24).'</option>';
|
||||||
|
}
|
||||||
|
$i ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</select>\n";
|
||||||
|
return $firstCompany;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($object->db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function selectTypeContact($object, $defValue, $htmlname = 'type', $source)
|
||||||
|
{
|
||||||
|
$lesTypes = $object->liste_type_contact($source);
|
||||||
|
print '<select class="flat" name="'.$htmlname.'">';
|
||||||
|
foreach($lesTypes as $key=>$value)
|
||||||
|
{
|
||||||
|
print '<option value="'.$key.'">'.$value.'</option>';
|
||||||
|
}
|
||||||
|
print "</select>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user