mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
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."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||
|
||||
$langs->load("facture");
|
||||
$langs->load("orders");
|
||||
|
|
@ -143,9 +144,14 @@ if ($_GET["action"] == 'deleteline' && $user->rights->propale->creer)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Proposal"), "Propal");
|
||||
|
||||
$html = new Form($db);
|
||||
$formcompany= new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
|
|
@ -208,7 +214,7 @@ if ($id > 0)
|
|||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
|
@ -239,12 +245,12 @@ if ($id > 0)
|
|||
print '</td>';
|
||||
|
||||
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
|
||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$propal->selectTypeContact($propal, '', 'type','internal');
|
||||
$formcompany->selectTypeContact($propal, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
|
@ -266,17 +272,16 @@ if ($id > 0)
|
|||
|
||||
print '<td colspan="1">';
|
||||
$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 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
|
||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$propal->selectTypeContact($propal, '', 'type','external');
|
||||
$formcompany->selectTypeContact($propal, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="true"';
|
||||
|
|
@ -288,7 +293,7 @@ if ($id > 0)
|
|||
print '<tr><td colspan="6"> </td></tr>';
|
||||
}
|
||||
|
||||
// Liste des contacts liés
|
||||
// Liste des contacts li<EFBFBD>s
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
|
|
@ -382,8 +387,7 @@ if ($id > 0)
|
|||
}
|
||||
else
|
||||
{
|
||||
// Propale non trouvée
|
||||
print "Propale inexistante ou accès refusé";
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* 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
|
||||
* 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."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||
|
||||
$langs->load("facture");
|
||||
$langs->load("orders");
|
||||
|
|
@ -146,6 +147,7 @@ if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer)
|
|||
llxHeader('', $langs->trans("Order"), "Commande");
|
||||
|
||||
$html = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
|
|
@ -210,7 +212,7 @@ if ($id > 0 || ! empty($ref))
|
|||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
|
@ -241,12 +243,11 @@ if ($id > 0 || ! empty($ref))
|
|||
print '</td>';
|
||||
|
||||
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
|
||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$commande->selectTypeContact($commande, '', 'type','internal');
|
||||
$formcompany->selectTypeContact($commande, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
|
@ -268,17 +269,16 @@ if ($id > 0 || ! empty($ref))
|
|||
|
||||
print '<td colspan="1">';
|
||||
$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 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
|
||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$commande->selectTypeContact($commande, '', 'type','external');
|
||||
$formcompany->selectTypeContact($commande, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="true"';
|
||||
|
|
@ -290,7 +290,7 @@ if ($id > 0 || ! empty($ref))
|
|||
print '<tr><td colspan="6"> </td></tr>';
|
||||
}
|
||||
|
||||
// Liste des contacts liés
|
||||
// List of linked contacts
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
|
|
@ -385,7 +385,7 @@ if ($id > 0 || ! empty($ref))
|
|||
else
|
||||
{
|
||||
// Contrat non trouv
|
||||
print "Contrat inexistant ou accés refusé";
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -395,107 +395,6 @@ class CommonObject
|
|||
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
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||
|
||||
$langs->load("facture");
|
||||
$langs->load("companies");
|
||||
|
|
@ -144,6 +145,7 @@ if ($_GET["action"] == 'deleteline' && $user->rights->facture->creer)
|
|||
llxHeader('', $langs->trans("Bill"), "Facture");
|
||||
|
||||
$html = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
|
|
@ -182,6 +184,7 @@ if ($id > 0)
|
|||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Lignes de contacts
|
||||
*/
|
||||
|
|
@ -189,7 +192,7 @@ if ($id > 0)
|
|||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
|
@ -220,12 +223,12 @@ if ($id > 0)
|
|||
print '</td>';
|
||||
|
||||
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
|
||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$facture->selectTypeContact($facture, '', 'type','internal');
|
||||
$formcompany->selectTypeContact($facture, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
|
@ -247,17 +250,16 @@ if ($id > 0)
|
|||
|
||||
print '<td colspan="1">';
|
||||
$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 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 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 selectionne car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$facture->selectTypeContact($facture, '', 'type','external');
|
||||
$formcompany->selectTypeContact($facture, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="true"';
|
||||
|
|
@ -269,7 +271,7 @@ if ($id > 0)
|
|||
print '<tr><td colspan="6"> </td></tr>';
|
||||
}
|
||||
|
||||
// Liste des contacts liés
|
||||
// List of linked contacts
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
|
|
@ -300,7 +302,7 @@ if ($id > 0)
|
|||
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
|
||||
print '</td>';
|
||||
|
||||
// Societe
|
||||
// Third party
|
||||
print '<td align="left">';
|
||||
if ($tab[$i]['socid'] > 0)
|
||||
{
|
||||
|
|
@ -332,18 +334,18 @@ if ($id > 0)
|
|||
}
|
||||
print '</td>';
|
||||
|
||||
// Type de contact
|
||||
// Type of contact
|
||||
print '<td>'.$tab[$i]['libelle'].'</td>';
|
||||
|
||||
// Statut
|
||||
// Status
|
||||
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'].'">';
|
||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||
if ($facture->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé)
|
||||
// Icon update et delete
|
||||
print '<td align="center" nowrap>';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
|
|
@ -363,8 +365,8 @@ if ($id > 0)
|
|||
}
|
||||
else
|
||||
{
|
||||
// Contrat non trouvé
|
||||
print "Contrat inexistant ou accés refusé";
|
||||
// Record not found
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||
require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||
|
||||
|
||||
$langs->load("contracts");
|
||||
|
|
@ -143,10 +144,14 @@ if ($_GET["action"] == 'deleteline' && $user->rights->contrat->creer)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("ContractCard"), "Contrat");
|
||||
|
||||
$html = new Form($db);
|
||||
$formcompany= new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
|
|
@ -210,7 +215,7 @@ if ($id > 0)
|
|||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
|
@ -241,12 +246,11 @@ if ($id > 0)
|
|||
print '</td>';
|
||||
|
||||
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
|
||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$contrat->selectTypeContact($contrat, '', 'type','internal');
|
||||
$formcompany->selectTypeContact($contrat, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
|
@ -268,17 +272,16 @@ if ($id > 0)
|
|||
|
||||
print '<td colspan="1">';
|
||||
$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 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
|
||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$contrat->selectTypeContact($contrat, '', 'type','external');
|
||||
$formcompany->selectTypeContact($contrat, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="true"';
|
||||
|
|
@ -291,7 +294,7 @@ if ($id > 0)
|
|||
|
||||
print '<tr><td colspan="6"> </td></tr>';
|
||||
|
||||
// Liste des contacts liés
|
||||
// Liste des contacts li<EFBFBD>s
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
|
|
@ -365,9 +368,9 @@ if ($id > 0)
|
|||
if ($contrat->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé)
|
||||
// Icon delete
|
||||
print '<td align="center" nowrap>';
|
||||
if ($contrat->statut == 0 && $user->rights->contrat->creer)
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
print ' ';
|
||||
print '<a href="contact.php?id='.$contrat->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||
|
|
@ -387,8 +390,7 @@ if ($id > 0)
|
|||
}
|
||||
else
|
||||
{
|
||||
// Contrat non trouvé
|
||||
print "Contrat inexistant ou accés refusé";
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,16 +18,17 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/fichinter/contact.php
|
||||
\ingroup fichinter
|
||||
\brief Onglet de gestion des contacts de fiche d'intervention
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/fichinter/contact.php
|
||||
* \ingroup fichinter
|
||||
* \brief Onglet de gestion des contacts de fiche d'intervention
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require ("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/fichinter/fichinter.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||
|
||||
$langs->load("interventions");
|
||||
$langs->load("sendings");
|
||||
|
|
@ -142,9 +143,14 @@ if ($_GET["action"] == 'deleteline' && $user->rights->ficheinter->creer)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
|
|
@ -196,7 +202,7 @@ if ($id > 0)
|
|||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
|
@ -227,12 +233,11 @@ if ($id > 0)
|
|||
print '</td>';
|
||||
|
||||
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
|
||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$fichinter->selectTypeContact($fichinter, '', 'type','internal');
|
||||
$formcompany->selectTypeContact($fichinter, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
|
@ -254,17 +259,16 @@ if ($id > 0)
|
|||
|
||||
print '<td colspan="1">';
|
||||
$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 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
|
||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$fichinter->selectTypeContact($fichinter, '', 'type','external');
|
||||
$formcompany->selectTypeContact($fichinter, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="true"';
|
||||
|
|
@ -276,7 +280,7 @@ if ($id > 0)
|
|||
print '<tr><td colspan="6"> </td></tr>';
|
||||
}
|
||||
|
||||
// Liste des contacts liés
|
||||
// Liste des contacts li<EFBFBD>s
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
|
|
@ -370,8 +374,7 @@ if ($id > 0)
|
|||
}
|
||||
else
|
||||
{
|
||||
// Fiche intervention non trouvée
|
||||
print "Fiche intervention inexistante ou accès refusé";
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ require ("./pre.inc.php");
|
|||
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
require_once DOL_DOCUMENT_ROOT."/lib/fourn.lib.php";
|
||||
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||
|
||||
$langs->load("facture");
|
||||
$langs->load("orders");
|
||||
|
|
@ -151,6 +152,7 @@ if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer)
|
|||
llxHeader('', $langs->trans("Order"), "Commande");
|
||||
|
||||
$html = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
|
|
@ -205,7 +207,7 @@ if ($id > 0 || ! empty($ref))
|
|||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
|
@ -238,12 +240,11 @@ if ($id > 0 || ! empty($ref))
|
|||
print '</td>';
|
||||
|
||||
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
|
||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$commande->selectTypeContact($commande, '', 'type','internal');
|
||||
$formcompany->selectTypeContact($commande, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
|
@ -265,17 +266,16 @@ if ($id > 0 || ! empty($ref))
|
|||
|
||||
print '<td colspan="1">';
|
||||
$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 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
|
||||
$nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$commande->selectTypeContact($commande, '', 'type','external');
|
||||
$formcompany->selectTypeContact($commande, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="true"';
|
||||
|
|
@ -287,7 +287,7 @@ if ($id > 0 || ! empty($ref))
|
|||
print '<tr><td colspan="6"> </td></tr>';
|
||||
}
|
||||
|
||||
// Liste des contacts liés
|
||||
// List of linked contacts
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</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"];
|
||||
|
||||
// Securite acces client
|
||||
$socid=0;
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
|
|
@ -140,7 +140,7 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree
|
|||
$_POST['idprodfournprice'],
|
||||
$prodfournprice->fourn_ref,
|
||||
$_POST['remise_percent'],
|
||||
'HT'
|
||||
'HT'
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -209,13 +209,13 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
|
|||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
if (! empty($_REQUEST['lang_id']))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
|
||||
$outputlangs = $langs;
|
||||
if (! empty($_REQUEST['lang_id']))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -431,11 +431,12 @@ if ($action=='remove_file')
|
|||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->fetch($_GET["socid"]);
|
||||
$result=$fourn->fetch($_GET["socid"]);
|
||||
|
||||
$db->begin();
|
||||
|
||||
$orderid=$fourn->create_commande($user);
|
||||
|
||||
if ($orderid > 0)
|
||||
{
|
||||
$idc = $fourn->single_open_commande;
|
||||
|
|
@ -447,6 +448,7 @@ if ($_GET["action"] == 'create')
|
|||
}
|
||||
|
||||
$id=$orderid;
|
||||
$_GET['id']=$id;
|
||||
$_GET['action']='edit';
|
||||
$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."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
|
||||
|
||||
$langs->load("facture");
|
||||
$langs->load("companies");
|
||||
|
|
@ -148,6 +149,7 @@ if ($_GET["action"] == 'deleteline' && $user->rights->fournisseur->facture->cree
|
|||
llxHeader('', $langs->trans("Bill"), "Facture");
|
||||
|
||||
$html = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
|
|
@ -228,12 +230,11 @@ if ($id > 0)
|
|||
print '</td>';
|
||||
|
||||
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
|
||||
$html->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$facture->selectTypeContact($facture, '', 'type','internal');
|
||||
$formcompany->selectTypeContact($facture, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
|
@ -255,17 +256,16 @@ if ($id > 0)
|
|||
|
||||
print '<td colspan="1">';
|
||||
$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 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
|
||||
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$facture->selectTypeContact($facture, '', 'type','external');
|
||||
$formcompany->selectTypeContact($facture, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="true"';
|
||||
|
|
@ -277,7 +277,7 @@ if ($id > 0)
|
|||
print '<tr><td colspan="6"> </td></tr>';
|
||||
}
|
||||
|
||||
// Liste des contacts lies
|
||||
// List of linked contacts
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
|
|
@ -371,7 +371,7 @@ if ($id > 0)
|
|||
}
|
||||
else
|
||||
{
|
||||
print "Object not found";
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/fourn/fiche.php
|
||||
\ingroup fournisseur, facture
|
||||
\brief Page de fiche fournisseur
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/fourn/fiche.php
|
||||
\ingroup fournisseur, facture
|
||||
\brief Page de fiche fournisseur
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require('./pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
|
|
@ -46,89 +46,89 @@ $result = restrictedArea($user, 'societe',$socid,'');
|
|||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
*/
|
||||
$societe = new Fournisseur($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if ( $societe->fetch($socid) )
|
||||
{
|
||||
$addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid;
|
||||
$addons[0][1] = $societe->nom;
|
||||
|
||||
llxHeader('',$langs->trans('SupplierCard').' : '.$societe->nom, $addons);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($societe);
|
||||
|
||||
dolibarr_fiche_head($head, 'supplier', $langs->trans("ThirdParty"));
|
||||
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td valign="top" width="50%" class="notopnoleft">';
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$societe->prefix_comm.'</td></tr>';
|
||||
|
||||
if ($societe->fournisseur)
|
||||
{
|
||||
print '<tr><td nowrap="nowrap">';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $societe->code_fournisseur;
|
||||
if ($societe->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Zip").'</td><td>'.$societe->cp.'</td>';
|
||||
print '<td>'.$langs->trans("Town").'</td><td>'.$societe->ville.'</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
if ($societe->isInEEC()) print $form->textwithhelp($societe->pays,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print $societe->pays;
|
||||
print '</td></tr>';
|
||||
$addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid;
|
||||
$addons[0][1] = $societe->nom;
|
||||
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>";
|
||||
|
||||
// Assujetti a TVA ou pas
|
||||
print '<tr>';
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';
|
||||
print yn($societe->tva_assuj);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</td><td valign="top" width="50%" class="notopnoleftnoright">';
|
||||
$var=true;
|
||||
|
||||
$MAXLIST=5;
|
||||
|
||||
// Lien recap
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$societe->id.'">'.$langs->trans("ShowSupplierPreview").'</a></td></tr></table></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
* Liste des commandes associees
|
||||
*/
|
||||
$orderstatic = new CommandeFournisseur($db);
|
||||
|
||||
$sql = "SELECT p.rowid,p.ref,".$db->pdate("p.date_commande")." as dc, p.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
|
||||
llxHeader('',$langs->trans('SupplierCard').' : '.$societe->nom, $addons);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($societe);
|
||||
|
||||
dolibarr_fiche_head($head, 'supplier', $langs->trans("ThirdParty"));
|
||||
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td valign="top" width="50%" class="notopnoleft">';
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$societe->prefix_comm.'</td></tr>';
|
||||
|
||||
if ($societe->fournisseur)
|
||||
{
|
||||
print '<tr><td nowrap="nowrap">';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $societe->code_fournisseur;
|
||||
if ($societe->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Zip").'</td><td>'.$societe->cp.'</td>';
|
||||
print '<td>'.$langs->trans("Town").'</td><td>'.$societe->ville.'</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
if ($societe->isInEEC()) print $form->textwithhelp($societe->pays,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print $societe->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>";
|
||||
|
||||
// Assujetti a TVA ou pas
|
||||
print '<tr>';
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';
|
||||
print yn($societe->tva_assuj);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</td><td valign="top" width="50%" class="notopnoleftnoright">';
|
||||
$var=true;
|
||||
|
||||
$MAXLIST=5;
|
||||
|
||||
// Lien recap
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$societe->id.'">'.$langs->trans("ShowSupplierPreview").'</a></td></tr></table></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
* Liste des commandes associees
|
||||
*/
|
||||
$orderstatic = new CommandeFournisseur($db);
|
||||
|
||||
$sql = "SELECT p.rowid,p.ref,".$db->pdate("p.date_commande")." as dc, p.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
|
||||
$sql.= " WHERE p.fk_soc =".$societe->id;
|
||||
$sql.= " ORDER BY p.date_commande DESC";
|
||||
$sql.= " ".$db->plimit($MAXLIST);
|
||||
|
|
@ -268,10 +268,10 @@ if ( $societe->fetch($socid) )
|
|||
}
|
||||
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$societe->id.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT.'/contact/fiche.php?socid='.$socid."&action=create\">".$langs->trans("AddContact")."</a>";
|
||||
|
|
@ -281,18 +281,18 @@ if ( $societe->fetch($socid) )
|
|||
print '<br>';
|
||||
|
||||
/*
|
||||
* Liste des contacts
|
||||
*/
|
||||
* Liste des contacts
|
||||
*/
|
||||
show_contacts($conf,$langs,$db,$societe);
|
||||
|
||||
/*
|
||||
* Listes des actions a faire
|
||||
*/
|
||||
/*
|
||||
* Listes des actions a faire
|
||||
*/
|
||||
show_actions_todo($conf,$langs,$db,$societe);
|
||||
|
||||
/*
|
||||
* Listes des actions effectuees
|
||||
*/
|
||||
|
||||
/*
|
||||
* Listes des actions effectuees
|
||||
*/
|
||||
show_actions_done($conf,$langs,$db,$societe);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -18,14 +18,14 @@
|
|||
|
||||
/**
|
||||
* \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$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \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.
|
||||
*/
|
||||
class FormCompany
|
||||
|
|
@ -256,7 +256,7 @@ class FormCompany
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste d<EFBFBD>roulante des regions actives dont le pays est actif
|
||||
* \remarks La cle de la liste est le code (il peut y avoir plusieurs entr<EFBFBD>e pour
|
||||
|
|
@ -309,13 +309,13 @@ class FormCompany
|
|||
}
|
||||
print '</select>';
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste d<EFBFBD>roulante des civilite actives
|
||||
* \param selected civilite pr<EFBFBD>-s<EFBFBD>lectionn<EFBFBD>e
|
||||
|
|
@ -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