diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index e930384bc09..1ba9bf93903 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -23,12 +23,12 @@ * \brief Tab of events on Proposal */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; /** * @var Conf $conf @@ -46,7 +46,7 @@ $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)) . basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); if (GETPOST('actioncode', 'array')) { @@ -81,15 +81,15 @@ if (!$sortorder) { // Initialize a technical objects $object = new Propal($db); $extrafields = new ExtraFields($db); -$diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id; +$diroutputmassaction = $conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array('propalagenda', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals +include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->propal->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; + $upload_dir = $conf->propal->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity] . "/" . $object->id; } $permissiontoread = $user->hasRight("propal", "lire"); @@ -116,7 +116,7 @@ if ($reshook < 0) { if (empty($reshook)) { // Cancel if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { - header("Location: ".$backtopage); + header("Location: " . $backtopage); exit; } @@ -150,14 +150,14 @@ if ($object->id > 0) { // Object card // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref = '
'; // Ref customer $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
' . $object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); @@ -165,16 +165,16 @@ if ($object->id > 0) { if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + $morehtmlref .= ' - ' . dol_escape_htmltag($proj->title) . ''; } } } @@ -201,16 +201,16 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); - $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; - $out .= '&backtopage='.urlencode($urlbacktopage); + $out = '&origin=' . urlencode((string) ($object->element . (property_exists($object, 'module') ? '@' . $object->module : ''))) . '&originid=' . urlencode((string) ($object->id)); + $urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id; + $out .= '&backtopage=' . urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.='trans("AddAnAction"),'filenew'); //$out.=""; @@ -218,16 +218,24 @@ if ($object->id > 0) { $morehtmlright = ''; + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + $messagingUrl = DOL_URL_ROOT . '/comm/propal/messaging.php?id=' . $object->id; + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + + $messagingUrl = DOL_URL_ROOT . '/comm/propal/agenda.php?id=' . $object->id; + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + + if (isModEnabled('agenda')) { if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out); } else { - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out, '', 0); } } @@ -235,20 +243,22 @@ if ($object->id > 0) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; - $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); + + + $param = '&id=' . $object->id . (!empty($socid) ? '&socid=' . $socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); + $param .= '&contextpage=' . urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.((int) $limit); + $param .= '&limit=' . ((int) $limit); } // Try to know count of actioncomm from cache - require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; - $cachekey = 'count_events_propal_'.$object->id; + require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; + $cachekey = 'count_events_propal_' . $object->id; $nbEvent = dol_getcache($cachekey); - print_barre_liste($langs->trans("ActionsOnPropal").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnPropal") . (is_numeric($nbEvent) ? '(' . $nbEvent . ')' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); //print_barre_liste($langs->trans("ActionsOnPropal"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); // List of all actions diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d6245868ee1..b79c3d2a7b5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -43,24 +43,24 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formpropal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmargin.class.php'; +require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } if (isModEnabled('variants')) { - require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; + require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductCombination.class.php'; } /** @@ -176,34 +176,34 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (empty($reshook)) { - $backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php'; + $backurlforlist = DOL_URL_ROOT . '/comm/propal/list.php'; if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = DOL_URL_ROOT.'/comm/propal/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + $backtopage = DOL_URL_ROOT . '/comm/propal/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__'); } } } if ($cancel) { if (!empty($backtopageforcancel)) { - header("Location: ".$backtopageforcancel); + header("Location: " . $backtopageforcancel); exit; } elseif (!empty($backtopage)) { - header("Location: ".$backtopage); + header("Location: " . $backtopage); exit; } $action = ''; } - include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once + include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once - include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' + include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' - include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once' + include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once' // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate) { if (!($socid > 0)) { @@ -265,7 +265,7 @@ if (empty($reshook)) { setEventMessages('', $warningMsgLineList, 'warnings'); } - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); exit(); } else { if (count($object->errors) > 0) { @@ -279,7 +279,7 @@ if (empty($reshook)) { // Cancel proposal $result = $object->setCancel($user); if ($result > 0) { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); exit(); } else { $langs->load("errors"); @@ -289,7 +289,7 @@ if (empty($reshook)) { // Delete proposal $result = $object->delete($user); if ($result > 0) { - header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'); + header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1'); exit(); } else { $langs->load("errors"); @@ -321,7 +321,7 @@ if (empty($reshook)) { $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); exit(); } elseif ($action == 'confirm_delete_subtotalline' && $confirm == 'yes' && $usercancreate) { // Delete line @@ -351,7 +351,7 @@ if (empty($reshook)) { $result = $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } if ($result >= 0) { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); exit(); } } else { @@ -617,13 +617,13 @@ if (empty($reshook)) { $id = $object->create($user); if ($id > 0) { - dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); + dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); $classname = ucfirst($subelement); $srcobject = new $classname($db); '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Can be other class, but CommonObject is too generic - dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); + dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); $result = $srcobject->fetch($object->origin_id); if ($result > 0) { @@ -679,7 +679,7 @@ if (empty($reshook)) { $tva_tx = $lines[$i]->tva_tx; if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { - $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + $tva_tx .= ' (' . $lines[$i]->vat_src_code . ')'; } $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit); @@ -763,7 +763,7 @@ if (empty($reshook)) { } } - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); exit(); } else { $db->rollback(); @@ -838,7 +838,7 @@ if (empty($reshook)) { $locationTarget = DOL_URL_ROOT . '/compta/facture/card.php?id=' . $deposit->id; } else { $error++; - setEventMessages("Failed to create down payment - ".$object->error, $object->errors, 'errors'); + setEventMessages("Failed to create down payment - " . $object->error, $object->errors, 'errors'); } } @@ -905,13 +905,13 @@ if (empty($reshook)) { if (!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) { if ($fromElement == 'commande') { - dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); + dol_include_once('/' . $fromElement . '/class/' . $fromElement . '.class.php'); $lineClassName = 'OrderLine'; } elseif ($fromElement == 'propal') { - dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); + dol_include_once('/comm/' . $fromElement . '/class/' . $fromElement . '.class.php'); $lineClassName = 'PropaleLigne'; } elseif ($fromElement == 'facture') { - dol_include_once('/compta/'.$fromElement.'/class/'.$fromElement.'.class.php'); + dol_include_once('/compta/' . $fromElement . '/class/' . $fromElement . '.class.php'); $lineClassName = 'FactureLigne'; } else { $lineClassName = null; @@ -978,14 +978,14 @@ if (empty($reshook)) { $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'discount', $discount); } - include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; // Actions to send emails $actiontypecode = 'AC_OTH_AUTO'; $triggersendname = 'PROPAL_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_PROPOSAL_TO'; - $trackid = 'pro'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + $trackid = 'pro' . $object->id; + include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; // Go back to draft @@ -1054,7 +1054,7 @@ if (empty($reshook)) { } $tvatx = $line->tva_tx; if (!empty($line->vat_src_code)) { - $tvatx .= ' ('.$line->vat_src_code.')'; + $tvatx .= ' (' . $line->vat_src_code . ')'; } $result = $object->updateline($line->id, $line->subprice, $line->qty, (float) $remise_percent, $tvatx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); $object->lines[$key] = $object->line; @@ -1072,7 +1072,7 @@ if (empty($reshook)) { if ($prod->price_min > $subprice) { $price_subprice = price($subprice, 0, $outlangs, 1, -1, -1, 'auto'); $price_price_min = price($prod->price_min, 0, $outlangs, 1, -1, -1, 'auto'); - setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings'); + setEventMessages($prod->ref . ' - ' . $prod->label . ' (' . $price_subprice . ' < ' . $price_price_min . ' ' . strtolower($langs->trans("MinPrice")) . ')' . "\n", null, 'warnings'); } // Manage $line->subprice and $line->multicurrency_subprice if ($line->subprice <> 0) { @@ -1142,7 +1142,7 @@ if (empty($reshook)) { } else { setEventMessages($object->error, $object->errors, 'errors'); } - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); exit(); } elseif ($action == 'confirm_addsubtotalline' && $usercancreate) { // Handling adding a new subtotal line for subtotals module @@ -1194,11 +1194,13 @@ if (empty($reshook)) { } else { setEventMessages($object->error, $object->errors, 'errors'); } - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); exit(); - } elseif ( $action == 'addline' && !GETPOST('submitforalllines', 'alpha') - && !GETPOST('submitforallmargins', 'alpha') && !GETPOST('markforalllines', 'alpha') - && $usercancreate) { // Add line + } elseif ( + $action == 'addline' && !GETPOST('submitforalllines', 'alpha') + && !GETPOST('submitforallmargins', 'alpha') && !GETPOST('markforalllines', 'alpha') + && $usercancreate + ) { // Add line // Set if we used free entry or predefined product $predef = ''; $line_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); @@ -1237,8 +1239,8 @@ if (empty($reshook)) { $tva_tx = GETPOST('tva_tx', 'alpha'); - $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); - $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0); + $qty = price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2); + $remise_percent = (GETPOSTISSET('remise_percent' . $predef) ? price2num(GETPOST('remise_percent' . $predef, 'alpha'), '', 2) : 0); if (empty($remise_percent)) { $remise_percent = 0; } @@ -1250,7 +1252,7 @@ if (empty($reshook)) { if (is_array($extralabelsline)) { // Get extra fields foreach ($extralabelsline as $key => $value) { - unset($_POST["options_".$key]); + unset($_POST["options_" . $key]); } } @@ -1322,7 +1324,7 @@ if (empty($reshook)) { if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { // If price per customer - require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; $prodcustprice = new ProductCustomerPrice($db); $filter = array('t.fk_product' => (string) $prod->id, 't.fk_soc' => (string) $object->thirdparty->id); @@ -1386,7 +1388,7 @@ if (empty($reshook)) { } } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { // If price per customer - require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; $prodcustprice = new ProductCustomerPrice($db); @@ -1490,7 +1492,7 @@ if (empty($reshook)) { if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { $outputlangs = $langs; $newlang = ''; - if (/* empty($newlang) && */ GETPOST('lang_id', 'aZ09')) { + if (/* empty($newlang) && */GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } if (empty($newlang)) { @@ -1521,7 +1523,7 @@ if (empty($reshook)) { if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { $outputlangs = $langs; $newlang = ''; - if (/* empty($newlang) && */ GETPOST('lang_id', 'alpha')) { + if (/* empty($newlang) && */GETPOST('lang_id', 'alpha')) { $newlang = GETPOST('lang_id', 'alpha'); } if (empty($newlang)) { @@ -1533,23 +1535,23 @@ if (empty($reshook)) { $outputlangs->load('products'); } if (!empty($prod->customcode)) { - $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomsCode").': '.$prod->customcode; + $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomsCode") . ': ' . $prod->customcode; } if (!empty($prod->customcode) && !empty($prod->country_code)) { $tmptxt .= ' - '; } if (!empty($prod->country_code)) { - $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, '', $db, $outputlangs, 0); + $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, '', $db, $outputlangs, 0); } } else { if (!empty($prod->customcode)) { - $tmptxt .= $langs->transnoentitiesnoconv("CustomsCode").': '.$prod->customcode; + $tmptxt .= $langs->transnoentitiesnoconv("CustomsCode") . ': ' . $prod->customcode; } if (!empty($prod->customcode) && !empty($prod->country_code)) { $tmptxt .= ' - '; } if (!empty($prod->country_code)) { - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, '', $db, $langs, 0); + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, '', $db, $langs, 0); } } $tmptxt .= ')'; @@ -1588,11 +1590,11 @@ if (empty($reshook)) { $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); // Margin - $fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only - $buyingprice = price2num((GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''), '', 2); // If buying_price is '0', we must keep this value + $fournprice = (int) (GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only + $buyingprice = price2num((GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''), '', 2); // If buying_price is '0', we must keep this value - $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); - $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); + $date_start = dol_mktime(GETPOSTINT('date_start' . $predef . 'hour'), GETPOSTINT('date_start' . $predef . 'min'), GETPOSTINT('date_start' . $predef . 'sec'), GETPOSTINT('date_start' . $predef . 'month'), GETPOSTINT('date_start' . $predef . 'day'), GETPOSTINT('date_start' . $predef . 'year')); + $date_end = dol_mktime(GETPOSTINT('date_end' . $predef . 'hour'), GETPOSTINT('date_end' . $predef . 'min'), GETPOSTINT('date_end' . $predef . 'sec'), GETPOSTINT('date_end' . $predef . 'month'), GETPOSTINT('date_end' . $predef . 'day'), GETPOSTINT('date_end' . $predef . 'year')); // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; @@ -1698,8 +1700,8 @@ if (empty($reshook)) { } } } elseif ($action == 'addline' && $usercancreate && ( - (GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines', 'alpha') !== '') || - (GETPOST('submitforallmark', 'alpha') && GETPOST('markforalllines', 'alpha') !== ''))) { + (GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines', 'alpha') !== '') || + (GETPOST('submitforallmark', 'alpha') && GETPOST('markforalllines', 'alpha') !== ''))) { $outlangs = $langs; // Define margin $margin_rate = GETPOSTISSET('marginforalllines') ? GETPOST('marginforalllines', 'int') : ''; @@ -1908,7 +1910,7 @@ if (empty($reshook)) { if (is_array($extralabelsline)) { // Get extra fields foreach ($extralabelsline as $key => $value) { - unset($_POST["options_".$key]); + unset($_POST["options_" . $key]); } } @@ -2040,7 +2042,7 @@ if (empty($reshook)) { } } } elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha')) { - header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // To re-display card in edit mode + header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // To re-display card in edit mode exit(); } elseif ($action == 'classin' && $usercancreate) { // Set project @@ -2120,7 +2122,7 @@ if (empty($reshook)) { } if ($result >= 0) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); exit(); } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { @@ -2143,7 +2145,7 @@ if (empty($reshook)) { $result = $object->delete_contact($lineid); if ($result >= 0) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); exit(); } else { dol_print_error($db); @@ -2154,7 +2156,7 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output; $permissiontoadd = $usercancreate; - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; } @@ -2171,7 +2173,7 @@ if (isModEnabled('project')) { $formproject = new FormProjets($db); } -$title = $object->ref." - ".$langs->trans('Card'); +$title = $object->ref . " - " . $langs->trans('Card'); if ($action == 'create') { $title = $langs->trans("NewPropal"); } @@ -2237,7 +2239,7 @@ if ($action == 'create') { $element = $subelement = 'expedition'; } - dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); + dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); $classname = ucfirst($subelement); $objectsrc = new $classname($db); @@ -2316,16 +2318,16 @@ if ($action == 'create') { } } - print '
'; - print ''; + print ''; + print ''; print ''; print ''; // will be set to 1 by javascript so we know post is done after a company change - print ''; + print ''; if ($origin != 'project' && $originid) { - print ''; - print ''; + print ''; + print ''; } elseif ($origin == 'project' && !empty($projectid)) { - print ''; + print ''; } print dol_get_fiche_head(); @@ -2338,22 +2340,22 @@ if ($action == 'create') { print ''; // Reference - print ''; + print ''; // Ref customer - print ''; + print ''; print ''; // Third party print ''; - print ''; + print ''; $shipping_method_id = 0; $warehouse_id = 0; if ($socid > 0) { print ''; if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD') && !empty($soc->shipping_method_id)) { $shipping_method_id = $soc->shipping_method_id; @@ -2362,7 +2364,7 @@ if ($action == 'create') { } else { print ''; } - print ''."\n"; + print '' . "\n"; if ($socid > 0) { // Contacts (ask contact only if thirdparty already defined). - print ''; // Third party discounts info line - print ''; } $newdatepropal = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // Date - print ''; // Validaty duration - print ''; + print ''; // Terms of payment - print ''; // Mode of payment - print ''; // Bank Account if (getDolGlobalString('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') && isModEnabled("bank")) { - print ''; } // Source / Channel - What trigger creation - print ''; @@ -2444,7 +2446,7 @@ if ($action == 'create') { if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD') && !empty($soc->shipping_method_id)) { $shipping_method_id = $soc->shipping_method_id; } - print ''; @@ -2453,17 +2455,17 @@ if ($action == 'create') { $formproduct = null; // Warehouse if (isModEnabled('stock') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) { - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); - print ''; } // Delivery delay - print ''; // Delivery date (or manufacturing) - print ''; + print ''; print ''; - print ''; print ''; } @@ -2500,7 +2502,7 @@ if ($action == 'create') { // Incoterms if (isModEnabled('incoterm')) { print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; } // Public note print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; - print '"; + print ''; + print ''; + print '"; if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 - print '"; + print '"; } if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 - print '"; + print '"; } - print '"; + print '"; if (isModEnabled("multicurrency")) { - print ''; - print '"; - print '"; + print ''; + print '"; + print '"; } } @@ -2614,16 +2616,16 @@ if ($action == 'create') { // For backward compatibility print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
'.$langs->trans('RefCustomer').''; - print '
' . $langs->trans('RefCustomer') . ''; + print '
'.$langs->trans('Customer').'' . $langs->trans('Customer') . ''; print $soc->getNomUrl(1, 'customer'); - print ''; + print ''; print ''; $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); + print img_picto('', 'company', 'class="pictofixedwidth"') . $form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); // reload page to retrieve customer information if (!getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) { print ''; } - print ' '; + print ' '; print '
'.$langs->trans("DefaultContact").''; + print '
' . $langs->trans("DefaultContact") . ''; print img_picto('', 'contact', 'class="pictofixedwidth"'); //print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, '', '', 0, 'minwidth300 widthcentpercentminusx'); print $form->select_contact($soc->id, $contactid, 'contactid', 1, '', '', 1, 'maxwidth300 widthcentpercentminusx', true); print '
'.$langs->trans('Discounts').''; + print '
' . $langs->trans('Discounts') . ''; $absolute_discount = $soc->getAvailableDiscounts(); $thirdparty = $soc; $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + $backtopage = $_SERVER["PHP_SELF"] . '?socid=' . $thirdparty->id . '&action=' . $action . '&origin=' . urlencode((string) (GETPOST('origin'))) . '&originid=' . urlencode((string) (GETPOSTINT('originid'))); + include DOL_DOCUMENT_ROOT . '/core/tpl/object_discounts.tpl.php'; print '
'.$langs->trans('DatePropal').''; + print '
' . $langs->trans('DatePropal') . ''; print img_picto('', 'action', 'class="pictofixedwidth"'); print $form->selectDate($newdatepropal ? $newdatepropal : $datepropal, '', 0, 0, 0, "addprop", 1, 1); print '
'.$langs->trans("ValidityDuration").''.img_picto('', 'clock', 'class="pictofixedwidth"').' '.$langs->trans("days").'
' . $langs->trans("ValidityDuration") . '' . img_picto('', 'clock', 'class="pictofixedwidth"') . ' ' . $langs->trans("days") . '
'.$langs->trans('PaymentConditionsShort').''; + print '
' . $langs->trans('PaymentConditionsShort') . ''; print img_picto('', 'payment', 'class="pictofixedwidth"'); // at last resort we take the payment term id which may be filled by default values set (if not getpostisset) print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', $deposit_percent); print '
'.$langs->trans('PaymentMode').''; + print '
' . $langs->trans('PaymentMode') . ''; print img_picto('', 'bank', 'class="pictofixedwidth"'); print $form->select_types_paiements((string) $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); print '
'.$langs->trans('Source').''; + print '
' . $langs->trans('Source') . ''; print img_picto('', 'question', 'class="pictofixedwidth"'); $form->selectInputReason((GETPOSTISSET('demand_reason_id') ? GETPOSTINT('demand_reason_id') : ''), 'demand_reason_id', "SRC_PROP", 1, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('SendingMethod').''; + print '
' . $langs->trans('SendingMethod') . ''; print img_picto('', 'dolly', 'class="pictofixedwidth"'); $form->selectShippingMethod((string) (GETPOSTISSET('shipping_method_id') ? GETPOSTINT('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('Warehouse').''; - print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); + print '
' . $langs->trans('Warehouse') . ''; + print img_picto('', 'stock', 'class="pictofixedwidth"') . $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); print '
'.$langs->trans('AvailabilityPeriod'); + print '
' . $langs->trans('AvailabilityPeriod'); if (isModEnabled('order')) { - print ' ('.$langs->trans('AfterOrder').')'; + print ' (' . $langs->trans('AfterOrder') . ')'; } print ''; print img_picto('', 'clock', 'class="pictofixedwidth"'); @@ -2471,7 +2473,7 @@ if ($action == 'create') { print '
'.$langs->trans("DeliveryDate").'
' . $langs->trans("DeliveryDate") . ''; print img_picto('', 'action', 'class="pictofixedwidth"'); if (is_numeric(getDolGlobalString('DATE_LIVRAISON_WEEK_DELAY'))) { // If value set to 0 or a num, not empty @@ -2479,7 +2481,7 @@ if ($action == 'create') { $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); $sday = date("d", $tmpdte); - print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', 0, 0, 0, "addprop"); + print $form->selectDate($syear . "-" . $smonth . "-" . $sday, 'date_livraison', 0, 0, 0, "addprop"); } else { $tmp_date_delivery = GETPOST('date_delivery') ?: -1; print $form->selectDate($tmp_date_delivery, 'date_livraison', 0, 0, 0, "addprop", 1, 1); @@ -2490,9 +2492,9 @@ if ($action == 'create') { if (isModEnabled('project') && is_object($formproject)) { $langs->load("projects"); print '
'.$langs->trans("Project").''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (string) $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - print ' id).'">'; + print '' . $langs->trans("Project") . ''; + print img_picto('', 'project', 'class="pictofixedwidth"') . $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (string) $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print ' id) . '">'; print '
'; print img_picto('', 'incoterm', 'class="pictofixedwidth"'); print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : '')); @@ -2509,7 +2511,7 @@ if ($action == 'create') { // Template to use by default print '
'.$langs->trans("DefaultModel").'' . $langs->trans("DefaultModel") . ''; print img_picto('', 'pdf', 'class="pictofixedwidth"'); $liste = ModelePDFPropales::liste_modeles($db); @@ -2520,15 +2522,15 @@ if ($action == 'create') { // Multicurrency if (isModEnabled("multicurrency")) { print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'' . $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0) . ''; - print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany')) ? GETPOST('multicurrency_code') : $currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'currency', 'class="pictofixedwidth"') . $form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany')) ? GETPOST('multicurrency_code') : $currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('NotePublic').'' . $langs->trans('NotePublic') . ''; $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (getDolGlobalString('PROPALE_ADDON_NOTE_PUBLIC_DEFAULT') ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null)), 'restricthtml'); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); @@ -2537,7 +2539,7 @@ if ($action == 'create') { // Private note if (empty($user->socid)) { print '
'.$langs->trans('NotePrivate').'' . $langs->trans('NotePrivate') . ''; $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc)) ? $objectsrc->note_private : null)); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); @@ -2547,7 +2549,7 @@ if ($action == 'create') { } // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; // Lines from source if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { @@ -2559,13 +2561,13 @@ if ($action == 'create') { $objectsrc->update_price(1, 'auto', 1); } - print "\n"; + print "\n"; print "\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print ''; + print ''; $newclassname = $classname; if ($newclassname == 'Propal') { @@ -2578,22 +2580,22 @@ if ($action == 'create') { $newclassname = 'Intervention'; } - print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency)."
' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
' . $langs->trans('AmountHT') . '' . price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . "
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency)."
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . "
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency)."
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . "
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency)."
' . $langs->trans('AmountTTC') . '' . price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . "
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
' . $langs->trans('MulticurrencyAmountHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyAmountVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
' . $langs->trans('MulticurrencyAmountTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
'.$langs->trans("CopyPropalFrom").' ' . $langs->trans("CopyPropalFrom") . ' '; $liste_propal = array(); - $liste_propal [0] = ''; + $liste_propal[0] = ''; $sql = "SELECT p.rowid as id, p.ref, s.nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."propal p"; - $sql .= ", ".MAIN_DB_PREFIX."societe s"; + $sql .= " FROM " . MAIN_DB_PREFIX . "propal p"; + $sql .= ", " . MAIN_DB_PREFIX . "societe s"; $sql .= " WHERE s.rowid = p.fk_soc"; - $sql .= " AND p.entity IN (".getEntity('propal').")"; + $sql .= " AND p.entity IN (" . getEntity('propal') . ")"; $sql .= " AND p.fk_statut <> 0"; $sql .= " ORDER BY Id"; @@ -2633,7 +2635,7 @@ if ($action == 'create') { $i = 0; while ($i < $num) { $row = $db->fetch_row($resql); - $propalRefAndSocName = $row[1]." - ".$row[2]; + $propalRefAndSocName = $row[1] . " - " . $row[2]; $liste_propal[$row[0]] = $propalRefAndSocName; $i++; } @@ -2644,7 +2646,7 @@ if ($action == 'create') { print '
'.$langs->trans("CreateEmptyPropal").'
' . $langs->trans("CreateEmptyPropal") . '
'; } } @@ -2704,7 +2706,7 @@ if ($action == 'create') { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); } // Incomplete payment. We ask if reason = discount or other - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250, 600); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250, 600); } // Subtotal line form @@ -2724,7 +2726,7 @@ if ($action == 'create') { //Form to close proposal (signed or not) $formquestion = array(); if (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')) { - $formquestion[] = array('type' => 'select', 'name' => 'statut', 'label' => ''.$langs->trans("CloseAs").'', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))); + $formquestion[] = array('type' => 'select', 'name' => 'statut', 'label' => '' . $langs->trans("CloseAs") . '', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))); } $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) @@ -2860,7 +2862,7 @@ if ($action == 'create') { } if (isModEnabled('notification')) { - require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; $notify = new Notify($db); $formquestion = array_merge($formquestion, array( array('type' => 'onecolumn', 'value' => $notify->confirmMessage('PROPAL_CLOSE_SIGNED', $object->socid, $object)), @@ -2868,22 +2870,22 @@ if ($action == 'create') { } if (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')) { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), '', 'confirm_closeas', $formquestion, '', 1, 250); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), '', 'confirm_closeas', $formquestion, '', 1, 250); } else { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), '', 'confirm_closeas', $formquestion, '', 1, 250); } } elseif ($action == 'cancel') { // Confirm cancel - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("CancelPropal"), $langs->trans('ConfirmCancelPropal', $object->ref), 'confirm_cancel', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans("CancelPropal"), $langs->trans('ConfirmCancelPropal', $object->ref), 'confirm_cancel', '', 0, 1); } elseif ($action == 'delete') { // Confirm delete - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1); } elseif ($action == 'reopen') { // Confirm reopen - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1); } elseif ($action == 'ask_deleteline') { // Confirmation delete product/service line - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); } elseif ($action == 'ask_subtotal_deleteline') { // Confirmation de la suppression d'une ligne subtotal $langs->load("subtotals"); @@ -2894,7 +2896,7 @@ if ($action == 'create') { $title = "DeleteTitleLine"; $question = "ConfirmDeleteTitleLine"; } - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans($title), $langs->trans($question), 'confirm_delete_subtotalline', $formconfirm, 'no', 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans($title), $langs->trans($question), 'confirm_delete_subtotalline', $formconfirm, 'no', 1); } elseif ($action == 'validate') { // Confirm validate proposal $error = 0; @@ -2913,7 +2915,7 @@ if ($action == 'create') { $text = $langs->trans('ConfirmValidateProp', $numref); if (isModEnabled('notification')) { - require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object); @@ -2935,12 +2937,12 @@ if ($action == 'create') { setEventMessages($langs->trans("mandatoryPeriodNeedTobeSetMsgValidate"), null, 'errors'); $error++; } else { - $text .= '
'.img_warning().$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
'; + $text .= '
' . img_warning() . $langs->trans("mandatoryPeriodNeedTobeSetMsgValidate") . '
'; } } if (!$error) { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1, 240); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1, 240); } } @@ -2959,16 +2961,16 @@ if ($action == 'create') { // Proposal card - $linkback = ''.$langs->trans("BackToList").''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref = '
'; // Ref customer $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string' . (isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$soc->getNomUrl(1, 'customer'); + $morehtmlref .= '
' . $soc->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $soc->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; + $morehtmlref .= ' (' . $langs->trans("OtherProposals") . ')'; } // Project if (isModEnabled('project')) { @@ -2977,16 +2979,16 @@ if ($action == 'create') { if ($usercancreate) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + $morehtmlref .= ' - ' . dol_escape_htmltag($proj->title) . ''; } } } @@ -3016,7 +3018,7 @@ if ($action == 'create') { $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; } - print ''.$langs->trans('Discounts').''; + print '' . $langs->trans('Discounts') . ''; $absolute_discount = $soc->getAvailableDiscounts(null, $filterabsolutediscount); $absolute_creditnote = $soc->getAvailableDiscounts(null, $filtercreditnote); @@ -3027,8 +3029,8 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?id='.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + $backtopage = $_SERVER["PHP_SELF"] . '?id=' . $object->id; + include DOL_DOCUMENT_ROOT . '/core/tpl/object_discounts.tpl.php'; print ''; @@ -3047,12 +3049,12 @@ if ($action == 'create') { print $form->editfieldkey("DatePropal", 'date', '', $object, (int) $editenable); print ''; if ($action == 'editdate' && $usercancreate && $caneditfield) { - print ''; - print ''; + print ''; + print ''; print ''; - print ''; + print ''; print $form->selectDate($object->date, 're', 0, 0, 0, "editdate"); - print ''; + print ''; print ''; } else { if ($object->date) { @@ -3070,17 +3072,17 @@ if ($action == 'create') { print $langs->trans('DateEndPropal'); print ''; if ($action != 'editecheance' && $usercancreate && $caneditfield) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print '' . img_edit($langs->trans('SetConditions'), 1) . ''; } print ''; print ''; if ($action == 'editecheance' && $usercancreate && $caneditfield) { - print '
'; - print ''; + print ''; + print ''; print ''; - print ''; + print ''; print $form->selectDate($object->fin_validite, 'ech', 0, 0, 0, "editecheance"); - print ''; + print ''; print '
'; } else { if (!empty($object->fin_validite)) { @@ -3101,14 +3103,14 @@ if ($action == 'create') { print $langs->trans('PaymentConditionsShort'); print ''; if ($action != 'editconditions' && $usercancreate && $caneditfield) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).''; + print '' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . ''; } print ''; print ''; if ($action == 'editconditions' && $usercancreate && $caneditfield) { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'cond_reglement_id', 0, '', 1, $object->deposit_percent); + $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->cond_reglement_id, 'cond_reglement_id', 0, '', 1, $object->deposit_percent); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'none', 0, '', 1, $object->deposit_percent); + $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->cond_reglement_id, 'none', 0, '', 1, $object->deposit_percent); } print ''; print ''; @@ -3120,14 +3122,14 @@ if ($action == 'create') { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && $usercancreate && $caneditfield) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).''; + print '' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . ''; } print ''; print ''; if ($action == 'editmode' && $usercancreate && $caneditfield) { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); + $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->mode_reglement_id, 'none'); } print ''; @@ -3144,20 +3146,20 @@ if ($action == 'create') { print ''; print ''; if ($action != 'editavailability' && $usercancreate && $caneditfield) { - print ''; + print ''; } print '
'; if (isModEnabled('order')) { - print $form->textwithpicto($langs->trans('AvailabilityPeriod'), $langs->trans('AvailabilityPeriod').' ('.$langs->trans('AfterOrder').')'); + print $form->textwithpicto($langs->trans('AvailabilityPeriod'), $langs->trans('AvailabilityPeriod') . ' (' . $langs->trans('AfterOrder') . ')'); } else { print $langs->trans('AvailabilityPeriod'); } print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).'' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '
'; print ''; if ($action == 'editavailability' && $usercancreate && $caneditfield) { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'availability_id', 1); + $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->availability_id, 'availability_id', 1); } else { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'none', 1); + $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->availability_id, 'none', 1); } print ''; @@ -3170,14 +3172,14 @@ if ($action == 'create') { print $langs->trans('SendingMethod'); print ''; if ($action != 'editshippingmethod' && $usercancreate && $caneditfield) { - print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).''; + print '' . img_edit($langs->trans('SetShippingMode'), 1) . ''; } print ''; print ''; if ($action == 'editshippingmethod' && $usercancreate && $caneditfield) { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1); } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'none'); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->shipping_method_id, 'none'); } print ''; print ''; @@ -3186,16 +3188,16 @@ if ($action == 'create') { // Warehouse if (isModEnabled('stock') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) { $langs->load('stocks'); - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); print ''; $editenable = $usercancreate; print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); print ''; if ($action == 'editwarehouse') { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->warehouse_id, 'warehouse_id', 1); } else { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->warehouse_id, 'none'); } print ''; print ''; @@ -3207,14 +3209,14 @@ if ($action == 'create') { print $langs->trans('Source'); print ''; if ($action != 'editdemandreason' && $usercancreate) { - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).''; + print '' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . ''; } print ''; print ''; if ($action == 'editdemandreason' && $usercancreate) { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'demand_reason_id', 1); + $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->demand_reason_id, 'demand_reason_id', 1); } else { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'none'); + $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->demand_reason_id, 'none'); } print ''; print ''; @@ -3226,8 +3228,8 @@ if ($action == 'create') { print ''; $arrayoutstandingbills = $soc->getOutstandingBills(); print($arrayoutstandingbills['opened'] > $soc->outstanding_limit ? img_warning() : ''); - print price($arrayoutstandingbills['opened']).' / '; - print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency); + print price($arrayoutstandingbills['opened']) . ' / '; + print price($soc->outstanding_limit, 0, $langs, 1, -1, -1, $conf->currency); print ''; print ''; } @@ -3239,14 +3241,14 @@ if ($action == 'create') { print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print '' . img_edit($langs->trans('SetBankAccount'), 1) . ''; } print ''; print ''; if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'fk_account', 1); + $form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'fk_account', 1); } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'none'); + $form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'none'); } print ''; print ''; @@ -3257,13 +3259,13 @@ if ($action == 'create') { $totalWeight = isset($tmparray['weight']) ? $tmparray['weight'] : 0; $totalVolume = isset($tmparray['volume']) ? $tmparray['volume'] : 0; if ($totalWeight) { - print ''.$langs->trans("CalculatedWeight").''; + print '' . $langs->trans("CalculatedWeight") . ''; print ''; print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no'), 1); print ''; } if ($totalVolume) { - print ''.$langs->trans("CalculatedVolume").''; + print '' . $langs->trans("CalculatedVolume") . ''; print ''; print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_VOLUME_DEFAULT_UNIT', 'no'), 1); print ''; @@ -3277,7 +3279,7 @@ if ($action == 'create') { print $langs->trans('IncotermLabel'); print ''; if ($action != 'editincoterm' && $usercancreate && $caneditfield) { - print ''.img_edit().''; + print '' . img_edit() . ''; } else { print ' '; } @@ -3285,7 +3287,7 @@ if ($action == 'create') { print ''; print ''; if ($action == 'editincoterm' && $usercancreate && $caneditfield) { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'] . '?id=' . $object->id); } else { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } @@ -3293,7 +3295,7 @@ if ($action == 'create') { } // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print ''; @@ -3303,7 +3305,7 @@ if ($action == 'create') { print ''; - include DOL_DOCUMENT_ROOT.'/core/tpl/object_currency_amount.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/object_currency_amount.tpl.php'; print ''; print ''; @@ -3368,13 +3370,13 @@ if ($action == 'create') { if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) { $blocname = 'contacts'; $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/bloc_showhide.tpl.php'; } if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { $blocname = 'notes'; $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/bloc_showhide.tpl.php'; } /* @@ -3389,18 +3391,18 @@ if ($action == 'create') { global $inputalsopricewithtax; $inputalsopricewithtax = 1; - print ' - - + print ' + + - - + + '; if (!empty($conf->use_javascript_ajax) && $object->status == Propal::STATUS_DRAFT) { if (isModEnabled('subtotals')) { - include DOL_DOCUMENT_ROOT.'/core/tpl/subtotal_ajaxrow.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/subtotal_ajaxrow.tpl.php'; } else { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } @@ -3457,7 +3459,7 @@ if ($action == 'create') { if (empty($reshook)) { if ($action != 'editline') { // Subtotal - if ($object->status == Propal::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_'.strtoupper($object->element))) { + if ($object->status == Propal::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_' . strtoupper($object->element))) { $langs->load('subtotals'); $url_button = array(); @@ -3467,7 +3469,7 @@ if ($action == 'create') { 'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddTitleLine'), - 'url' => '/comm/propal/card.php?id='.$object->id.'&action=add_title_line&token='.newToken() + 'url' => '/comm/propal/card.php?id=' . $object->id . '&action=add_title_line&token=' . newToken() ); $url_button[] = array( @@ -3475,7 +3477,7 @@ if ($action == 'create') { 'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddSubtotalLine'), - 'url' => '/comm/propal/card.php?id='.$object->id.'&action=add_subtotal_line&token='.newToken() + 'url' => '/comm/propal/card.php?id=' . $object->id . '&action=add_subtotal_line&token=' . newToken() ); print dolGetButtonAction('', $langs->trans('Subtotal'), 'default', $url_button, '', true); @@ -3483,11 +3485,12 @@ if ($action == 'create') { // Validate if (($object->status == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) - || ($object->status == Propal::STATUS_DRAFT && getDolGlobalString('PROPAL_ENABLE_NEGATIVE') && count($object->lines) > 0)) { + || ($object->status == Propal::STATUS_DRAFT && getDolGlobalString('PROPAL_ENABLE_NEGATIVE') && count($object->lines) > 0) + ) { if ($usercanvalidate) { - print ''.(!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') ? $langs->trans('Validate') : $langs->trans('ValidateAndSign')).''; + print '' . (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') ? $langs->trans('Validate') : $langs->trans('ValidateAndSign')) . ''; } else { - print ''.$langs->trans('Validate').''; + print '' . $langs->trans('Validate') . ''; } } // Create event @@ -3497,23 +3500,23 @@ if ($action == 'create') { }*/ // Edit if ($object->status == Propal::STATUS_VALIDATED && $usercancreate) { - print ''.$langs->trans('Modify').''; + print '' . $langs->trans('Modify') . ''; } // ReOpen if (((getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && $object->status == Propal::STATUS_NOTSIGNED) || (!getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && ($object->status == Propal::STATUS_SIGNED || $object->status == Propal::STATUS_NOTSIGNED || $object->status == Propal::STATUS_BILLED || $object->status == Propal::STATUS_CANCELED)))) { if ($usercanreopen) { - print ''.$langs->trans('ReOpen').''; + print '' . $langs->trans('ReOpen') . ''; } else { - print ''.$langs->trans("ReOpen").''; + print '' . $langs->trans("ReOpen") . ''; } } // Send if (empty($user->socid)) { if ($object->status == Propal::STATUS_VALIDATED || $object->status == Propal::STATUS_SIGNED || getDolGlobalString('PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS')) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '', $usercansend); + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', '', $usercansend); } } @@ -3587,7 +3590,7 @@ if ($action == 'create') { 'enabled' => isModEnabled('invoice'), 'perm' => $usercancreateinvoice, 'label' => 'CreateBill', - 'url' => '/compta/facture/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid), + 'url' => '/compta/facture/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid), ]; /*if (isModEnabled('invoice') && $usercancreateinvoice) { print ''.$langs->trans("CreateBill").''; @@ -3609,9 +3612,9 @@ if ($action == 'create') { $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || !getDolGlobalString('WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED')) { if ($usercanclose) { - print 'socid.'">'.$langs->trans("ClassifyBilled").''; + print '' . $langs->trans("ClassifyBilled") . ''; } else { - print ''.$langs->trans("ClassifyBilled").''; + print '' . $langs->trans("ClassifyBilled") . ''; } } } @@ -3620,33 +3623,33 @@ if ($action == 'create') { // Close as accepted/refused if ($object->status == Propal::STATUS_VALIDATED) { if ($usercanclose) { - print ''.$langs->trans('SetAcceptedRefused').''; + print '' . $langs->trans('SetAcceptedRefused') . ''; } else { - print ''.$langs->trans('SetAcceptedRefused').''; + print '' . $langs->trans('SetAcceptedRefused') . ''; } } } else { // Set not signed (close) if ($object->status == Propal::STATUS_DRAFT && $usercanclose) { - print '' . $langs->trans('SetRefusedAndClose') . ''; } } // Cancel propal if ($object->status > Propal::STATUS_DRAFT && $usercanclose) { - print ''.$langs->trans("CancelPropal").''; + print '' . $langs->trans("CancelPropal") . ''; } // Clone if ($usercancreate) { - print ''.$langs->trans("ToClone").''; + print '' . $langs->trans("ToClone") . ''; } // Delete - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $usercandelete); + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete&token=' . newToken(), 'delete', $usercandelete); } } @@ -3665,8 +3668,8 @@ if ($action == 'create') { * Generated documents */ $objref = dol_sanitizeFileName($object->ref); - $filedir = $conf->propal->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); - $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; + $filedir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $usercanread; $delallowed = $usercancreate; @@ -3689,18 +3692,19 @@ if ($action == 'create') { if ($object->status != Propal::STATUS_DRAFT && $useonlinesignature) { print '
'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - print showOnlineSignatureUrl('proposal', $object->ref, $object).'
'; + require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php'; + print showOnlineSignatureUrl('proposal', $object->ref, $object) . '
'; } print '
'; $MAXEVENT = 10; - $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/comm/propal/agenda.php?id='.$object->id); + $morehtmlcenter = dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT . '/comm/propal/messaging.php?id=' . $object->id); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/comm/propal/agenda.php?id=' . $object->id); // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'propal', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty @@ -3711,9 +3715,9 @@ if ($action == 'create') { $modelmail = 'propal_send'; $defaulttopic = 'SendPropalRef'; $diroutput = $conf->propal->multidir_output[$object->entity]; - $trackid = 'pro'.$object->id; + $trackid = 'pro' . $object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php'; } // End of page diff --git a/htdocs/comm/propal/messaging.php b/htdocs/comm/propal/messaging.php new file mode 100644 index 00000000000..16963746dc6 --- /dev/null +++ b/htdocs/comm/propal/messaging.php @@ -0,0 +1,256 @@ + + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Grimal Valentin + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/comm/propal/messaging.php + * \ingroup order + * \brief Page with events on order + */ + +// Load Dolibarr environment +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + +// Load translation files required by the page +$langs->load("orders"); // Changed from projects + +$id = GETPOSTINT('id'); +$ref = GETPOST('ref', 'alpha'); +$socid = GETPOSTINT('socid'); +$action = GETPOST('action', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ09'); + +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; +$sortfield = GETPOST("sortfield", "aZ09comma"); +$sortorder = GETPOST("sortorder", 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); +$page = is_numeric($page) ? $page : 0; +$page = $page == -1 ? 0 : $page; +if (!$sortfield) { + $sortfield = "a.datep,a.id"; +} +if (!$sortorder) { + $sortorder = "DESC"; +} +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; + +if (GETPOST('actioncode', 'array')) { + $actioncode = GETPOST('actioncode', 'array', 3); + if (!count($actioncode)) { + $actioncode = '0'; + } +} else { + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); +} +$search_rowid = GETPOST('search_rowid'); +$search_agenda_label = GETPOST('search_agenda_label'); + +$hookmanager->initHooks(array('ordercardinfo')); // Changed from projectcardinfo + +// Security check +$id = GETPOSTINT("id"); +$socid = 0; +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of order and assignment. +$result = restrictedArea($user, 'propal', $id, 'propal&propal'); // Changed from projet and project + +if (!$user->hasRight('propal', 'lire')) { // Changed from projet + accessforbidden(); +} + + + +/* + * Actions + */ + +$object = new Propal($db); // Changed from Project + +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + $object->fetch_thirdparty(); + // if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { + // $object->fetchComments(); + // } + $object->info($object->id); +} + +$parameters = array('id' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +// Purge search criteria +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers + $actioncode = ''; + $search_agenda_label = ''; +} + + + +/* + * View + */ + +$form = new Form($db); +$agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/' . $langs->trans("Agenda") : ''; +$title = $langs->trans('Events') . $agenda . ' - ' . $object->ref; // Removed $object->name as orders typically don't have it +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/ordernamonly/', getDolGlobalString('MAIN_HTML_TITLE'))) { // Changed from projectnameonly + $title = $object->ref . ' - ' . $langs->trans("Info"); // Simplified title +} +$help_url = "EN:Module_Orders|FR:Module_Propals|ES:Módulo_Pedidos"; // Changed help URL +llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-order page-card_messaging'); // Changed mod-project + +$head = propal_prepare_head($object); // Changed from project_prepare_head + +print dol_get_fiche_head($head, 'agenda', $langs->trans("Order"), -1, 'order'); // Changed "Project" and "projectpub" + + +// Order card + +if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['order'])) { // Changed from project + $tmpurl = $_SESSION['pageforbacktolist']['order']; // Changed from project + $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); + $linkback = '' . $langs->trans("BackToList") . ''; +} else { + $linkback = '' . $langs->trans("BackToList") . ''; // Changed from projet +} + +$morehtmlref = '
'; +// Title +$morehtmlref .= $object->ref; // Changed from $object->title as orders typically use ref for main identification +// Thirdparty +if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { + $morehtmlref .= '
' . $object->thirdparty->getNomUrl(1, 'order'); +} +$morehtmlref .= '
'; + +// Define a complementary filter for search of next/prev ref. +if (!$user->hasRight('propal', 'all', 'lire')) { // Changed from projet + // This part needs a function specific to orders, e.g., getOrdersAuthorizedForUser + // $objectsListId = $object->getOrdersAuthorizedForUser($user, 0, 0); // Assuming such a method exists or will be created + // $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); + $object->next_prev_filter = ''; // Placeholder if getOrdersAuthorizedForUser is not available +} + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + +print '
'; +print '
'; + +dol_print_object_info($object, 1); + +print '
'; + +print '
'; + +print dol_get_fiche_end(); + + +// Actions buttons + +$out = ''; +$permok = $user->hasRight('agenda', 'myactions', 'create'); +if ($permok) { + $out .= '&orderid=' . $object->id; // Changed from projectid +} + + + +//print '
'; + +if (!empty($object->id)) { + print '
'; + + //print '
'; + $morehtmlright = ''; + + + // Show link to change view in message + $messagingUrl = DOL_URL_ROOT . '/comm/propal/messaging.php?id=' . $object->id; // Changed from projet + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); + + // Show link to change view in agenda + $messagingUrl = DOL_URL_ROOT . '/comm/propal/agenda.php?id=' . $object->id; // Changed from projet + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); + + + // // Show link to send an email (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + + // // Show link to add a private message (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + + // Show link to add event + if (isModEnabled('agenda')) { + $addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out . '&socid=' . $object->socid . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id), '', (int) $addActionBtnRight); + } + + $param = '&id=' . $object->id; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage=' . urlencode($contextpage); + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit=' . ((int) $limit); + } + + require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; + $cachekey = 'count_events_order_' . $object->id; // Changed from project + $nbEvent = dol_getcache($cachekey); + + $titlelist = $langs->trans("ActionsOnOrder") . (is_numeric($nbEvent) ? '(' . $nbEvent . ')' : ''); // Changed from ActionsOnProject + if (!empty($conf->dol_optimize_smallscreen)) { + $titlelist = $langs->trans("Actions") . (is_numeric($nbEvent) ? '(' . $nbEvent . ')' : ''); + } + + print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); + + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; + $filters['search_rowid'] = $search_rowid; + + // This function needs to be able to handle an 'order' object. You might need to adapt it or create a new one. + show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php index d179d1c1c84..a131fe12640 100644 --- a/htdocs/commande/agenda.php +++ b/htdocs/commande/agenda.php @@ -26,7 +26,6 @@ */ // Load Dolibarr environment -//MODIF VAL require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; // Added for contact object @@ -219,7 +218,6 @@ if (!empty($object->id)) { //print '
'; $morehtmlright = ''; - //MODIF PICHINOV MESSAGING // Show link to change view in message $messagingUrl = DOL_URL_ROOT . '/commande/messaging.php?id=' . $object->id; // Changed from projet $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); // Status 1 for "not current page" @@ -229,8 +227,6 @@ if (!empty($object->id)) { $messagingUrl = DOL_URL_ROOT . '/commande/agenda.php?id=' . $object->id; // Changed from projet $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); // Status 2 for "current page" - //END MODIF - // Show link to add event if (isModEnabled('agenda')) { $addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1ce33976dc1..a43d0dbc41f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -3681,7 +3681,6 @@ if ($action == 'create' && $usercancreate) { $MAXEVENT = 10; - //MODIF PICHINOV MESSAGING //button to go to messaging from the events box $morehtmlcenter = dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT . '/commande/messaging.php?id=' . $object->id); $morehtmlcenter .= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/commande/agenda.php?id=' . $object->id); diff --git a/htdocs/commande/messaging.php b/htdocs/commande/messaging.php index 8165b808cb3..66641f20f0f 100644 --- a/htdocs/commande/messaging.php +++ b/htdocs/commande/messaging.php @@ -1,8 +1,9 @@ * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Grimal Valentin * * 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 @@ -152,7 +153,7 @@ $morehtmlref = '
'; $morehtmlref .= $object->ref; // Changed from $object->title as orders typically use ref for main identification // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
' . $object->thirdparty->getNomUrl(1, 'order'); // Changed from project + $morehtmlref .= '
' . $object->thirdparty->getNomUrl(1, 'order'); } $morehtmlref .= '
'; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b5c55142158..27be41de1d8 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1903,8 +1903,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $sql .= ", o.ref"; } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { $sql .= ", o.ref"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { //MODIF PICHINOV MESSAGING - $sql .= ", s.ref"; //END MODIF + } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { + $sql .= ", s.ref"; } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && $filterobj->table_element && $filterobj->element) { if (!empty($filterobj->fields['ref'])) { $sql .= ", o.ref"; @@ -1964,9 +1964,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $sql .= ", " . MAIN_DB_PREFIX . "bom_bom as o"; } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { $sql .= ", " . MAIN_DB_PREFIX . "contrat as o"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { //MODIF PICHINOV MESSAGING + } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expedition as s ON a.fk_element = s.rowid AND a.elementtype = 'shipping'"; // Jointure sur la table des expéditions avec condition ON - } elseif ( //END MODIF + } elseif (is_object($filterobj) && get_class($filterobj) == 'Propal') { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "propal as o ON a.fk_element = o.rowid AND a.elementtype = 'propal'"; + } elseif ( is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && ((!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref'])) || (!empty($filterobj->fields['label']) && is_array($filterobj->fields['label'])) || (!empty($filterobj->fields['titre']) && is_array($filterobj->fields['titre']))) // @phan-suppress-current-line PhanTypeInvalidDimOffset && $filterobj->table_element && $filterobj->element @@ -2027,12 +2029,12 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr if ($filterobj->id) { $sql .= " AND a.fk_element = " . ((int) $filterobj->id); } - } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { //MODIF PICHINOV MESSAGING + } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { $sql .= " AND a.fk_element = s.rowid AND a.elementtype = 'shipping'"; //expedition filter if ($filterobj->id) { $sql .= " AND a.fk_element = " . ((int) $filterobj->id); } - } elseif ( //END MODIF + } elseif ( is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && ((!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref'])) || (!empty($filterobj->fields['label']) && is_array($filterobj->fields['label'])) || (!empty($filterobj->fields['titre']) && is_array($filterobj->fields['titre']))) // ref, titre, label do not exist on $fields - @phan-suppress-current-line PhanTypeInvalidDimOffset && $filterobj->table_element && $filterobj->element diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3b99a9477a2..33d0d1a66af 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8506,8 +8506,8 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, // If the (seller country = buyer country) then the default VAT = VAT of the product sold. End of rule. if (($seller_country_code == $buyer_country_code) - || (in_array($seller_country_code, array('FR', 'MC')) && in_array($buyer_country_code, array('FR', 'MC'))) - || (in_array($seller_country_code, array('MQ', 'GP')) && in_array($buyer_country_code, array('MQ', 'GP'))) // We should be able to manage the case of MQ, GP, ... with a deicated vat rate at previous step. + || (in_array($seller_country_code, array('FR', 'MC')) && in_array($buyer_country_code, array('FR', 'MC'))) + || (in_array($seller_country_code, array('MQ', 'GP')) && in_array($buyer_country_code, array('MQ', 'GP'))) // We should be able to manage the case of MQ, GP, ... with a deicated vat rate at previous step. ) { // Warning ->country_code not always defined //print 'VATRULE 3'; $tmpvat = get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); @@ -12428,7 +12428,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $reg = array(); if ($mode == 'add' && !preg_match('/^\-/', $values[1])) { if (count($values) !== 6) { - dol_syslog('Tabs module_parts entries must be composed of 6 values separated by ":", but got "'.$value.'". Please check your module descriptor classes.', LOG_ERR); + dol_syslog('Tabs module_parts entries must be composed of 6 values separated by ":", but got "' . $value . '". Please check your module descriptor classes.', LOG_ERR); continue; } @@ -12494,7 +12494,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall $nbrec = $obj->$function($object->id, $obj); if (!empty($nbrec)) { - $label .= ''.$nbrec.''; + $label .= '' . $nbrec . ''; } } } @@ -15723,10 +15723,8 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, $sql .= ", sp.lastname, sp.firstname"; } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { $sql .= ", m.lastname, m.firstname"; - } elseif (is_object($filterobj) && in_array(get_class($filterobj), array('Commande', 'CommandeFournisseur', 'Product', 'Ticket', 'BOM', 'Contrat', 'Facture', 'FactureFournisseur'))) { + } elseif (is_object($filterobj) && in_array(get_class($filterobj), array('Commande', 'CommandeFournisseur', 'Product', 'Ticket', 'BOM', 'Contrat', 'Facture', 'FactureFournisseur', 'Propal', 'Expedition'))) { $sql .= ", o.ref"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { //MODIF PICHINOV MESSAGING - $sql .= ", s.ref"; // Add expedition ref } $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm as a"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on u.rowid = a.fk_user_action"; @@ -15763,11 +15761,13 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, $sql .= ", " . MAIN_DB_PREFIX . "facture as o"; } elseif (is_object($filterobj) && get_class($filterobj) == 'FactureFournisseur') { $sql .= ", " . MAIN_DB_PREFIX . "facture_fourn as o"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Commande') { //MODIF PICHINOV MESSAGING - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "commande as o ON a.fk_element = o.rowid AND a.elementtype = 'order'"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Commande') { + $sql .= ", " . MAIN_DB_PREFIX . "commande as o"; } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expedition as s ON a.fk_element = s.rowid AND a.elementtype = 'shipping'"; // CHANGED: Table 'expedition' et alias 's', elementtype 'shipping' - } //END MODIF + $sql .= ", " . MAIN_DB_PREFIX . "expedition as o"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Propal') { + $sql .= ", " . MAIN_DB_PREFIX . "propal as o"; + } $sql .= " WHERE a.entity IN (" . getEntity('agenda') . ")"; if (!$force_filter_contact) { if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) { @@ -15784,11 +15784,16 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, if ($filterobj->id) { $sql .= " AND a.fk_element = " . ((int) $filterobj->id); } - } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { //MODIF PICHINOV MESSAGING - $sql .= " AND a.fk_element = s.rowid AND a.elementtype = 'shipping'"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'shipping'"; if ($filterobj->id) { $sql .= " AND a.fk_element = " . ((int) $filterobj->id); - } //END MODIF + } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Propal') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'propal'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = " . ((int) $filterobj->id); + } } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; if ($filterobj->id) { @@ -16453,6 +16458,8 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, } } + print_r($sql); + if ($noprint) { return $out; } else { diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 08d52888417..160a19edbc4 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -114,15 +114,13 @@ function shipping_prepare_head($object) $head[$h][2] = 'note'; $h++; - - //MODIF PICHINOV AGENDA $head[$h][0] = DOL_URL_ROOT . '/expedition/agenda.php?id=' . $object->id; $head[$h][1] = $langs->trans("Events"); if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; - $cachekey = 'count_events_expedition_' . $object->id; // CHANGED: 'propal' to 'expedition' + $cachekey = 'count_events_expedition_' . $object->id; $dataretrieved = dol_getcache($cachekey); if (!is_null($dataretrieved)) { $nbEvent = $dataretrieved; @@ -130,7 +128,7 @@ function shipping_prepare_head($object) $sql = "SELECT COUNT(id) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm"; $sql .= " WHERE fk_element = " . ((int) $object->id); - $sql .= " AND elementtype = 'shipping'"; // CHANGED: 'order' to 'shipping' + $sql .= " AND elementtype = 'shipping'"; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); diff --git a/htdocs/expedition/agenda.php b/htdocs/expedition/agenda.php index 9fa26279578..c2d454d858c 100644 --- a/htdocs/expedition/agenda.php +++ b/htdocs/expedition/agenda.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Grimal Valentin * * 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 @@ -46,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; // Added for */ // Load translation files required by the page -$langs->loadLangs(array("deliveries", "other")); // Changed from "order" to "deliveries" (common for shipping) +$langs->loadLangs(array("deliveries", "other")); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); @@ -203,11 +204,11 @@ if (!empty($object->id)) { // Show link to change view in message $messagingUrl = DOL_URL_ROOT . '/expedition/messaging.php?id=' . $object->id; // Changed from commande - $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); // Status 1 for "not current page" + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); // Show link to change view in agenda $messagingUrl = DOL_URL_ROOT . '/expedition/agenda.php?id=' . $object->id; // Changed from commande - $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); // Status 2 for "current page" + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); // Show link to add event diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 0a8887e485a..77b00711dfb 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -3182,13 +3182,12 @@ if ($action == 'create') { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - //MODIF PICHINOV MESSAGING //button to go to messaging from the events box $MAXEVENT = 10; $morehtmlcenter = dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT . '/expedition/messaging.php?id=' . $object->id); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/expedition/agenda.php?id=' . $object->id); $somethingshown = $formactions->showactions($object, 'shipping', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); - //END MODIF print '
'; } diff --git a/htdocs/expedition/messaging.php b/htdocs/expedition/messaging.php index deb8052448c..2e69bfb8f91 100644 --- a/htdocs/expedition/messaging.php +++ b/htdocs/expedition/messaging.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Grimal Valentin * * 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
' . $langs->trans('AmountHT') . '