Skip to content

Commit

Permalink
Qual: Uniformize param names. contactidp -> contactid
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 18, 2014
1 parent f2acb04 commit 2b602e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
25 changes: 15 additions & 10 deletions htdocs/comm/propal.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
$originid = GETPOST('originid', 'int');
$confirm = GETPOST('confirm', 'alpha');
$lineid = GETPOST('lineid', 'int');
$contactid = GETPOST('contactid','int');

// PDF
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
Expand All @@ -76,8 +77,7 @@
$NBLINES = 4;

// Security check
if (! empty($user->societe_id))
$socid = $user->societe_id;
if (! empty($user->societe_id)) $socid = $user->societe_id;
$result = restrictedArea($user, 'propal', $id);

$object = new Propal($db);
Expand Down Expand Up @@ -261,7 +261,7 @@
$object->remise_percent = GETPOST('remise_percent');
$object->remise_absolue = GETPOST('remise_absolue');
$object->socid = GETPOST('socid');
$object->contactid = GETPOST('contactidp');
$object->contactid = GETPOST('contactid');
$object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
Expand All @@ -285,7 +285,7 @@
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
$object->contactid = GETPOST('contactidp');
$object->contactid = GETPOST('contactid');
$object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
Expand Down Expand Up @@ -450,9 +450,9 @@
if ($id > 0)
{
// Insertion contact par defaut si defini
if (GETPOST('contactidp') > 0)
if (GETPOST('contactid') > 0)
{
$result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external');
$result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external');
if ($result < 0)
{
$error++;
Expand Down Expand Up @@ -1256,7 +1256,8 @@
$now = dol_now();

// Add new proposal
if ($action == 'create') {
if ($action == 'create')
{
print_fiche_titre($langs->trans("NewProp"));

$soc = new Societe($db);
Expand Down Expand Up @@ -1356,12 +1357,16 @@
}
print '</tr>' . "\n";

// Contacts
if ($socid > 0) {
// Contacts (ask contact only if thirdparty already defined). TODO do this also into order and invoice.
if ($socid > 0)
{
print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td colspan="2">';
$form->select_contacts($soc->id, $setcontact, 'contactidp', 1, $srccontactslist);
$form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist);
print '</td></tr>';
}

if ($socid > 0)
{
// Ligne info remises tiers
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="2">';
if ($soc->remise_percent)
Expand Down
8 changes: 4 additions & 4 deletions htdocs/commande/fiche.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
$object->date_livraison = $datelivraison;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address');
$object->contactid = GETPOST('contactidp');
$object->contactid = GETPOST('contactid');

// If creation from another object of another module (Example: origin=propal, originid=1)
if (! empty($origin) && ! empty($originid)) {
Expand Down Expand Up @@ -383,8 +383,8 @@

// Insert default contacts if defined
if ($object_id > 0) {
if (GETPOST('contactidp')) {
$result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external');
if (GETPOST('contactid')) {
$result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external');
if ($result < 0) {
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
$error ++;
Expand Down Expand Up @@ -1481,7 +1481,7 @@
*/
if ($socid > 0) {
print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td colspan="2">';
$form->select_contacts($soc->id, $setcontact, 'contactidp', 1, $srccontactslist);
$form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist);
print '</td></tr>';

// Ligne info remises tiers
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3344,7 +3344,7 @@ function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter
* @param string $htmlname Nom du formulaire select
* @return void
*/
function form_contacts($page, $societe, $selected='', $htmlname='contactidp')
function form_contacts($page, $societe, $selected='', $htmlname='contactid')
{
global $langs, $conf;

Expand Down

0 comments on commit 2b602e7

Please sign in to comment.