} elseif ($action == "confirm_lost" && $confirm == 'yes') { //Status 7=LOST hard coded, loaded by default in data.sql dictionnary (but check is done in this card that call this method) $object->fk_c_status = 7; $result = $object->update($user); if ($result < 0) { setEventMessages(null, $object->errors, 'errors'); } else { header('Location:' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); } } /* * View */ llxHeader('', $langs->trans('Module103111Name')); $form = new Form($db); $formlead = new FormLead($db); $now = dol_now(); // Add new proposal if ($action == 'create' && $user->rights->lead->write) { print_fiche_titre($langs->trans("LeadCreate"), '', dol_buildpath('/lead/img/object_lead.png', 1), 1); print '<form name="addlead" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="propalid" value="' . GETPOST('propalid', 'int') . '">'; print '<input type="hidden" name="action" value="add">'; print '<table class="border" width="100%">'; print '<tr>'; print '<td class="fieldrequired" width="20%">'; print $langs->trans('LeadCommercial'); print '</td>'; print '<td>'; print $form->select_dolusers(empty($userid) ? $user->id : $userid, 'userid', 0, array(), 0, $includeuserlist);
if (!empty($user->rights->societe->client->voir)) { $filter['userlimitviewsoc'] = 1; } else { $filter['userlimitviewsoc'] = 0; } $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******"DESC"; } if (empty($sortfield)) { $sortfield = "t.date_closure"; } $title = $langs->trans('LeadList'); llxHeader('', $title); if (!empty($socid)) { require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; $soc = new Societe($db); $soc->fetch($socid);
/** * Overloading the doActions function : replacing the parent's function with the one below * * @param string[] $parameters meta datas of the hook (context, etc...) * @param Lead $object the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...) * @param string $action current action (if set). Generally create or edit or null * @return void */ function showLinkedObjectBlock($parameters, $object, $action) { global $conf, $langs, $db; require_once 'lead.class.php'; $lead = new Lead($db); $authorized_object = array(); foreach ($lead->listofreferent as $referent) { $authorized_object[] = $referent['table']; } if (is_object($object) && in_array($object->table_element, $authorized_object)) { $langs->load("lead@lead"); require_once 'html.formlead.class.php'; $formlead = new FormLead($db); $ret = $lead->fetchLeadLink($object->rowid ? $id = $object->rowid : $object->id, $object->table_element); if ($ret < 0) { setEventMessages(null, $lead->errors, 'errors'); } // Build exlcude already linked lead $array_exclude_lead = array(); foreach ($lead->doclines as $line) { $array_exclude_lead[] = $line->id; } print '<br>'; print_fiche_titre($langs->trans('Lead')); if (count($lead->doclines) == 0) { print '<form action="' . dol_buildpath("/lead/lead/manage_link.php", 1) . '" method="POST">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="redirect" value="http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '">'; print '<input type="hidden" name="tablename" value="' . $object->table_element . '">'; print '<input type="hidden" name="elementselect" value="' . ($object->rowid ? $object->rowid : $object->id) . '">'; print '<input type="hidden" name="action" value="link">'; } print "<table class='noborder allwidth'>"; print "<tr class='liste_titre'>"; print "<td>" . $langs->trans('LeadLink') . "</td>"; print "</tr>"; $filter = array('so.rowid' => $object->fk_soc ? $object->fk_soc : $object->socid); if (count($array_exclude_lead) > 0) { $filter['t.rowid !IN'] = implode($array_exclude_lead, ','); } $selectList = $formlead->select_lead('', 'leadid', 1, $filter); if (!empty($selectList) && count($lead->doclines) == 0) { print '<tr>'; print '<td>'; print $selectList; print "<input type=submit name=join value=" . $langs->trans("Link") . ">"; print '</td>'; print '</tr>'; } foreach ($lead->doclines as $line) { print '<tr><td>'; print $line->getNomUrl(1); print '<a href="' . dol_buildpath("/lead/lead/manage_link.php", 1) . '?action=unlink&sourceid=' . ($object->rowid ? $object->rowid : $object->id); print '&sourcetype=' . $object->table_element; print '&leadid=' . $line->id; print '&redirect=' . urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); print '">' . img_picto($langs->trans('LeadUnlinkDoc'), 'unlink.png@lead') . '</a>'; print '</td>'; print '</tr>'; } print "</table>"; if (count($lead->doclines) == 0) { print "</form>"; } } }
} } $permissionnote = $user->rights->lead->write; // Used by the include of actions_setnotes.inc.php $permission = $user->rights->lead->write; /* * Actions */ include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once /* * View */ llxHeader(); $form = new Form($db); $formlead = new FormLead($db); if ($id > 0) { $head = lead_prepare_head($object); dol_fiche_head($head, 'note', $langs->trans('Module103111Name'), 0, dol_buildpath('/lead/img/object_lead.png', 1), 1); print '<table class="border" width="100%">'; $linkback = '<a href="' . dol_buildpath("/lead/lead/list.php", 1) . '">' . $langs->trans("BackToList") . '</a>'; print '<tr>'; print '<td width="20%">'; print $langs->trans('Ref'); print '</td>'; print '<td>'; print $formlead->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print '</td>'; print '</tr>'; print '<tr>'; print '<td width="20%">';