diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index bd95e5a67e4829014d8c9a1bf6494949eee12d6c..9c5ffd03234e5e16848486956dd7141fb3b4703a 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -66,6 +66,7 @@ $origin = GETPOST('origin', 'alpha'); $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)); @@ -76,8 +77,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co $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); @@ -261,7 +261,7 @@ else if ($action == 'add' && $user->rights->propal->creer) { $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 @@ -285,7 +285,7 @@ else if ($action == 'add' && $user->rights->propal->creer) { $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 @@ -450,9 +450,9 @@ else if ($action == 'add' && $user->rights->propal->creer) { 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++; @@ -1256,7 +1256,8 @@ $companystatic = new Societe($db); $now = dol_now(); // Add new proposal -if ($action == 'create') { +if ($action == 'create') +{ print_fiche_titre($langs->trans("NewProp")); $soc = new Societe($db); @@ -1356,12 +1357,16 @@ if ($action == 'create') { } 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) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index d73a4c068e11ac70c2907ecacca80145fdff3675..f05f516e18869663c5e5a061cb2addc0b9075b97 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -233,7 +233,7 @@ else if ($action == 'add' && $user->rights->commande->creer) { $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)) { @@ -383,8 +383,8 @@ else if ($action == 'add' && $user->rights->commande->creer) { // 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 ++; @@ -1481,7 +1481,7 @@ if ($action == 'create' && $user->rights->commande->creer) { */ 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 diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7dfe2b3e7d3792dcd5bfb1d66e91a3b78c1a1e74..5cf872eb3d80abc4ea8711c2dca19954e3d9a5cc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3344,7 +3344,7 @@ class Form * @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;