uniformize code and fix some display issue
This commit is contained in:
parent
1832d26b46
commit
a0bd7d2f61
@ -35,7 +35,12 @@ $langs->load("orders");
|
|||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$id = isset($_GET["id"])?$_GET["id"]:'';
|
$id=GETPOST('id');
|
||||||
|
$ligne=GETPOST('ligne');
|
||||||
|
$lineid=GETPOST('lineid');
|
||||||
|
$action=GETPOST('action');
|
||||||
|
|
||||||
|
$id = isset($id)?$id:'';
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
@ -51,9 +56,9 @@ if ($_POST["action"] == 'addcontact' && $user->rights->propale->creer)
|
|||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$result = $propal->fetch($_GET["id"]);
|
$result = $propal->fetch($id);
|
||||||
|
|
||||||
if ($result > 0 && $_GET["id"] > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $propal->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$result = $propal->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
@ -80,7 +85,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->propale->creer)
|
|||||||
if ($_POST["action"] == 'updateligne' && $user->rights->propale->creer)
|
if ($_POST["action"] == 'updateligne' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
if ($propal->fetch($_GET["id"]))
|
if ($propal->fetch($id))
|
||||||
{
|
{
|
||||||
$contact = $propal->detail_contact($_POST["elrowid"]);
|
$contact = $propal->detail_contact($_POST["elrowid"]);
|
||||||
$type = $_POST["type"];
|
$type = $_POST["type"];
|
||||||
@ -102,16 +107,16 @@ if ($_POST["action"] == 'updateligne' && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bascule du statut d'un contact
|
// bascule du statut d'un contact
|
||||||
if ($_GET["action"] == 'swapstatut' && $user->rights->propale->creer)
|
if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
if ($propal->fetch($_GET["id"]))
|
if ($propal->fetch($id))
|
||||||
{
|
{
|
||||||
$contact = $propal->detail_contact($_GET["ligne"]);
|
$contact = $propal->detail_contact($ligne);
|
||||||
$id_type_contact = $contact->fk_c_type_contact;
|
$id_type_contact = $contact->fk_c_type_contact;
|
||||||
$statut = ($contact->statut == 4) ? 5 : 4;
|
$statut = ($contact->statut == 4) ? 5 : 4;
|
||||||
|
|
||||||
$result = $propal->update_contact($_GET["ligne"], $statut, $id_type_contact);
|
$result = $propal->update_contact($ligne, $statut, $id_type_contact);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -127,11 +132,11 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// Efface un contact
|
||||||
if ($_GET["action"] == 'deleteline' && $user->rights->propale->creer)
|
if ($action == 'deleteline' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$propal->fetch($_GET["id"]);
|
$propal->fetch($id);
|
||||||
$result = $propal->delete_contact($_GET["lineid"]);
|
$result = $propal->delete_contact($lineid);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@ -163,8 +168,8 @@ $userstatic=new User($db);
|
|||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
if (isset($mesg)) print $mesg;
|
if (isset($mesg)) print $mesg;
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = $id;
|
||||||
$ref= $_GET["ref"];
|
$ref= GETPOST('ref');
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$propal = New Propal($db);
|
$propal = New Propal($db);
|
||||||
@ -222,7 +227,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiche en mode modification de ligne
|
* Non affiche en mode modification de ligne
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] != 'editline' && $user->rights->propale->creer)
|
if ($action != 'editline' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
@ -241,19 +246,19 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<input type="hidden" name="source" value="internal">';
|
print '<input type="hidden" name="source" value="internal">';
|
||||||
|
|
||||||
// Ligne ajout pour contact interne
|
// Ligne ajout pour contact interne
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'.$bc[$var].'>';
|
||||||
|
|
||||||
print '<td nowrap="nowrap">';
|
print '<td nowrap="nowrap">';
|
||||||
print img_object('','user').' '.$langs->trans("Users");
|
print img_object('','user').' '.$langs->trans("Users");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td>';
|
||||||
print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td>';
|
||||||
// On recupere les id des users deja selectionnes
|
// On recupere les id des users deja selectionnes
|
||||||
//$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 selectionne car on doit pouvoir le selectionner 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>';
|
||||||
@ -272,18 +277,18 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Ligne ajout pour contact externe
|
// Ligne ajout pour contact externe
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'.$bc[$var].'>';
|
||||||
|
|
||||||
print '<td nowrap="nowrap">';
|
print '<td nowrap="nowrap">';
|
||||||
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
|
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td>';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$propal->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$propal->client->id;
|
||||||
$selectedCompany = $formcompany->selectCompaniesForNewContact($propal, 'id', $selectedCompany, 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($propal, 'id', $selectedCompany, 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td>';
|
||||||
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
|
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
|
||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -295,19 +300,21 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '></td>';
|
print '></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</form>";
|
print '</form>';
|
||||||
|
|
||||||
print '<tr><td colspan="6"> </td></tr>';
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Liste des contacts lies
|
// Liste des contacts lies
|
||||||
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>';
|
||||||
print '<td>'.$langs->trans("Contacts").'</td>';
|
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
print '<td align="center" colspan="3">'.$langs->trans("Status").'</td>';
|
||||||
print '<td colspan="2"> </td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
@ -378,7 +385,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Icon update et delete
|
// Icon update et delete
|
||||||
print '<td align="center" nowrap>';
|
print '<td align="center" nowrap colspan="3">';
|
||||||
if ($user->rights->propale->creer)
|
if ($user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user