/** * Get the form to input an email * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files * this->param: Contains more parameteres like email templates info * * @param string $addfileaction Name of action when posting file attachments * @param string $removefileaction Name of action when removing file attachments * @return string Form to show */ function get_form($addfileaction = 'addfile', $removefileaction = 'removefile') { global $conf, $langs, $user, $hookmanager, $form; if (!is_object($form)) { $form = new Form($this->db); } $langs->load("other"); $langs->load("mails"); $hookmanager->initHooks(array('formmail')); $parameters = array('addfileaction' => $addfileaction, 'removefileaction' => $removefileaction); $reshook = $hookmanager->executeHooks('getFormMail', $parameters, $this); if (!empty($reshook)) { return $hookmanager->resPrint; } else { $out = ''; // Define list of attached files $listofpaths = array(); $listofnames = array(); $listofmimes = array(); if (!empty($_SESSION["listofpaths"])) { $listofpaths = explode(';', $_SESSION["listofpaths"]); } if (!empty($_SESSION["listofnames"])) { $listofnames = explode(';', $_SESSION["listofnames"]); } if (!empty($_SESSION["listofmimes"])) { $listofmimes = explode(';', $_SESSION["listofmimes"]); } // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $this->param['langsmodels']; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); $outputlangs->load('other'); } // Get message template $model_id = 0; if (array_key_exists('models_id', $this->param)) { $model_id = $this->param["models_id"]; } $arraydefaultmessage = $this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); //var_dump($arraydefaultmessage); $out .= "\n<!-- Begin form mail -->\n"; if ($this->withform == 1) { $out .= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '#formmail">' . "\n"; $out .= '<input style="display:none" type="submit" id="sendmail" name="sendmail">'; $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />'; $out .= '<input type="hidden" name="trackid" value="' . $this->trackid . '" />'; $out .= '<a id="formmail" name="formmail"></a>'; } foreach ($this->param as $key => $value) { $out .= '<input type="hidden" id="' . $key . '" name="' . $key . '" value="' . $value . '" />' . "\n"; } $result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs); if ($result < 0) { setEventMessage($this->error, 'errors'); } $modelmail_array = array(); foreach ($this->lines_model as $line) { $modelmail_array[$line->id] = $line->label; } // Zone to select its email template if (count($modelmail_array) > 0) { $out .= '<div style="padding: 3px 0 3px 0">' . "\n"; $out .= $langs->trans('SelectMailModel') . ': ' . $this->selectarray('modelmailselected', $modelmail_array, 0, 1); if ($user->admin) { $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } $out .= ' '; $out .= '<input class="button" type="submit" value="' . $langs->trans('Valid') . '" name="modelselected" id="modelselected">'; $out .= ' '; $out .= '</div>'; } $out .= '<table class="border" width="100%">' . "\n"; // Substitution array if (!empty($this->withsubstit)) { $out .= '<tr><td colspan="2">'; $help = ""; foreach ($this->substit as $key => $val) { $help .= $key . ' -> ' . $langs->trans($val) . '<br>'; } $out .= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help); $out .= "</td></tr>\n"; } // From if (!empty($this->withfrom)) { if (!empty($this->withfromreadonly)) { $out .= '<input type="hidden" id="fromname" name="fromname" value="' . $this->fromname . '" />'; $out .= '<input type="hidden" id="frommail" name="frommail" value="' . $this->frommail . '" />'; $out .= '<tr><td width="180">' . $langs->trans("MailFrom") . '</td><td>'; if ($this->fromtype == 'user' && $this->fromid > 0) { $langs->load("users"); $fuser = new User($this->db); $fuser->fetch($this->fromid); $out .= $fuser->getNomUrl(1); } else { $out .= $this->fromname; } if ($this->frommail) { $out .= " <" . $this->frommail . ">"; } else { if ($this->fromtype) { $langs->load("errors"); $out .= '<font class="warning"> <' . $langs->trans("ErrorNoMailDefinedForThisUser") . '> </font>'; } } $out .= "</td></tr>\n"; $out .= "</td></tr>\n"; } else { $out .= "<tr><td>" . $langs->trans("MailFrom") . "</td><td>"; $out .= $langs->trans("Name") . ':<input type="text" id="fromname" name="fromname" size="32" value="' . $this->fromname . '" />'; $out .= ' '; $out .= $langs->trans("EMail") . ':<<input type="text" id="frommail" name="frommail" size="32" value="' . $this->frommail . '" />>'; $out .= "</td></tr>\n"; } } // Replyto if (!empty($this->withreplyto)) { if ($this->withreplytoreadonly) { $out .= '<input type="hidden" id="replyname" name="replyname" value="' . $this->replytoname . '" />'; $out .= '<input type="hidden" id="replymail" name="replymail" value="' . $this->replytomail . '" />'; $out .= "<tr><td>" . $langs->trans("MailReply") . "</td><td>" . $this->replytoname . ($this->replytomail ? " <" . $this->replytomail . ">" : ""); $out .= "</td></tr>\n"; } } // Errorsto if (!empty($this->witherrorsto)) { //if (! $this->errorstomail) $this->errorstomail=$this->frommail; $errorstomail = !empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail; if ($this->witherrorstoreadonly) { $out .= '<input type="hidden" id="errorstomail" name="errorstomail" value="' . $errorstomail . '" />'; $out .= '<tr><td>' . $langs->trans("MailErrorsTo") . '</td><td>'; $out .= $errorstomail; $out .= "</td></tr>\n"; } else { $out .= '<tr><td>' . $langs->trans("MailErrorsTo") . '</td><td>'; $out .= '<input size="30" id="errorstomail" name="errorstomail" value="' . $errorstomail . '" />'; $out .= "</td></tr>\n"; } } // To if (!empty($this->withto) || is_array($this->withto)) { $out .= '<tr><td width="180">'; if ($this->withtofree) { $out .= $form->textwithpicto($langs->trans("MailTo"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); } else { $out .= $langs->trans("MailTo"); } $out .= '</td><td>'; if ($this->withtoreadonly) { if (!empty($this->toname) && !empty($this->tomail)) { $out .= '<input type="hidden" id="toname" name="toname" value="' . $this->toname . '" />'; $out .= '<input type="hidden" id="tomail" name="tomail" value="' . $this->tomail . '" />'; if ($this->totype == 'thirdparty') { $soc = new Societe($this->db); $soc->fetch($this->toid); $out .= $soc->getNomUrl(1); } else { if ($this->totype == 'contact') { $contact = new Contact($this->db); $contact->fetch($this->toid); $out .= $contact->getNomUrl(1); } else { $out .= $this->toname; } } $out .= ' <' . $this->tomail . '>'; if ($this->withtofree) { $out .= '<br>' . $langs->trans("or") . ' <input size="' . (is_array($this->withto) ? "30" : "60") . '" id="sendto" name="sendto" value="' . (!is_array($this->withto) && !is_numeric($this->withto) ? isset($_REQUEST["sendto"]) ? $_REQUEST["sendto"] : $this->withto : "") . '" />'; } } else { $out .= !is_array($this->withto) && !is_numeric($this->withto) ? $this->withto : ""; } } else { if (!empty($this->withtofree)) { $out .= '<input size="' . (is_array($this->withto) ? "30" : "60") . '" id="sendto" name="sendto" value="' . (!is_array($this->withto) && !is_numeric($this->withto) ? isset($_REQUEST["sendto"]) ? $_REQUEST["sendto"] : $this->withto : "") . '" />'; } if (!empty($this->withto) && is_array($this->withto)) { if (!empty($this->withtofree)) { $out .= " " . $langs->trans("or") . " "; } $out .= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1); } if (isset($this->withtosocid) && $this->withtosocid > 0) { $liste = array(); $soc = new Societe($this->db); $soc->fetch($this->withtosocid); foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { $liste[$key] = $value; } if ($this->withtofree) { $out .= " " . $langs->trans("or") . " "; } $out .= $form->selectarray("receiver", $liste, GETPOST("receiver"), 1); } } $out .= "</td></tr>\n"; } // CC if (!empty($this->withtocc) || is_array($this->withtocc)) { $out .= '<tr><td width="180">'; $out .= $form->textwithpicto($langs->trans("MailCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); $out .= '</td><td>'; if ($this->withtoccreadonly) { $out .= !is_array($this->withtocc) && !is_numeric($this->withtocc) ? $this->withtocc : ""; } else { $out .= '<input size="' . (is_array($this->withtocc) ? "30" : "60") . '" id="sendtocc" name="sendtocc" value="' . (!is_array($this->withtocc) && !is_numeric($this->withtocc) ? isset($_POST["sendtocc"]) ? $_POST["sendtocc"] : $this->withtocc : (isset($_POST["sendtocc"]) ? $_POST["sendtocc"] : "")) . '" />'; if (!empty($this->withtocc) && is_array($this->withtocc)) { $out .= " " . $langs->trans("or") . " "; $out .= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1); } } $out .= "</td></tr>\n"; } // CCC if (!empty($this->withtoccc) || is_array($this->withtoccc)) { $out .= '<tr><td width="180">'; $out .= $form->textwithpicto($langs->trans("MailCCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); $out .= '</td><td>'; if (!empty($this->withtocccreadonly)) { $out .= !is_array($this->withtoccc) && !is_numeric($this->withtoccc) ? $this->withtoccc : ""; } else { $out .= '<input size="' . (is_array($this->withtoccc) ? "30" : "60") . '" id="sendtoccc" name="sendtoccc" value="' . (!is_array($this->withtoccc) && !is_numeric($this->withtoccc) ? isset($_POST["sendtoccc"]) ? $_POST["sendtoccc"] : $this->withtoccc : (isset($_POST["sendtoccc"]) ? $_POST["sendtoccc"] : "")) . '" />'; if (!empty($this->withtoccc) && is_array($this->withtoccc)) { $out .= " " . $langs->trans("or") . " "; $out .= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1); } } $showinfobcc = ''; if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) && !empty($this->param['models']) && $this->param['models'] == 'propal_send') { $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO; } if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_ASKPRICESUPPLIER_TO) && !empty($this->param['models']) && $this->param['models'] == 'askpricesupplier_send') { $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_ASKPRICESUPPLIER_TO; } if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) && !empty($this->param['models']) && $this->param['models'] == 'order_send') { $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO; } if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) && !empty($this->param['models']) && $this->param['models'] == 'facture_send') { $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO; } if ($showinfobcc) { $out .= ' + ' . $showinfobcc; } $out .= "</td></tr>\n"; } // Ask delivery receipt if (!empty($this->withdeliveryreceipt)) { $out .= '<tr><td width="180">' . $langs->trans("DeliveryReceipt") . '</td><td>'; if (!empty($this->withdeliveryreceiptreadonly)) { $out .= yn($this->withdeliveryreceipt); } else { $defaultvaluefordeliveryreceipt = 0; if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_PROPAL) && !empty($this->param['models']) && $this->param['models'] == 'propal_send') { $defaultvaluefordeliveryreceipt = 1; } if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ASKPRICESUPPLIER) && !empty($this->param['models']) && $this->param['models'] == 'askpricesupplier_send') { $defaultvaluefordeliveryreceipt = 1; } if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ORDER) && !empty($this->param['models']) && $this->param['models'] == 'order_send') { $defaultvaluefordeliveryreceipt = 1; } if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && !empty($this->param['models']) && $this->param['models'] == 'facture_send') { $defaultvaluefordeliveryreceipt = 1; } $out .= $form->selectyesno('deliveryreceipt', isset($_POST["deliveryreceipt"]) ? $_POST["deliveryreceipt"] : $defaultvaluefordeliveryreceipt, 1); } $out .= "</td></tr>\n"; } // Topic if (!empty($this->withtopic)) { $defaulttopic = ""; if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) { $defaulttopic = $arraydefaultmessage['topic']; } elseif (!is_numeric($this->withtopic)) { $defaulttopic = $this->withtopic; } $defaulttopic = make_substitutions($defaulttopic, $this->substit); $out .= '<tr>'; $out .= '<td width="180">' . $langs->trans("MailTopic") . '</td>'; $out .= '<td>'; if ($this->withtopicreadonly) { $out .= $defaulttopic; $out .= '<input type="hidden" size="60" id="subject" name="subject" value="' . $defaulttopic . '" />'; } else { $out .= '<input type="text" size="60" id="subject" name="subject" value="' . (isset($_POST["subject"]) && !$_POST['modelselected'] ? $_POST["subject"] : ($defaulttopic ? $defaulttopic : '')) . '" />'; } $out .= "</td></tr>\n"; } // Attached files if (!empty($this->withfile)) { $out .= '<tr>'; $out .= '<td width="180">' . $langs->trans("MailFile") . '</td>'; $out .= '<td>'; if (is_numeric($this->withfile)) { // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript $out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">' . "\n"; $out .= '<script type="text/javascript" language="javascript">'; $out .= 'jQuery(document).ready(function () {'; $out .= ' jQuery(".removedfile").click(function() {'; $out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());'; $out .= ' });'; $out .= '})'; $out .= '</script>' . "\n"; if (count($listofpaths)) { foreach ($listofpaths as $key => $val) { $out .= '<div id="attachfile_' . $key . '">'; $out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key]; if (!$this->withfilereadonly) { $out .= ' <input type="image" style="border: 0px;" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/delete.png" value="' . ($key + 1) . '" class="removedfile" id="removedfile_' . $key . '" name="removedfile_' . $key . '" />'; //$out.= ' <a href="'.$_SERVER["PHP_SELF"].'?removedfile='.($key+1).' id="removedfile_'.$key.'">'.img_delete($langs->trans("Delete").'</a>'; } $out .= '<br></div>'; } } else { $out .= $langs->trans("NoAttachedFiles") . '<br>'; } if ($this->withfile == 2) { $out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="' . $langs->trans("Upload") . '" />'; $out .= ' '; $out .= '<input type="submit" class="button" id="' . $addfileaction . '" name="' . $addfileaction . '" value="' . $langs->trans("MailingAddFile") . '" />'; } } else { $out .= $this->withfile; } $out .= "</td></tr>\n"; } // Message if (!empty($this->withbody)) { $defaultmessage = ""; if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) { $defaultmessage = $arraydefaultmessage['content']; } elseif (!is_numeric($this->withbody)) { $defaultmessage = $this->withbody; } // Complete substitution array if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) { require_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; $langs->load('paypal'); if ($this->param["models"] == 'order_send') { $url = getPaypalPaymentUrl(0, 'order', $this->substit['__ORDERREF__']); $this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url)); } if ($this->param["models"] == 'facture_send') { $url = getPaypalPaymentUrl(0, 'invoice', $this->substit['__FACREF__']); $this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url)); } } $defaultmessage = str_replace('\\n', "\n", $defaultmessage); // Deal with format differences between message and signature (text / HTML) if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) { $this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']); } else { if (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); } } if (isset($_POST["message"]) && !$_POST['modelselected']) { $defaultmessage = $_POST["message"]; } else { $defaultmessage = make_substitutions($defaultmessage, $this->substit); // Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty) $defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage); $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage); } $out .= '<tr>'; $out .= '<td width="180" valign="top">' . $langs->trans("MailText") . '</td>'; $out .= '<td>'; if ($this->withbodyreadonly) { $out .= nl2br($defaultmessage); $out .= '<input type="hidden" id="message" name="message" value="' . $defaultmessage . '" />'; } else { if (!isset($this->ckeditortoolbar)) { $this->ckeditortoolbar = 'dolibarr_notes'; } // Editor wysiwyg require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; if ($this->withfckeditor == -1) { if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $this->withfckeditor = 1; } else { $this->withfckeditor = 0; } } $doleditor = new DolEditor('message', $defaultmessage, '', 280, $this->ckeditortoolbar, 'In', true, true, $this->withfckeditor, 8, 72); $out .= $doleditor->Create(1); } $out .= "</td></tr>\n"; } if ($this->withform == 1 || $this->withform == -1) { $out .= '<tr><td align="center" colspan="2"><div class="center">'; $out .= '<input class="button" type="submit" id="sendmail" name="sendmail" value="' . $langs->trans("SendMail") . '"'; // Add a javascript test to avoid to forget to submit file before sending email if ($this->withfile == 2 && $conf->use_javascript_ajax) { $out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\'' . dol_escape_js($langs->trans("FileWasNotUploaded")) . '\'); return false; } else { return true; }"'; } $out .= ' />'; if ($this->withcancel) { $out .= ' '; $out .= '<input class="button" type="submit" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '" />'; } $out .= '</div></td></tr>' . "\n"; } $out .= '</table>' . "\n"; if ($this->withform == 1) { $out .= '</form>' . "\n"; } // Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) { $out .= '<script type="text/javascript" language="javascript">'; $out .= 'jQuery(document).ready(function () {'; $out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is calle at every key pressed ! */ var code = e.keyCode || e.which; if (code == 13) { e.preventDefault(); return false; } });'; $out .= ' })'; $out .= '</script>'; } $out .= "<!-- End form mail -->\n"; return $out; } }
if ($objsoc->client != 0) { print '<a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&socid=' . $objsoc->id . '">' . $langs->trans("AddBill") . '</a>'; } else { print '<a class="butActionRefused" title="' . dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")) . '" href="#">' . $langs->trans("AddBill") . '</a>'; } } else { print '<a class="butActionRefused" title="' . dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")) . '" href="#">' . $langs->trans("AddBill") . '</a>'; } } } // Add action if ($conf->agenda->enabled && !empty($conf->global->MAIN_REPEATTASKONEACHTAB)) { if ($user->rights->agenda->myactions->create) { print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create&socid=' . $objsoc->id . '">' . $langs->trans("AddAction") . '</a>'; } else { print '<a class="butAction" title="' . dol_escape_js($langs->trans("NotAllowed")) . '" href="#">' . $langs->trans("AddAction") . '</a>'; } } /*if ($user->rights->societe->contact->creer) { print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$objsoc->id.'&action=create">'.$langs->trans("AddContact").'</a>'; }*/ print '</div>'; print "<br>\n"; if (!empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) { print '<br>'; // List of contacts show_contacts($conf, $langs, $db, $objsoc, $_SERVER["PHP_SELF"] . '?socid=' . $objsoc->id); } if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB)) { // List of todo actions
/** * Build a graph onto disk using JFlot library. Input when calling this method should be: * $this->data = array(array( 0=>'labelxA', 1=>yA), array('labelxB',yB)); or * $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // TODO Syntax not supported. Removed when dol_print_graph_removed * $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x * $this->legend= array("Val1",...,"Valn"); // list of n series name * $this->type = array('bars',...'lines'); or array('pie') * $this->mode = 'depth' ??? * $this->bgcolorgrid * $this->datacolor * * @param string $file Image file name to use to save onto disk (also used as javascript unique id) * @param string $fileurl Url path to show image if saved onto disk * @return void */ private function draw_jflot($file, $fileurl) { global $artichow_defaultfont; dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type)); if (empty($this->width) && empty($this->height)) { print 'Error width or height not set'; return; } $legends = array(); $nblot = count($this->data[0]) - 1; // -1 to remove legend if ($nblot < 0) { dol_print_error('Bad value for property ->data. Must be set by mydolgraph->SetData before callinf mydolgrapgh->draw'); } $firstlot = 0; // Works with line but not with bars //if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x $i = $firstlot; $serie = array(); while ($i < $nblot) { $values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x $serie[$i] = "var d" . $i . " = [];\n"; // Fill array $values $x = 0; foreach ($this->data as $valarray) { $legends[$x] = $valarray[0]; $values[$x] = is_numeric($valarray[$i + 1]) ? $valarray[$i + 1] : null; $x++; } // TODO Avoid push by adding generated long array... if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') { foreach ($values as $x => $y) { if (isset($y)) { $serie[$i] .= 'd' . $i . '.push({"label":"' . dol_escape_js($legends[$x]) . '", "data":' . $y . '});' . "\n"; } } } else { foreach ($values as $x => $y) { if (isset($y)) { $serie[$i] .= 'd' . $i . '.push([' . $x . ', ' . $y . ']);' . "\n"; } } } unset($values); $i++; } $tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.')))); $this->_stringtoshow = '<!-- Build using ' . $this->_library . ' -->' . "\n"; if (!empty($this->title)) { $this->_stringtoshow .= '<div align="center" class="dolgraphtitle' . (empty($this->cssprefix) ? '' : ' dolgraphtitle' . $this->cssprefix) . '">' . $this->title . '</div>'; } $this->_stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;" class="dolgraph' . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . '"></div>' . "\n"; $this->_stringtoshow .= '<script id="' . $tag . '">' . "\n"; $this->_stringtoshow .= '$(function () {' . "\n"; $i = $firstlot; while ($i < $nblot) { $this->_stringtoshow .= $serie[$i]; $i++; } $this->_stringtoshow .= "\n"; // Special case for Graph of type 'pie' if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') { $datacolor = array(); foreach ($this->datacolor as $val) { $datacolor[] = "#" . sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]); } $urltemp = ''; // TODO Add support for url link into labels $showlegend = $this->showlegend; $showpointvalue = $this->showpointvalue; $showpercent = $this->showpercent; $this->_stringtoshow .= ' function plotWithOptions_' . $tag . '() { $.plot($("#placeholder_' . $tag . '"), d0, { series: { pie: { show: true, radius: 3/4, label: { show: true, radius: 3/4, formatter: function(label, series) { var percent=Math.round(series.percent); var number=series.data[0][1]; return \''; $this->_stringtoshow .= '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'; if ($urltemp) { $this->_stringtoshow .= '<a style="color: #FFFFFF;" border="0" href="' . $urltemp . '">'; } $this->_stringtoshow .= '\'+'; $this->_stringtoshow .= $showlegend ? '' : 'label+\'<br/>\'+'; // Hide label if already shown in legend $this->_stringtoshow .= $showpointvalue ? 'number+' : ''; $this->_stringtoshow .= $showpercent ? '\'<br/>\'+percent+\'%\'+' : ''; $this->_stringtoshow .= '\''; if ($urltemp) { $this->_stringtoshow .= '</a>'; } $this->_stringtoshow .= '</div>\'; }, background: { opacity: 0.5, color: \'#000000\' } } } }, zoom: { interactive: true }, pan: { interactive: true },'; if (count($datacolor)) { $this->_stringtoshow .= 'colors: ' . (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)) . ','; } $this->_stringtoshow .= 'legend: {show: ' . ($showlegend ? 'true' : 'false') . ', position: \'ne\' } }); }' . "\n"; } else { // Add code to support tooltips $this->_stringtoshow .= ' function showTooltip_' . $tag . '(x, y, contents) { $(\'<div id="tooltip_' . $tag . '">\' + contents + \'</div>\').css({ position: \'absolute\', display: \'none\', top: y + 5, left: x + 5, border: \'1px solid #ddd\', padding: \'2px\', \'background-color\': \'#ffe\', width: 200, opacity: 0.80 }).appendTo("body").fadeIn(20); } var previousPoint = null; $("#placeholder_' . $tag . '").bind("plothover", function (event, pos, item) { $("#x").text(pos.x.toFixed(2)); $("#y").text(pos.y.toFixed(2)); if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; $("#tooltip").remove(); /* console.log(item); */ var x = item.datapoint[0].toFixed(2); var y = item.datapoint[1].toFixed(2); var z = item.series.xaxis.ticks[item.dataIndex].label; '; if ($this->showpointvalue > 0) { $this->_stringtoshow .= ' showTooltip_' . $tag . '(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y); '; } $this->_stringtoshow .= ' } } else { $("#tooltip_' . $tag . '").remove(); previousPoint = null; } }); '; $this->_stringtoshow .= 'var stack = null, steps = false;' . "\n"; $this->_stringtoshow .= 'function plotWithOptions_' . $tag . '() {' . "\n"; $this->_stringtoshow .= '$.plot($("#placeholder_' . $tag . '"), [ ' . "\n"; $i = $firstlot; while ($i < $nblot) { if ($i > $firstlot) { $this->_stringtoshow .= ', ' . "\n"; } $color = sprintf("%02x%02x%02x", $this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]); $this->_stringtoshow .= '{ '; if (!isset($this->type[$i]) || $this->type[$i] == 'bars') { $this->_stringtoshow .= 'bars: { show: true, align: "' . ($i == $firstlot ? 'center' : 'left') . '", barWidth: 0.5 }, '; } if (isset($this->type[$i]) && $this->type[$i] == 'lines') { $this->_stringtoshow .= 'lines: { show: true, fill: false }, '; } $this->_stringtoshow .= 'color: "#' . $color . '", label: "' . (isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '') . '", data: d' . $i . ' }'; $i++; } $this->_stringtoshow .= "\n" . ' ], { series: { stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }' . "\n"; // Xaxis $this->_stringtoshow .= ', xaxis: { ticks: [' . "\n"; $x = 0; foreach ($this->data as $key => $valarray) { if ($x > 0) { $this->_stringtoshow .= ', ' . "\n"; } $this->_stringtoshow .= ' [' . $x . ', "' . $valarray[0] . '"]'; $x++; } $this->_stringtoshow .= '] }' . "\n"; // Yaxis $this->_stringtoshow .= ', yaxis: { min: ' . $this->MinValue . ', max: ' . $this->MaxValue . ' }' . "\n"; // Background color $color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]); $color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]); $this->_stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] } }' . "\n"; //$this->_stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this $this->_stringtoshow .= '});' . "\n"; $this->_stringtoshow .= '}' . "\n"; } $this->_stringtoshow .= 'plotWithOptions_' . $tag . '();' . "\n"; $this->_stringtoshow .= '});' . "\n"; $this->_stringtoshow .= '</script>' . "\n"; }
} if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } session_cache_limiter(FALSE); require_once '../../main.inc.php'; // Define javascript type header('Content-type: text/javascript; charset=UTF-8'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) { header('Cache-Control: max-age=3600, public, must-revalidate'); } else { header('Cache-Control: no-cache'); } // Define tradMonths javascript array (we define this in datepicker AND in parent page to avoid errors with IE8) $tradMonths = array(dol_escape_js($langs->transnoentitiesnoconv("January")), dol_escape_js($langs->transnoentitiesnoconv("February")), dol_escape_js($langs->transnoentitiesnoconv("March")), dol_escape_js($langs->transnoentitiesnoconv("April")), dol_escape_js($langs->transnoentitiesnoconv("May")), dol_escape_js($langs->transnoentitiesnoconv("June")), dol_escape_js($langs->transnoentitiesnoconv("July")), dol_escape_js($langs->transnoentitiesnoconv("August")), dol_escape_js($langs->transnoentitiesnoconv("September")), dol_escape_js($langs->transnoentitiesnoconv("October")), dol_escape_js($langs->transnoentitiesnoconv("November")), dol_escape_js($langs->transnoentitiesnoconv("December"))); $tradMonthsShort = array($langs->trans("JanuaryMin"), $langs->trans("FebruaryMin"), $langs->trans("MarchMin"), $langs->trans("AprilMin"), $langs->trans("MayMin"), $langs->trans("JuneMin"), $langs->trans("JulyMin"), $langs->trans("AugustMin"), $langs->trans("SeptemberMin"), $langs->trans("OctoberMin"), $langs->trans("NovemberMin"), $langs->trans("DecemberMin")); $tradDays = array($langs->trans("Sunday"), $langs->trans("Monday"), $langs->trans("Tuesday"), $langs->trans("Wednesday"), $langs->trans("Thursday"), $langs->trans("Friday"), $langs->trans("Saturday")); $tradDaysShort = array($langs->trans("ShortSunday"), $langs->trans("ShortMonday"), $langs->trans("ShortTuesday"), $langs->trans("ShortWednesday"), $langs->trans("ShortThursday"), $langs->trans("ShortFriday"), $langs->trans("ShortSaturday")); $tradDaysMin = array($langs->trans("SundayMin"), $langs->trans("MondayMin"), $langs->trans("TuesdayMin"), $langs->trans("WednesdayMin"), $langs->trans("ThursdayMin"), $langs->trans("FridayMin"), $langs->trans("SaturdayMin")); ?> // For eldy and jQuery date picker var tradMonths = <?php echo json_encode($tradMonths); ?> ; var tradMonthsShort = <?php echo json_encode($tradMonthsShort); ?>
/** * Get the form to input an email * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files * * @param string $addfileaction Name of action when posting file attachments * @param string $removefileaction Name of action when removing file attachments * @return string Form to show */ function get_form($addfileaction = 'addfile', $removefileaction = 'removefile') { global $conf, $langs, $user, $hookmanager, $form; if (!is_object($form)) { $form = new Form($this->db); } $langs->load("other"); $langs->load("mails"); $hookmanager->initHooks(array('formmail')); $parameters = array('addfileaction' => $addfileaction, 'removefileaction' => $removefileaction); $reshook = $hookmanager->executeHooks('getFormMail', $parameters, $this); if (!empty($reshook)) { return $hookmanager->resPrint; } else { $out = ''; // Define list of attached files $listofpaths = array(); $listofnames = array(); $listofmimes = array(); if (!empty($_SESSION["listofpaths"])) { $listofpaths = explode(';', $_SESSION["listofpaths"]); } if (!empty($_SESSION["listofnames"])) { $listofnames = explode(';', $_SESSION["listofnames"]); } if (!empty($_SESSION["listofmimes"])) { $listofmimes = explode(';', $_SESSION["listofmimes"]); } $out .= "\n<!-- Debut form mail -->\n"; if ($this->withform == 1) { $out .= '<form method="POST" name="mailform" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '">' . "\n"; $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />'; } foreach ($this->param as $key => $value) { $out .= '<input type="hidden" id="' . $key . '" name="' . $key . '" value="' . $value . '" />' . "\n"; } $out .= '<table class="border" width="100%">' . "\n"; // Substitution array if (!empty($this->withsubstit)) { $out .= '<tr><td colspan="2">'; $help = ""; foreach ($this->substit as $key => $val) { $help .= $key . ' -> ' . $langs->trans($val) . '<br>'; } $out .= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help); $out .= "</td></tr>\n"; } // From if (!empty($this->withfrom)) { if (!empty($this->withfromreadonly)) { $out .= '<input type="hidden" id="fromname" name="fromname" value="' . $this->fromname . '" />'; $out .= '<input type="hidden" id="frommail" name="frommail" value="' . $this->frommail . '" />'; $out .= '<tr><td width="180">' . $langs->trans("MailFrom") . '</td><td>'; if ($this->fromtype == 'user' && $this->fromid > 0) { $langs->load("users"); $fuser = new User($this->db); $fuser->fetch($this->fromid); $out .= $fuser->getNomUrl(1); } else { $out .= $this->fromname; } if ($this->frommail) { $out .= " <" . $this->frommail . ">"; } else { if ($this->fromtype) { $langs->load("errors"); $out .= '<font class="warning"> <' . $langs->trans("ErrorNoMailDefinedForThisUser") . '> </font>'; } } $out .= "</td></tr>\n"; $out .= "</td></tr>\n"; } else { $out .= "<tr><td>" . $langs->trans("MailFrom") . "</td><td>"; $out .= $langs->trans("Name") . ':<input type="text" id="fromname" name="fromname" size="32" value="' . $this->fromname . '" />'; $out .= ' '; $out .= $langs->trans("EMail") . ':<<input type="text" id="frommail" name="frommail" size="32" value="' . $this->frommail . '" />>'; $out .= "</td></tr>\n"; } } // Replyto if (!empty($this->withreplyto)) { if ($this->withreplytoreadonly) { $out .= '<input type="hidden" id="replyname" name="replyname" value="' . $this->replytoname . '" />'; $out .= '<input type="hidden" id="replymail" name="replymail" value="' . $this->replytomail . '" />'; $out .= "<tr><td>" . $langs->trans("MailReply") . "</td><td>" . $this->replytoname . ($this->replytomail ? " <" . $this->replytomail . ">" : ""); $out .= "</td></tr>\n"; } } // Errorsto if (!empty($this->witherrorsto)) { //if (! $this->errorstomail) $this->errorstomail=$this->frommail; $errorstomail = !empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail; if ($this->witherrorstoreadonly) { $out .= '<input type="hidden" id="errorstomail" name="errorstomail" value="' . $errorstomail . '" />'; $out .= '<tr><td>' . $langs->trans("MailErrorsTo") . '</td><td>'; $out .= $errorstomail; $out .= "</td></tr>\n"; } else { $out .= '<tr><td>' . $langs->trans("MailErrorsTo") . '</td><td>'; $out .= '<input size="30" id="errorstomail" name="errorstomail" value="' . $errorstomail . '" />'; $out .= "</td></tr>\n"; } } // To if (!empty($this->withto) || is_array($this->withto)) { $out .= '<tr><td width="180">'; if ($this->withtofree) { $out .= $form->textwithpicto($langs->trans("MailTo"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); } else { $out .= $langs->trans("MailTo"); } $out .= '</td><td>'; if ($this->withtoreadonly) { if (!empty($this->toname) && !empty($this->tomail)) { $out .= '<input type="hidden" id="toname" name="toname" value="' . $this->toname . '" />'; $out .= '<input type="hidden" id="tomail" name="tomail" value="' . $this->tomail . '" />'; if ($this->totype == 'thirdparty') { $soc = new Societe($this->db); $soc->fetch($this->toid); $out .= $soc->getNomUrl(1); } else { if ($this->totype == 'contact') { $contact = new Contact($this->db); $contact->fetch($this->toid); $out .= $contact->getNomUrl(1); } else { $out .= $this->toname; } } $out .= ' <' . $this->tomail . '>'; if ($this->withtofree) { $out .= '<br>' . $langs->trans("or") . ' <input size="' . (is_array($this->withto) ? "30" : "60") . '" id="sendto" name="sendto" value="' . (!is_array($this->withto) && !is_numeric($this->withto) ? isset($_REQUEST["sendto"]) ? $_REQUEST["sendto"] : $this->withto : "") . '" />'; } } else { $out .= !is_array($this->withto) && !is_numeric($this->withto) ? $this->withto : ""; } } else { if (!empty($this->withtofree)) { $out .= '<input size="' . (is_array($this->withto) ? "30" : "60") . '" id="sendto" name="sendto" value="' . (!is_array($this->withto) && !is_numeric($this->withto) ? isset($_REQUEST["sendto"]) ? $_REQUEST["sendto"] : $this->withto : "") . '" />'; } if (!empty($this->withto) && is_array($this->withto)) { if (!empty($this->withtofree)) { $out .= " " . $langs->trans("or") . " "; } $out .= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1); } if (isset($this->withtosocid) && $this->withtosocid > 0) { $liste = array(); $soc = new Societe($this->db); $soc->fetch($this->withtosocid); foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { $liste[$key] = $value; } if ($this->withtofree) { $out .= " " . $langs->trans("or") . " "; } $out .= $form->selectarray("receiver", $liste, GETPOST("receiver"), 1); } } $out .= "</td></tr>\n"; } // CC if (!empty($this->withtocc) || is_array($this->withtocc)) { $out .= '<tr><td width="180">'; $out .= $form->textwithpicto($langs->trans("MailCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); $out .= '</td><td>'; if ($this->withtoccreadonly) { $out .= !is_array($this->withtocc) && !is_numeric($this->withtocc) ? $this->withtocc : ""; } else { $out .= '<input size="' . (is_array($this->withtocc) ? "30" : "60") . '" id="sendtocc" name="sendtocc" value="' . (!is_array($this->withtocc) && !is_numeric($this->withtocc) ? isset($_POST["sendtocc"]) ? $_POST["sendtocc"] : $this->withtocc : (isset($_POST["sendtocc"]) ? $_POST["sendtocc"] : "")) . '" />'; if (!empty($this->withtocc) && is_array($this->withtocc)) { $out .= " " . $langs->trans("or") . " "; $out .= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1); } } $out .= "</td></tr>\n"; } // CCC if (!empty($this->withtoccc) || is_array($this->withtoccc)) { $out .= '<tr><td width="180">'; $out .= $form->textwithpicto($langs->trans("MailCCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); $out .= '</td><td>'; if (!empty($this->withtocccreadonly)) { $out .= !is_array($this->withtoccc) && !is_numeric($this->withtoccc) ? $this->withtoccc : ""; } else { $out .= '<input size="' . (is_array($this->withtoccc) ? "30" : "60") . '" id="sendtoccc" name="sendtoccc" value="' . (!is_array($this->withtoccc) && !is_numeric($this->withtoccc) ? isset($_POST["sendtoccc"]) ? $_POST["sendtoccc"] : $this->withtoccc : (isset($_POST["sendtoccc"]) ? $_POST["sendtoccc"] : "")) . '" />'; if (!empty($this->withtoccc) && is_array($this->withtoccc)) { $out .= " " . $langs->trans("or") . " "; $out .= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1); } } //if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1); $out .= "</td></tr>\n"; } // Ask delivery receipt if (!empty($this->withdeliveryreceipt)) { $out .= '<tr><td width="180">' . $langs->trans("DeliveryReceipt") . '</td><td>'; if (!empty($this->withdeliveryreceiptreadonly)) { $out .= yn($this->withdeliveryreceipt); } else { $out .= $form->selectyesno('deliveryreceipt', isset($_POST["deliveryreceipt"]) ? $_POST["deliveryreceipt"] : 0, 1); } $out .= "</td></tr>\n"; } // Topic if (!empty($this->withtopic)) { $this->withtopic = make_substitutions($this->withtopic, $this->substit); $out .= '<tr>'; $out .= '<td width="180">' . $langs->trans("MailTopic") . '</td>'; $out .= '<td>'; if ($this->withtopicreadonly) { $out .= $this->withtopic; $out .= '<input type="hidden" size="60" id="subject" name="subject" value="' . $this->withtopic . '" />'; } else { $out .= '<input type="text" size="60" id="subject" name="subject" value="' . (isset($_POST["subject"]) ? $_POST["subject"] : (is_numeric($this->withtopic) ? '' : $this->withtopic)) . '" />'; } $out .= "</td></tr>\n"; } // Attached files if (!empty($this->withfile)) { $out .= '<tr>'; $out .= '<td width="180">' . $langs->trans("MailFile") . '</td>'; $out .= '<td>'; if (is_numeric($this->withfile)) { // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript $out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">' . "\n"; $out .= '<script type="text/javascript" language="javascript">'; $out .= 'jQuery(document).ready(function () {'; $out .= ' jQuery(".removedfile").click(function() {'; $out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());'; $out .= ' });'; $out .= '})'; $out .= '</script>' . "\n"; if (count($listofpaths)) { foreach ($listofpaths as $key => $val) { $out .= '<div id="attachfile_' . $key . '">'; $out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key]; if (!$this->withfilereadonly) { $out .= ' <input type="image" style="border: 0px;" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/delete.png" value="' . ($key + 1) . '" class="removedfile" id="removedfile_' . $key . '" name="removedfile_' . $key . '" />'; //$out.= ' <a href="'.$_SERVER["PHP_SELF"].'?removedfile='.($key+1).' id="removedfile_'.$key.'">'.img_delete($langs->trans("Delete").'</a>'; } $out .= '<br></div>'; } } else { $out .= $langs->trans("NoAttachedFiles") . '<br>'; } if ($this->withfile == 2) { $out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="' . $langs->trans("Upload") . '" />'; $out .= ' '; $out .= '<input type="submit" class="button" id="' . $addfileaction . '" name="' . $addfileaction . '" value="' . $langs->trans("MailingAddFile") . '" />'; } } else { $out .= $this->withfile; } $out .= "</td></tr>\n"; } // Message if (!empty($this->withbody)) { $defaultmessage = ""; // TODO A partir du type, proposer liste de messages dans table llx_c_email_template if ($this->param["models"] == 'facture_send') { $defaultmessage = $langs->transnoentities("PredefinedMailContentSendInvoice"); } elseif ($this->param["models"] == 'facture_relance') { $defaultmessage = $langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } elseif ($this->param["models"] == 'propal_send') { $defaultmessage = $langs->transnoentities("PredefinedMailContentSendProposal"); } elseif ($this->param["models"] == 'order_send') { $defaultmessage = $langs->transnoentities("PredefinedMailContentSendOrder"); } elseif ($this->param["models"] == 'order_supplier_send') { $defaultmessage = $langs->transnoentities("PredefinedMailContentSendSupplierOrder"); } elseif ($this->param["models"] == 'invoice_supplier_send') { $defaultmessage = $langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } elseif ($this->param["models"] == 'shipping_send') { $defaultmessage = $langs->transnoentities("PredefinedMailContentSendShipping"); } elseif ($this->param["models"] == 'fichinter_send') { $defaultmessage = $langs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($this->param["models"] == 'thirdparty') { $defaultmessage = $langs->transnoentities("PredefinedMailContentThirdparty"); } elseif (!is_numeric($this->withbody)) { $defaultmessage = $this->withbody; } // Complete substitution array if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) { require_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; $langs->load('paypal'); if ($this->param["models"] == 'order_send') { $url = getPaypalPaymentUrl(0, 'order', $this->substit['__ORDERREF__']); $this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url)); } if ($this->param["models"] == 'facture_send') { $url = getPaypalPaymentUrl(0, 'invoice', $this->substit['__FACREF__']); $this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url)); } } $defaultmessage = str_replace('\\n', "\n", $defaultmessage); // Deal with format differences between message and signature (text / HTML) if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) { $this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']); } else { if (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); } } if (isset($_POST["message"])) { $defaultmessage = $_POST["message"]; } else { $defaultmessage = make_substitutions($defaultmessage, $this->substit); // Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty) $defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage); $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage); } $out .= '<tr>'; $out .= '<td width="180" valign="top">' . $langs->trans("MailText") . '</td>'; $out .= '<td>'; if ($this->withbodyreadonly) { $out .= nl2br($defaultmessage); $out .= '<input type="hidden" id="message" name="message" value="' . $defaultmessage . '" />'; } else { if (!isset($this->ckeditortoolbar)) { $this->ckeditortoolbar = 'dolibarr_notes'; } // Editor wysiwyg require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; if ($this->withfckeditor == -1) { if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $this->withfckeditor = 1; } else { $this->withfckeditor = 0; } } $doleditor = new DolEditor('message', $defaultmessage, '', 280, $this->ckeditortoolbar, 'In', true, true, $this->withfckeditor, 8, 72); $out .= $doleditor->Create(1); } $out .= "</td></tr>\n"; } if ($this->withform == 1 || $this->withform == -1) { $out .= '<tr><td align="center" colspan="2"><center>'; $out .= '<input class="button" type="submit" id="sendmail" name="sendmail" value="' . $langs->trans("SendMail") . '"'; // Add a javascript test to avoid to forget to submit file before sending email if ($this->withfile == 2 && $conf->use_javascript_ajax) { $out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\'' . dol_escape_js($langs->trans("FileWasNotUploaded")) . '\'); return false; } else { return true; }"'; } $out .= ' />'; if ($this->withcancel) { $out .= ' '; $out .= '<input class="button" type="submit" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '" />'; } $out .= '</center></td></tr>' . "\n"; } $out .= '</table>' . "\n"; if ($this->withform == 1) { $out .= '</form>' . "\n"; } $out .= "<!-- Fin form mail -->\n"; return $out; } }
$restrictviewformytask = empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED) ? 1 : 0; if (count($tasksarray) > 0) { $j = 0; projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse); } else { print '<tr><td colspan="10">' . $langs->trans("NoTasks") . '</td></tr>'; } print "</table>"; dol_fiche_end(); print '<div class="center">'; print '<input type="submit" class="button"' . ($disabledtask ? ' disabled' : '') . ' value="' . $langs->trans("Save") . '">'; print '</div>'; print '</form>'; print '<script type="text/javascript">'; print "jQuery(document).ready(function () {\n"; print ' jQuery(".timesheetalreadyrecorded").tipTip({ maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50, content: \'' . dol_escape_js($langs->trans("TimeAlreadyRecorded", $user->getFullName($langs))) . '\'});'; print "});"; print '</script>'; // Add a new project/task print '<br>'; print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; print '<input type="hidden" name="action" value="assign">'; print '<input type="hidden" name="mode" value="' . $mode . '">'; print '<input type="hidden" name="year" value="' . $year . '">'; print '<input type="hidden" name="month" value="' . $month . '">'; print '<input type="hidden" name="day" value="' . $day . '">'; print $langs->trans("AssignTaskToMe") . '<br>'; $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, 1, 1); print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0); print '<input type="submit" class="button" name="submit" value="' . $langs->trans("AssignTask") . '">'; print '</form>';
$nbtotal = $obj->nb; } else { dol_print_error($db); } print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")) . '<br>' . "\n"; print '<br><input class="button" type="submit" id="submitformbarcodethirdpartygen" ' . (GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode") ? '' : 'disabled ') . 'value="' . $langs->trans("InitEmptyBarCode", $nbno) . '"'; print ' title="' . dol_escape_htmltag($langs->trans("FeatureNotYetAvailable")) . '" disabled'; print '>'; print '<br><br><br><br>'; } // For products if ($conf->product->enabled || $conf->product->service) { // Example 1 : Adding jquery code print '<script type="text/javascript" language="javascript"> function confirm_erase() { return confirm("' . dol_escape_js($langs->trans("ConfirmEraseAllCurrentBarCode")) . '"); } </script>'; $nbno = $nbtotal = 0; print load_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"), '', 'object_product'); print '<br>' . "\n"; $sql = "SELECT count(rowid) as nb, fk_product_type, datec"; $sql .= " FROM " . MAIN_DB_PREFIX . "product"; $sql .= " WHERE barcode IS NULL OR barcode = ''"; $sql .= " GROUP BY fk_product_type, datec"; $sql .= " ORDER BY datec"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; while ($i < $num) {
/** * Build a graph onto disk using JFlot library * $graph_data = array(array('labelxA',yA),array('labelxB',yB)); * $graph_data = array(array('labelxA',yA1,...,yAn),array('labelxB',yB1,...yBn)); // when there is n value to show for each x * $legend = array("Val1",...,"Valn"); // list of n series name * * @param string $file Image file name to use if we save onto disk * @param string $fileurl Url path to show image if saved onto disk * @return void */ private function draw_jflot($file, $fileurl) { global $artichow_defaultfont; dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type)); // On boucle sur chaque lot de donnees $legends = array(); $nblot = count($this->data[0]) - 1; // -1 to remove legend $firstlot = 0; if ($nblot > 2) { $firstlot = $nblot - 2; } // We limit nblot to 2 because jflot can't manage more than 2 bars on same x $i = $firstlot; $serie = array(); while ($i < $nblot) { $x = 0; $values = array(); foreach ($this->data as $key => $valarray) { $legends[$x] = $valarray[0]; $values[$x] = $valarray[$i + 1]; $x++; } // We fix unknown values to null $newvalues = array(); foreach ($values as $val) { $newvalues[] = is_numeric($val) ? $val : null; } //print "Lot de donnees $i<br>"; //print_r($values); //print '<br>'; $serie[$i] = "var d" . $i . " = [];\n"; $x = 0; foreach ($newvalues as $key => $val) { if (isset($val)) { $serie[$i] .= "d" . $i . ".push([" . $x . ", " . $val . "]);\n"; } $x++; } $i++; } $tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.')))); $this->_stringtoshow = '<!-- Build using ' . $this->_library . ' -->' . "\n"; $this->_stringtoshow .= '<br><div align="center">' . $this->title . '</div><br>'; $this->_stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;"></div>' . "\n"; $this->_stringtoshow .= '<script id="' . $tag . '">' . "\n"; $this->_stringtoshow .= '$(function () {' . "\n"; $i = $firstlot; while ($i < $nblot) { $this->_stringtoshow .= $serie[$i]; $i++; } $this->_stringtoshow .= "\n"; $this->_stringtoshow .= ' function showTooltip_' . $tag . '(x, y, contents) { $(\'<div id="tooltip_' . $tag . '">\' + contents + \'</div>\').css( { position: \'absolute\', display: \'none\', top: y + 5, left: x + 5, border: \'1px solid #ddd\', padding: \'2px\', \'background-color\': \'#ffe\', width: 200, opacity: 0.80 }).appendTo("body").fadeIn(20); } var previousPoint = null; $("#placeholder_' . $tag . '").bind("plothover", function (event, pos, item) { $("#x").text(pos.x.toFixed(2)); $("#y").text(pos.y.toFixed(2)); if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; $("#tooltip").remove(); /* console.log(item); */ var x = item.datapoint[0].toFixed(2); var y = item.datapoint[1].toFixed(2); var z = item.series.xaxis.ticks[item.dataIndex].label; showTooltip_' . $tag . '(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y); } } else { $("#tooltip_' . $tag . '").remove(); previousPoint = null; } }); '; $this->_stringtoshow .= 'var stack = null, steps = false;' . "\n"; $this->_stringtoshow .= 'function plotWithOptions_' . $tag . '() {' . "\n"; $this->_stringtoshow .= '$.plot($("#placeholder_' . $tag . '"), [ ' . "\n"; $i = $firstlot; while ($i < $nblot) { if ($i > $firstlot) { $this->_stringtoshow .= ', ' . "\n"; } $color = sprintf("%02x%02x%02x", $this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]); $this->_stringtoshow .= '{ '; if (!isset($this->type[$i]) || $this->type[$i] == 'bars') { $this->_stringtoshow .= 'bars: { show: true, align: "' . ($i == $firstlot ? 'center' : 'left') . '", barWidth: 0.5 }, '; } if (isset($this->type[$i]) && $this->type[$i] == 'lines') { $this->_stringtoshow .= 'lines: { show: true, fill: false }, '; } $this->_stringtoshow .= 'color: "#' . $color . '", label: "' . (isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '') . '", data: d' . $i . ' }'; $i++; } $this->_stringtoshow .= "\n" . ' ], { series: { stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }' . "\n"; // Xaxis $this->_stringtoshow .= ', xaxis: { ticks: [' . "\n"; $x = 0; foreach ($this->data as $key => $valarray) { if ($x > 0) { $this->_stringtoshow .= ', ' . "\n"; } $this->_stringtoshow .= ' [' . $x . ', "' . $valarray[0] . '"]'; $x++; } $this->_stringtoshow .= '] }' . "\n"; // Yaxis $this->_stringtoshow .= ', yaxis: { min: ' . $this->MinValue . ', max: ' . $this->MaxValue . ' }' . "\n"; // Background color $color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]); $color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]); $this->_stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] } }' . "\n"; //$this->_stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this $this->_stringtoshow .= '});' . "\n"; $this->_stringtoshow .= '}' . "\n"; $this->_stringtoshow .= 'plotWithOptions_' . $tag . '();' . "\n"; $this->_stringtoshow .= '});' . "\n"; $this->_stringtoshow .= '</script>' . "\n"; }
/** * Add a gant chart line * * @param string $tarr tarr * @param Task $task Task object * @param Project $project_dependencies Project object * @param int $level Level * @param int $project_id Id of project * @return void */ function constructGanttLine($tarr, $task, $project_dependencies, $level = 0, $project_id = null) { $start_date = $task["task_start_date"]; $end_date = $task["task_end_date"]; if (!$end_date) { $end_date = $start_date; } $start_date = dol_print_date($start_date, "%m/%d/%Y"); $end_date = dol_print_date($end_date, "%m/%d/%Y"); // Resources $resources = $task["task_resources"]; // Define depend (ex: "", "4,13", ...) $depend = "\""; $count = 0; foreach ($project_dependencies as $value) { // Not yet used project_dependencies = array(array(0=>idtask,1=>idtasktofinishfisrt)) if ($value[0] == $task['task_id']) { $depend .= ($count > 0 ? "," : "") . $value[1]; $count++; } } $depend .= "\""; // Define parent if ($project_id && $level < 0) { $parent = 'p' . $project_id; } else { $parent = $task["task_parent"]; } // Define percent $percent = $task['task_percent_complete'] ? $task['task_percent_complete'] : 0; // Link $link = DOL_URL_ROOT . '/projet/tasks/task.php?withproject=1&id=' . $task["task_id"]; // Name $name = $task['task_name']; for ($i = 0; $i < $level; $i++) { $name = ' ' . $name; } // Add line to gantt $s = "// Add taks id=" . $task["task_id"] . " level = " . $level . "\n"; $s = "g.AddTaskItem(new JSGantt.TaskItem(" . $task['task_id'] . ",'" . dol_escape_js($name) . "','" . $start_date . "', '" . $end_date . "', '" . $task['task_color'] . "', '" . $link . "', " . $task['task_milestone'] . ", '" . $resources . "', " . $percent . ", " . ($task["task_is_group"] > 0 ? 1 : 0) . ", '" . $parent . "', 1, '" . ($depend ? $depend : "") . "'));"; echo $s . "\n"; }
/** * Return full address of contact * * @param string $htmlkey HTML id to make banner content unique * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) * @return string Full address string */ function getBannerAddress($htmlkey, $object) { global $conf, $langs; $countriesusingstate = array('AU', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); $contactid = 0; $thirdpartyid = 0; if ($this->element == 'societe') { $thirdpartyid = $this->id; } if ($this->element == 'contact') { $contactid = $this->id; $thirdpartyid = $object->fk_soc; } if ($this->element == 'user') { $contactid = $this->contact_id; $thirdpartyid = $object->fk_soc; } $out = '<!-- BEGIN part to show address block -->'; $outdone = 0; $coords = $this->getFullAddress(1, ', '); if ($coords) { if (!empty($conf->use_javascript_ajax)) { $namecoords = $this->getFullName($langs, 1) . '<br>' . $coords; // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile $out .= '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\'' . dol_escape_js($namecoords) . '\',\'' . dol_escape_js($langs->trans("HelpCopyToClipboard")) . '\');">'; $out .= img_picto($langs->trans("Address"), 'object_address.png'); $out .= '</a> '; } $out .= dol_print_address($coords, 'address_' . $htmlkey . '_' . $this->id, $this->element, $this->id, 1); $outdone++; $outdone++; } if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) && !empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) { $out .= ($outdone ? '<br>' : '') . $this->state; $outdone++; } if (!empty($this->phone_pro) || !empty($this->phone_mobile) || !empty($this->phone_perso) || !empty($this->fax) || !empty($this->office_phone) || !empty($this->user_mobile) || !empty($this->office_fax)) { $out .= $outdone ? '<br>' : ''; } if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; } if (!empty($this->phone_pro)) { $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; } if (!empty($this->phone_mobile)) { $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhoneMobile")); $outdone++; } if (!empty($this->phone_perso)) { $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso")); $outdone++; } if (!empty($this->fax)) { $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax")); $outdone++; } if (!empty($this->office_phone)) { $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; } if (!empty($this->user_mobile)) { $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhoneMobile")); $outdone++; } if (!empty($this->office_fax)) { $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax")); $outdone++; } $out .= '<div style="clear: both;"></div>'; $outdone = 0; if (!empty($this->email)) { $out .= dol_print_email($this->email, $this->id, $object->id, 'AC_EMAIL', 0, 0, 1); $outdone++; } if (!empty($this->url)) { $out .= dol_print_url($this->url, '', 0, 1); $outdone++; } if (!empty($conf->skype->enabled)) { $out .= '<div style="clear: both;"></div>'; if ($this->skype) { $out .= dol_print_skype($this->skype, $this->id, $object->id, 'AC_SKYPE'); } $outdone++; } $out .= '<!-- END Part to show address block -->'; return $out; }
/** * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action * @param integer $id Id of object * @param string $ref Ref of object * @return void */ function assign_values(&$action, $id = 0, $ref = '') { global $conf, $langs, $user, $mysoc; global $form, $formadmin, $formcompany; $ret = $this->getObject($id, $ref); parent::assign_values($action); $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); $this->tpl['profid1'] = $this->object->idprof1; $this->tpl['profid2'] = $this->object->idprof2; $this->tpl['profid3'] = $this->object->idprof3; $this->tpl['profid4'] = $this->object->idprof4; if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) { $js = "\n"; $js .= '<script language="JavaScript" type="text/javascript">'; $js .= "function CheckVAT(a) {\n"; $js .= "newpopup('" . DOL_URL_ROOT . "/societe/checkvat/checkVatPopup.php?vatNumber='+a,'" . dol_escape_js($langs->trans("VATIntraCheckableOnEUSite")) . "',500,230);\n"; $js .= "}\n"; $js .= '</script>'; $js .= "\n"; $this->tpl['js_checkVatPopup'] = $js; } if ($action == 'create' || $action == 'edit') { for ($i = 1; $i <= 4; $i++) { $this->tpl['langprofid' . $i] = $langs->transcountry('ProfId' . $i, $this->object->country_code); $this->tpl['showprofid' . $i] = $formcompany->get_input_id_prof($i, 'idprof' . $i, $this->tpl['profid' . $i], $this->object->country_code); } // Type $this->tpl['select_companytype'] = $form->selectarray("typent_id", $formcompany->typent_array(0), $this->object->typent_id); // Juridical Status $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code, $this->object->country_code); // Workforce $this->tpl['select_workforce'] = $form->selectarray("effectif_id", $formcompany->effectif_array(0), $this->object->effectif_id); // VAT intra $s = '<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="' . $this->object->tva_intra . '">'; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { $s .= ' '; if ($conf->use_javascript_ajax) { $s .= '<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">' . $langs->trans("VATIntraCheck") . '</a>'; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); } else { $this->tpl['tva_intra'] = $s . '<a href="' . $langs->transcountry("VATIntraCheckURL", $this->object->country_id) . '" target="_blank">' . img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help') . '</a>'; } } else { $this->tpl['tva_intra'] = $s; } } else { // Confirm delete third party if ($action == 'delete') { $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . $this->object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "1,action-delete"); } for ($i = 1; $i <= 4; $i++) { $this->tpl['langprofid' . $i] = $langs->transcountry('ProfId' . $i, $this->object->country_code); $this->tpl['checkprofid' . $i] = $this->object->id_prof_check($i, $this->object); $this->tpl['urlprofid' . $i] = $this->object->id_prof_url($i, $this->object); } // TVA intra if ($this->object->tva_intra) { $s = $this->object->tva_intra; $s .= '<input type="hidden" name="tva_intra" size="12" maxlength="20" value="' . $this->object->tva_intra . '">'; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { $s .= ' '; if ($conf->use_javascript_ajax) { $s .= '<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">' . $langs->trans("VATIntraCheck") . '</a>'; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); } else { $this->tpl['tva_intra'] = $s . '<a href="' . $langs->transcountry("VATIntraCheckURL", $this->object->country_id) . '" target="_blank">' . img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help') . '</a>'; } } else { $this->tpl['tva_intra'] = $s; } } else { $this->tpl['tva_intra'] = ' '; } // Parent company if ($this->object->parent) { $socm = new Societe($this->db); $socm->fetch($this->object->parent); $this->tpl['parent_company'] = $socm->getNomUrl(1) . ' ' . ($socm->code_client ? "(" . $socm->code_client . ")" : ""); $this->tpl['parent_company'] .= $socm->town ? ' - ' . $socm->town : ''; } else { $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); } } }
/** * Show a confirmation HTML form or AJAX popup * @param page Url of page to call if confirmation is OK * @param title title * @param question question * @param action action * @param formquestion an array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) * @param selectedchoice "" or "no" or "yes" * @param useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No * @param height Force height of box * @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form */ function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) { global $langs, $conf; $more = ''; $formconfirm = ''; $inputarray = array(); if ($formquestion) { $more .= '<table class="nobordernopadding" width="100%">' . "\n"; $more .= '<tr><td colspan="3" valign="top">' . $formquestion['text'] . '</td></tr>' . "\n"; foreach ($formquestion as $key => $input) { if (is_array($input)) { if ($input['type'] == 'text') { $more .= '<tr><td valign="top">' . $input['label'] . '</td><td valign="top" colspan="2" align="left"><input type="text" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '" size="' . $input['size'] . '" value="' . $input['value'] . '" /></td></tr>' . "\n"; } else { if ($input['type'] == 'password') { $more .= '<tr><td valign="top">' . $input['label'] . '</td><td valign="top" colspan="2" align="left"><input type="password" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '" size="' . $input['size'] . '" value="' . $input['value'] . '" /></td></tr>' . "\n"; } else { if ($input['type'] == 'select') { $more .= '<tr><td valign="top">'; if (!empty($input['label'])) { $more .= $input['label'] . '</td><td valign="top" colspan="2" align="left">'; } $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1); $more .= '</td></tr>' . "\n"; } else { if ($input['type'] == 'checkbox') { $more .= '<tr>'; $more .= '<td valign="top">' . $input['label'] . ' </td><td valign="top" align="left">'; $more .= '<input type="checkbox" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '"'; if (!is_bool($input['value']) && $input['value'] != 'false') { $more .= ' checked="true"'; } if (is_bool($input['value']) && $input['value']) { $more .= ' checked="true"'; } if ($input['disabled']) { $more .= ' disabled="true"'; } $more .= ' /></td>'; $more .= '<td valign="top" align="left"> </td>'; $more .= '</tr>' . "\n"; } else { if ($input['type'] == 'radio') { $i = 0; foreach ($input['values'] as $selkey => $selval) { $more .= '<tr>'; if ($i == 0) { $more .= '<td valign="top">' . $input['label'] . '</td>'; } else { $more .= '<td> </td>'; } $more .= '<td valign="top" width="20"><input type="radio" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . $selkey . '"'; if ($input['disabled']) { $more .= ' disabled="true"'; } $more .= ' /></td>'; $more .= '<td valign="top" align="left">'; $more .= $selval; $more .= '</td></tr>' . "\n"; $i++; } } else { if ($input['type'] == 'other') { $more .= '<tr><td valign="top">'; if (!empty($input['label'])) { $more .= $input['label'] . '</td><td valign="top" colspan="2" align="left">'; } $more .= $input['value']; $more .= '</td></tr>' . "\n"; } } } } } } array_push($inputarray, $input['name']); } } $more .= '</table>' . "\n"; } $formconfirm .= "\n<!-- begin form_confirm -->\n"; if ($useajax && $conf->use_javascript_ajax) { $autoOpen = true; $dialogconfirm = 'dialog-confirm'; if (!is_int($useajax)) { $button = $useajax; $useajax = 1; $autoOpen = false; $dialogconfirm .= '-' . $button; } $pageyes = $page . '&action=' . $action . '&confirm=yes'; $pageno = $useajax == 2 ? $page . '&confirm=no' : ''; // New code using jQuery only $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; if (!empty($more)) { $formconfirm .= '<p>' . $more . '</p>'; } $formconfirm .= img_help('', '') . ' ' . $question; $formconfirm .= '</div>' . "\n"; $formconfirm .= '<script type="text/javascript"> $(function() { var choice=\'ko\'; var $inputarray=' . json_encode($inputarray) . '; var button=\'' . $button . '\'; var dialogconfirm=\'' . $dialogconfirm . '\'; $( "#" + dialogconfirm ).dialog({ autoOpen: ' . ($autoOpen ? 'true' : 'false') . ', resizable: false, height:' . $height . ', width:' . $width . ', modal: true, closeOnEscape: false, close: function(event, ui) { if (choice == \'ok\') { var options=""; if ($inputarray.length>0) { $.each($inputarray, function() { var inputname = this; var inputvalue = $("#" + this).val(); options += \'&\' + inputname + \'=\' + inputvalue; }); //alert( options ); } location.href=\'' . $pageyes . '\' + options; } ' . ($pageno ? 'if (choice == \'ko\') location.href=\'' . $pageno . '\';' : '') . ' }, buttons: { \'' . dol_escape_js($langs->transnoentities("Yes")) . '\': function() { choice=\'ok\'; $(this).dialog(\'close\'); }, \'' . dol_escape_js($langs->transnoentities("No")) . '\': function() { choice=\'ko\'; $(this).dialog(\'close\'); } } }); if (button.length > 0) { $( "#" + button ).click(function() { $( "#" + dialogconfirm ).dialog( \'open\' ); }); } }); </script>'; $formconfirm .= "\n"; } else { $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">'; $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n"; $formconfirm .= '<table width="100%" class="valid">' . "\n"; // Ligne titre $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">' . img_picto('', 'recent') . ' ' . $title . '</td></tr>' . "\n"; // Ligne formulaire if ($more) { $formconfirm .= '<tr class="valid"><td class="valid" colspan="3">' . "\n"; $formconfirm .= $more; $formconfirm .= '</td></tr>' . "\n"; } // Ligne message $formconfirm .= '<tr class="valid">'; $formconfirm .= '<td class="valid">' . $question . '</td>'; $formconfirm .= '<td class="valid">'; $newselectedchoice = empty($selectedchoice) ? "no" : $selectedchoice; $formconfirm .= $this->selectyesno("confirm", $newselectedchoice); $formconfirm .= '</td>'; $formconfirm .= '<td class="valid" align="center"><input class="button" type="submit" value="' . $langs->trans("Validate") . '"></td>'; $formconfirm .= '</tr>' . "\n"; $formconfirm .= '</table>' . "\n"; if (is_array($formquestion)) { foreach ($formquestion as $key => $input) { if ($input['type'] == 'hidden') { $formconfirm .= '<input type="hidden" name="' . $input['name'] . '" value="' . $input['value'] . '">'; } } } $formconfirm .= "</form>\n"; $formconfirm .= '<br>'; } $formconfirm .= "<!-- end form_confirm -->\n"; return $formconfirm; }
/** * Show html area for list of contacts * * @param Conf $conf Object conf * @param Translate $langs Object langs * @param DoliDB $db Database handler * @param Object $object Third party object * @param string $backtopage Url to go once contact is created * @return void */ function show_contacts($conf, $langs, $db, $object, $backtopage = '') { global $user, $conf; global $bc; $form = new Form($db); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $search_status = GETPOST("search_status", 'int'); if ($search_status == '') { $search_status = 1; } // always display activ customer first $search_name = GETPOST("search_name", 'alpha'); if (!$sortorder) { $sortorder = "ASC"; } if (!$sortfield) { $sortfield = "p.lastname"; } $i = -1; $contactstatic = new Contact($db); if (!empty($conf->clicktodial->enabled)) { $user->fetch_clicktodial(); // lecture des infos de clicktodial } $buttoncreate = ''; if ($user->rights->societe->contact->creer) { $addcontact = !empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"); $buttoncreate = '<a class="addnewrecord" href="' . DOL_URL_ROOT . '/contact/fiche.php?socid=' . $object->id . '&action=create&backtopage=' . urlencode($backtopage) . '">' . $addcontact; if (empty($conf->dol_optimize_smallscreen)) { $buttoncreate .= ' ' . img_picto($addcontact, 'filenew'); } $buttoncreate .= '</a>' . "\n"; } print "\n"; $title = !empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany"); print_fiche_titre($title, $buttoncreate, ''); print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '" name="formfilter">'; print '<input type="hidden" name="socid" value="' . $object->id . '">'; print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; print "\n" . '<table class="noborder" width="100%">' . "\n"; $param = "socid=" . $object->id; if ($search_status != '') { $param .= '&search_status=' . $search_status; } if ($search_name != '') { $param .= '&search_name=' . urlencode($search_name); } $colspan = 9; print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Name"), $_SERVER["PHP_SELF"], "p.lastname", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Poste"), $_SERVER["PHP_SELF"], "p.poste", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("PhonePro"), $_SERVER["PHP_SELF"], "p.phone", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("PhoneMobile"), $_SERVER["PHP_SELF"], "p.phone_mobile", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Fax"), $_SERVER["PHP_SELF"], "p.fax", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("EMail"), $_SERVER["PHP_SELF"], "p.email", "", $param, '', $sortfield, $sortorder); if (!empty($conf->skype->enabled)) { $colspan++; print '<td>' . $langs->trans("Skype") . '</td>'; } print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "p.statut", "", $param, '', $sortfield, $sortorder); // Copy to clipboard print "<td> </td>"; // Add to agenda if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) { $colspan++; print '<td> </td>'; } // Edit print '<td> </td>'; print "</tr>"; print '<tr class="liste_titre">'; print '<td class="liste_titre">'; print '<input type="text" class="flat" name="search_name" size="20" value="' . $search_name . '">'; print '</td>'; print '<td> </td>'; print '<td> </td>'; print '<td> </td>'; print '<td> </td>'; print '<td> </td>'; if (!empty($conf->skype->enabled)) { $colspan++; print '<td> </td>'; } // Status print '<td class="liste_titre maxwidthonsmartphone">'; print $form->selectarray('search_status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $search_status); print '</td>'; // Copy to clipboard print "<td> </td>"; // Add to agenda if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; print '<td> </td>'; } // Edit print '<td class="liste_titre" align="right">'; print '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print '</td>'; print "</tr>"; $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut "; $sql .= ", p.civilite as civility_id, p.address, p.zip, p.town"; $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as p"; $sql .= " WHERE p.fk_soc = " . $object->id; if ($search_status != '') { $sql .= " AND p.statut = " . $db->escape($search_status); } if ($search_name) { $sql .= " AND (p.lastname LIKE '%" . $db->escape($search_name) . "%' OR p.firstname LIKE '%" . $db->escape($search_name) . "%')"; } $sql .= " ORDER BY {$sortfield} {$sortorder}"; dol_syslog('core/lib/company.lib.php :: show_contacts sql=' . $sql, LOG_DEBUG); $result = $db->query($sql); $num = $db->num_rows($result); $var = true; if ($num) { $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); $var = !$var; print "<tr " . $bc[$var] . ">"; print '<td>'; $contactstatic->id = $obj->rowid; $contactstatic->statut = $obj->statut; $contactstatic->lastname = $obj->lastname; $contactstatic->firstname = $obj->firstname; $contactstatic->civility_id = $obj->civility_id; print $contactstatic->getNomUrl(1); print '</td>'; print '<td>' . $obj->poste . '</td>'; $country_code = getCountry($obj->country_id, 'all'); // Lien click to dial print '<td>'; print dol_print_phone($obj->phone, $country_code['code'], $obj->rowid, $object->id, 'AC_TEL'); print '</td>'; print '<td>'; print dol_print_phone($obj->phone_mobile, $country_code['code'], $obj->rowid, $object->id, 'AC_TEL'); print '</td>'; print '<td>'; print dol_print_phone($obj->fax, $country_code['code'], $obj->rowid, $object->id, 'AC_FAX'); print '</td>'; print '<td>'; print dol_print_email($obj->email, $obj->rowid, $object->id, 'AC_EMAIL'); print '</td>'; if (!empty($conf->skype->enabled)) { print '<td>'; print dol_print_skype($obj->skype, $obj->rowid, $object->id, 'AC_SKYPE'); print '</td>'; } // Status print '<td>' . $contactstatic->getLibStatut(5) . '</td>'; print '<td align="center">'; if (!empty($conf->use_javascript_ajax)) { // Copy to clipboard $coords = ''; if (!empty($object->name)) { $coords .= $object->name . "<br>"; } $coords .= $contactstatic->getFullName($langs, 1) . ' '; $coords .= "<br>"; if (!empty($obj->address)) { $coords .= dol_nl2br($obj->address, 1, true) . "<br>"; if (!empty($obj->zip)) { $coords .= $obj->zip . ' '; } if (!empty($obj->town)) { $coords .= $obj->town; } if (!empty($obj->country_id)) { $coords .= "<br>" . $country_code['label']; } } else { if (!empty($object->address)) { $coords .= dol_nl2br($object->address, 1, true) . "<br>"; if (!empty($object->zip)) { $coords .= $object->zip . ' '; } if (!empty($object->town)) { $coords .= $object->town; } if (!empty($object->country_id)) { $coords .= "<br>" . $country_code['label']; } } } // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile print '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\'' . dol_escape_js($coords) . '\',\'' . dol_escape_js($langs->trans("HelpCopyToClipboard")) . '\');">'; print img_picto($langs->trans("Address"), 'object_address.png'); print '</a>'; } print '</td>'; // Add to agenda if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print '<td align="center">'; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print '<a class="hideonsmartphone" href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create&actioncode=AC_RDV&contactid=' . $obj->rowid . '&socid=' . $object->id . '&backtopage=' . urlencode($backtopage) . '">'; print img_object($langs->trans("Rendez-Vous"), "action_rdv"); print '</a> '; } print '<a href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create&actioncode=&contactid=' . $obj->rowid . '&socid=' . $object->id . '&backtopage=' . urlencode($backtopage) . '">'; print img_object($langs->trans("Event"), "action"); print '</a></td>'; } // Edit if ($user->rights->societe->contact->creer) { print '<td align="right">'; print '<a href="' . DOL_URL_ROOT . '/contact/fiche.php?action=edit&id=' . $obj->rowid . '&backtopage=' . urlencode($backtopage) . '">'; print img_edit(); print '</a></td>'; } else { print '<td> </td>'; } print "</tr>\n"; $i++; } } else { print "<tr " . $bc[$var] . ">"; print '<td colspan="' . $colspan . '">' . $langs->trans("None") . '</td>'; print "</tr>\n"; } print "\n</table>\n"; print '</form>' . "\n"; print "<br>\n"; ?> <div id="dialog" title="<?php echo dol_escape_htmltag($langs->trans('Address')); ?> " style="display: none;"></div> <?php return $i; }
/** * Output a HTML code to select a color * @param set_color Pre-selected color * @param prefix Name of HTML field * @param form_name Name of form * @param showcolorbox 1=Show color code and color box, 0=Show only color code * @param arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') */ function select_color($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='') { global $langs; if (! is_array($arrayofcolors) || sizeof($arrayofcolors) < 1) { $langs->load("other"); print '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />'; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>'; print '<script type="text/javascript"> jQuery(document).ready(function(){ $(\'#colorpicker'.$prefix.'\').jPicker( { window: { title: \''.dol_escape_js($langs->trans("SelectAColor")).'\', /* any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null */ effects: { type: \'show\', /* effect used to show/hide an expandable picker. Acceptable values "slide", "show", "fade" */ speed: { show: \'fast\', /* duration of "show" effect. Acceptable values are "fast", "slow", or time in ms */ hide: \'fast\' /* duration of "hide" effect. Acceptable values are "fast", "slow", or time in ms */ } }, position: { x: \'screenCenter\', /* acceptable values "left", "center", "right", "screenCenter", or relative px value */ y: \'center\' /* acceptable values "top", "bottom", "center", or relative px value */ }, }, images: { clientPath: \''.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/images/\', picker: { file: \'../../../../../theme/common/colorpicker.png\', width: 14, height: 14 } }, localization: // alter these to change the text presented by the picker (e.g. different language) { text: { title: \''.dol_escape_js($langs->trans("SelectAColor")).'\', newColor: \''.dol_escape_js($langs->trans("New")).'\', currentColor: \''.dol_escape_js($langs->trans("Current")).'\', ok: \''.dol_escape_js($langs->trans("Change")).'\', cancel: \''.dol_escape_js($langs->trans("Cancel")).'\' } } } ); }); </script>'; print '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat" type="text" value="'.$set_color.'" />'; /* // No list of colors forced, we can suggest any color print "\n".'<table class="nobordernopadding"><tr><td valign="middle">'; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_colorpicker.js"></script>'."\n"; print '<script type="text/javascript"> window.onload = function() { fctLoad(); } window.onscroll = function() { fctShow(); } window.onresize = function() { fctShow(); } </script>'."\n"; print '<input type="text" size="10" name="'.$prefix.'" value="'.$set_color.'" maxlength="7" class="flat">'."\n"; print '</td><td valign="middle">'; print '<img src="'.DOL_URL_ROOT.'/theme/common/colorpicker.png" width="21" height="18" border="0" onClick="fctShow(document.'.$form_name.'.'.$prefix.');" style="cursor:pointer;">'."\n"; print '</td>'; if ($showcolorbox) { print '<td style="padding-left: 4px" nowrap="nowrap">'; print '<!-- Box color '.$set_color.' -->'; print '<table style="border-collapse: collapse; margin:0px; padding: 0px; border: 1px solid #888888; background: #'.(preg_replace('/#/','',$set_color)).';" width="12" height="10">'; print '<tr class="nocellnopadd"><td></td></tr>'; print '</table>'; print '</td>'; } print '</tr></table>'; */ } else // In most cases, this is not used. We used instead function with no specific list of colors { print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />'; print '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>'; print '<script type="text/javascript"> jQuery(document).ready(function(){ jQuery(\'#colorpicker'.$prefix.'\').colorpicker({ size: 14, label: \'\', hide: true }); }); </script>'; print '<select id="colorpicker'.$prefix.'" class="flat" name="'.$prefix.'">'; //print '<option value="-1"> </option>'; foreach ($arrayofcolors as $val) { print '<option value="'.$val.'"'; if ($set_color == $val) print ' selected="selected"'; print '>'.$val.'</option>'; } print '</select>'; } }
?> <!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php --> <!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ --> <script type="text/javascript"> <?php $openeddir = '/'; ?> $(document).ready(function() { $('#filetree').fileTree({ root: '<?php print dol_escape_js($openeddir); ?> ', // Ajax called if we click to expand a dir (not a file). Parameter of dir is provided as a POST parameter. script: '<?php echo DOL_URL_ROOT . '/core/ajax/ajaxdirtree.php?modulepart=ecm&openeddir=' . urlencode($openeddir); ?> ', folderEvent: 'click', // 'dblclick' multiFolder: false }, // Called if we click on a file (not a dir) function(file) { $("#mesg").hide(); loadandshowpreview(file,0); }, // Called if we click on a dir (not a file)
/** * Output a HTML code to select a color. Field will return an hexa color like '334455'. * * @param string $set_color Pre-selected color * @param string $prefix Name of HTML field * @param string $form_name Deprecated. Not used. * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @param string $morecss Add css style into input field * @return string * @see showColor */ static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '') { // Deprecation warning if ($form_name) { dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING); } global $langs, $conf; $out = ''; if (!is_array($arrayofcolors) || count($arrayofcolors) < 1) { $langs->load("other"); if (empty($conf->dol_use_jmobile)) { $out .= '<link rel="stylesheet" media="screen" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />'; $out .= '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>'; $out .= '<script type="text/javascript"> jQuery(document).ready(function(){ $(\'#colorpicker' . $prefix . '\').jPicker( { window: { title: \'' . dol_escape_js($langs->trans("SelectAColor")) . '\', /* any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null */ effects: { type: \'show\', /* effect used to show/hide an expandable picker. Acceptable values "slide", "show", "fade" */ speed: { show: \'fast\', /* duration of "show" effect. Acceptable values are "fast", "slow", or time in ms */ hide: \'fast\' /* duration of "hide" effect. Acceptable values are "fast", "slow", or time in ms */ } }, position: { x: \'screenCenter\', /* acceptable values "left", "center", "right", "screenCenter", or relative px value */ y: \'center\' /* acceptable values "top", "bottom", "center", or relative px value */ }, }, images: { clientPath: \'' . DOL_URL_ROOT . '/includes/jquery/plugins/jpicker/images/\', picker: { file: \'../../../../../theme/common/colorpicker.png\', width: 14, height: 14 } }, localization: // alter these to change the text presented by the picker (e.g. different language) { text: { title: \'' . dol_escape_js($langs->trans("SelectAColor")) . '\', newColor: \'' . dol_escape_js($langs->trans("New")) . '\', currentColor: \'' . dol_escape_js($langs->trans("Current")) . '\', ok: \'' . dol_escape_js($langs->trans("Save")) . '\', cancel: \'' . dol_escape_js($langs->trans("Cancel")) . '\' } } } ); }); </script>'; } $out .= '<input id="colorpicker' . $prefix . '" name="' . $prefix . '" size="6" maxlength="7" class="flat' . ($morecss ? ' ' . $morecss : '') . '" type="text" value="' . $set_color . '" />'; } else { if (empty($conf->dol_use_jmobile)) { $out .= '<link rel="stylesheet" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />'; $out .= '<script src="' . DOL_URL_ROOT . '/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>'; $out .= '<script type="text/javascript"> jQuery(document).ready(function(){ jQuery(\'#colorpicker' . $prefix . '\').colorpicker({ size: 14, label: \'\', hide: true }); }); </script>'; } $out .= '<select id="colorpicker' . $prefix . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $prefix . '">'; //print '<option value="-1"> </option>'; foreach ($arrayofcolors as $val) { $out .= '<option value="' . $val . '"'; if ($set_color == $val) { $out .= ' selected'; } $out .= '>' . $val . '</option>'; } $out .= '</select>'; } return $out; }
/** * On/off button for constant * * @param string $code Name of constant * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param int $entity Entity to set * @param int $revertonoff Revert on/off * @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant * @return string */ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0) { global $conf, $langs; $entity = isset($entity) && is_numeric($entity) && $entity >= 0 ? $entity : $conf->entity; if (empty($conf->use_javascript_ajax)) { if (empty($conf->global->{$code})) { print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_' . $code . '&entity=' . $entity . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>'; } else { print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_' . $code . '&entity=' . $entity . '">' . img_picto($langs->trans("Enabled"), 'on') . '</a>'; } } else { $out = "\n<!-- Ajax code to switch constant " . $code . " -->" . ' <script type="text/javascript"> $(document).ready(function() { var input = ' . json_encode($input) . '; var url = \'' . DOL_URL_ROOT . '/core/ajax/constantonoff.php\'; var code = \'' . $code . '\'; var entity = \'' . $entity . '\'; var strict = \'' . $strict . '\'; var yesButton = "' . dol_escape_js($langs->transnoentities("Yes")) . '"; var noButton = "' . dol_escape_js($langs->transnoentities("No")) . '"; // Set constant $("#set_" + code).click(function() { if (input.alert && input.alert.set) { if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton; if (input.alert.set.noButton) noButton = input.alert.set.noButton; confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict); } else { setConstant(url, code, input, entity); } }); // Del constant $("#del_" + code).click(function() { if (input.alert && input.alert.del) { if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; if (input.alert.del.noButton) noButton = input.alert.del.noButton; confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict); } else { delConstant(url, code, input, entity); } }); }); </script>' . "\n"; $out .= '<div id="confirm_' . $code . '" title="" style="display: none;"></div>'; $out .= '<span id="set_' . $code . '" class="linkobject ' . (!empty($conf->global->{$code}) ? 'hideobject' : '') . '">' . ($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on') : img_picto($langs->trans("Disabled"), 'switch_off')) . '</span>'; $out .= '<span id="del_' . $code . '" class="linkobject ' . (!empty($conf->global->{$code}) ? '' : 'hideobject') . '">' . ($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off') : img_picto($langs->trans("Enabled"), 'switch_on')) . '</span>'; $out .= "\n"; } return $out; }
$nboffilesinsubdir = $resarray[2]; break; } } //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n"; if ($file != '.' && $file != '..' && (!empty($val['fullrelativename']) && $val['id'] >= 0 || dol_is_dir($fullpathselecteddir . (preg_match('/\\/$/', $fullpathselecteddir) ? '' : '/') . $file))) { if (empty($val['fullrelativename'])) { $val['fullrelativename'] = $file; $val['id'] = 0; $val['label'] = $file; $val['description'] = ''; $nboffilesinsubdir = $langs->trans("Unknown"); } print '<li class="directory collapsed">'; print "<a class=\"fmdirlia jqft ecmjqft\" href=\"#\" rel=\"" . dol_escape_htmltag($val['fullrelativename'] . '/') . "\" id=\"fmdirlia_id_" . $val['id'] . "\""; print " onClick=\"loadandshowpreview('" . dol_escape_js($val['fullrelativename']) . "'," . $val['id'] . ")\">"; print dol_escape_htmltag($file); print "</a>"; print '<div class="ecmjqft">'; print '<table class="nobordernopadding"><tr>'; /*print '<td align="left">'; print dol_escape_htmltag($file); print '</td>';*/ // Nb of docs print '<td align="right">'; print isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0 ? $val['cachenbofdoc'] : ' '; print '</td>'; print '<td align="left">'; if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) { print '<font color="#AAAAAA">+' . $nboffilesinsubdir . '</font> '; }
return true; if (! $.isNumeric(rate.val().replace(',','.'))) { alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?> '); e.stopPropagation(); setTimeout(function () { rate.focus() }, 50); return false; } if (npRate == "np_markRate" && rate.val() >= 100) { alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?> '); e.stopPropagation(); setTimeout(function () { rate.focus() }, 50); return false; } var price = 0; remisejs=price2numjs(remise.val()); if (remisejs != 100) // If a discount not 100 or no discount { if (remisejs == '') remisejs=0; bpjs=price2numjs(buying_price.val());
/** * Get formated messages to output (Used to show messages on html output) * @param mesgstring Message string * @param mesgarray Messages array * @param style Style of message output ('ok' or 'error') * @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify) * @return string Return html output * @see dol_print_error * @see dol_htmloutput_errors */ function get_htmloutput_mesg($mesgstring = '', $mesgarray = '', $style = 'ok', $keepembedded = 0) { global $conf, $langs; $ret = ''; $out = ''; $divstart = $divend = ''; // Use session mesg if (isset($_SESSION['mesg'])) { $mesgstring = $_SESSION['mesg']; unset($_SESSION['mesg']); } if (isset($_SESSION['mesgarray'])) { $mesgarray = $_SESSION['mesgarray']; unset($_SESSION['mesgarray']); } // If inline message with no format, we add it. if ((empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && !preg_match('/<div class=".*">/i', $out)) { $divstart = '<div class="' . $style . '">'; $divend = '</div>'; } if (is_array($mesgarray) && sizeof($mesgarray) || $mesgstring) { $langs->load("errors"); $out .= $divstart; if (is_array($mesgarray) && sizeof($mesgarray)) { foreach ($mesgarray as $message) { $ret++; $out .= $langs->trans($message); if ($ret < sizeof($mesgarray)) { $out .= "<br>\n"; } } } if ($mesgstring) { $langs->load("errors"); $ret++; $out .= $langs->trans($mesgstring); } $out .= $divend; } if ($out) { if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) { $return = '<script type="text/javascript"> jQuery(document).ready(function() { jQuery.jnotify("' . dol_escape_js($out) . '", "' . ($style == "ok" ? 3000 : $style) . '", ' . ($style == "ok" ? "false" : "true") . ', { closeLabel: "×" // the HTML to use for the "Close" link , showClose: true // determines if the "Close" link should be shown if notification is also sticky , fadeSpeed: 1000 // the speed to fade messages out (in milliseconds) , slideSpeed: 250 // the speed used to slide messages out (in milliseconds) , classContainer: "jnotify-container" , classNotification: "jnotify-notification" , classBackground: "jnotify-background" , classClose: "jnotify-close" , classMessage: "jnotify-message" , init: null // callback that occurs when the main jnotify container is created , create: null // callback that occurs when when the note is created (occurs just before // appearing in DOM) , beforeRemove: null // callback that occurs when before the notification starts to fade away }, { remove: function (){} } ); }); </script>'; } else { $return = $out; } } return $return; }
print '</td></tr>'; $error++; } } } print '</table>'; } ?> <script type="text/javascript"> function jsinfo() { ok=true; //alert('<?php echo dol_escape_js($langs->transnoentities("NextStepMightLastALongTime")); ?> '); document.getElementById('nextbutton').style.visibility="hidden"; document.getElementById('pleasewait').style.visibility="visible"; return ok; } </script> <?php dolibarr_install_syslog("--- step1: end"); pFooter($error, $setuplang, 'jsinfo', 1); /** * Create main file. No particular permissions are set by installer.
// Affiche les erreurs dol_htmloutput_errors($error, $errors); if ($conf->use_javascript_ajax) { print "\n" . '<script type="text/javascript" language="javascript">' . "\n"; print 'jQuery(document).ready(function () { jQuery("#selectcountry_id").change(function() { document.formsoc.action.value="edit"; document.formsoc.submit(); }); $("#copyaddressfromsoc").click(function() { $(\'textarea[name="address"]\').text("' . dol_escape_js($objsoc->address) . '"); $(\'input[name="zipcode"]\').val("' . dol_escape_js($objsoc->zip) . '"); $(\'input[name="town"]\').val("' . dol_escape_js($objsoc->town) . '"); $(\'select[name="country_id"]\').val("' . dol_escape_js($objsoc->country_id) . '"); $(\'select[name="state_id"]\').val("' . dol_escape_js($objsoc->state_id) . '"); }); })' . "\n"; print '</script>' . "\n"; } print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" name="formsoc">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="id" value="' . $id . '">'; print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="contactid" value="' . $object->id . '">'; print '<input type="hidden" name="old_lastname" value="' . $object->lastname . '">'; print '<input type="hidden" name="old_firstname" value="' . $object->firstname . '">'; if (!empty($backtopage)) { print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; } dol_fiche_head($head, 'card', $title, 0, 'contact');
{ ok=false; alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>'); } else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == '')) { ok=false; alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>'); } // If create user asked else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == '')) { ok=false; alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>'); } else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == '')) { ok=false; alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>'); } return ok; } </script> --> <?php // $db->close(); Not database connexion yet pFooter(1, $setuplang, 'jscheckparam'); ?>
WHERE pt.entity = ' . $conf->entity . ' AND pt.fk_projet = ' . $id; if (!empty($progress_min)) { $sql .= ' AND pt.progress >= ' . $progress_min; } if (!empty($progress_max)) { $sql .= ' AND pt.progress >= ' . $progress_max; } $sql .= ' GROUP BY pt.rowid ORDER BY pt.progress'; $resql = $db->query($sql); if ($resql) { while ($line = $db->fetch_object($resql)) { if (empty($line->temps_prevu)) { continue; } $temps_prevu = !empty($line->temps_prevu) ? $line->temps_prevu : 1; $progress_reelle = 100 * $line->temps_reel / $temps_prevu; $progress_theorique = 100 * $line->temps_theorique / $temps_prevu; $TData[] = array('name' => dol_escape_js($line->label) . ' (' . $line->ref . ')', 'Progression réelle' => $progress_reelle, 'Progression théorique' => $progress_theorique); } } // Begin of page llxHeader('', $langs->trans('mandarinTitleGraphProjet'), ''); $head = project_prepare_head($object); dol_fiche_head($head, 'mandarin_rapport', $langs->trans("mandarinProjectTask"), 0, $object->public ? 'projectpub' : 'project'); $explorer = new stdClass(); $explorer->actions = array("dragToZoom", "rightClickToReset"); $listeview = new TListviewTBS('graphProjectTask'); print $listeview->renderArray($PDOdb, $TData, array('type' => 'chart', 'chartType' => 'ColumnChart', 'liste' => array('titre' => $langs->transnoentitiesnoconv('titleGraphProjectTask')), 'xaxis' => 'name', 'hAxis' => array('title' => $langs->transnoentitiesnoconv('subTitleHAxisGraphProjectTask')), 'vAxis' => array('title' => $langs->transnoentitiesnoconv('subTitleVAxisGraphProjectTask')), 'explorer' => $explorer)); // End of page llxFooter();
/** * Show form to upload a new file * * @param string $url Url * @param string $title Title zone (Title or '' or 'none') * @param int $addcancel 1=Add 'Cancel' button * @param int $sectionid If upload must be done inside a particular ECM section * @param int $perm Value of permission to allow upload * @param int $size Length of input file area * @param Object $object Object to use (when attachment is done on an element) * @param string $options Add an option column * @param boolean $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param string $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param string $htmlname Name and id of HTML form * @return int <0 if KO, >0 if OK */ function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile') { global $conf, $langs, $hookmanager; $hookmanager->initHooks(array('formfile')); if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') { $useajax = 0; } if (!empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax || $useajax == 2) { // TODO: Check this works with 2 forms on same page // TODO: Check this works with GED module, otherwise, force useajax to 0 // TODO: This does not support option savingdocmask // TODO: This break feature to upload links too return $this->_formAjaxFileUpload($object); } else { $maxlength = $size; $out = "\n\n<!-- Start form attach new file -->\n"; if (empty($title)) { $title = $langs->trans("AttachANewFile"); } if ($title != 'none') { $out .= load_fiche_titre($title, null, null); } $out .= '<form name="' . $htmlname . '" id="' . $htmlname . '" action="' . $url . '" enctype="multipart/form-data" method="POST">'; $out .= '<input type="hidden" id="' . $htmlname . '_section_dir" name="section_dir" value="">'; $out .= '<input type="hidden" id="' . $htmlname . '_section_id" name="section_id" value="' . $sectionid . '">'; $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; $out .= '<table width="100%" class="nobordernopadding">'; $out .= '<tr>'; if (!empty($options)) { $out .= '<td>' . $options . '</td>'; } $out .= '<td valign="middle" class="nowrap">'; $max = $conf->global->MAIN_UPLOAD_DOC; // En Kb $maxphp = @ini_get('upload_max_filesize'); // En inconnu if (preg_match('/m$/i', $maxphp)) { $maxphp = $maxphp * 1024; } // Now $max and $maxphp are in Kb if ($maxphp > 0) { $max = min($max, $maxphp); } if ($max > 0) { $out .= '<input type="hidden" name="max_file_size" value="' . $max * 1024 . '">'; } $out .= '<input class="flat" type="file" name="userfile" size="' . $maxlength . '"'; $out .= empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''; $out .= '>'; $out .= ' '; $out .= '<input type="submit" class="button" name="sendit" value="' . $langs->trans("Upload") . '"'; $out .= empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''; $out .= '>'; if ($addcancel) { $out .= ' '; $out .= '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">'; } if (!empty($conf->global->MAIN_UPLOAD_DOC)) { if ($perm) { $langs->load('other'); //$out .= ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); $out .= ' '; $out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1); //$out .= ')'; } } else { $out .= ' (' . $langs->trans("UploadDisabled") . ')'; } $out .= "</td></tr>"; if ($savingdocmask) { $out .= '<tr>'; if (!empty($options)) { $out .= '<td>' . $options . '</td>'; } $out .= '<td valign="middle" class="nowrap">'; $out .= '<input type="checkbox" checked name="savingdocmask" value="' . dol_escape_js($savingdocmask) . '"> ' . $langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/', $langs->transnoentitiesnoconv("OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv("OriginFileName")); $out .= '</td>'; $out .= '</tr>'; } $out .= "</table>"; $out .= '</form>'; if (empty($sectionid)) { $out .= '<br>'; } $out .= "\n<!-- End form attach new file -->\n"; if ($linkfiles) { $out .= "\n<!-- Start form attach new link -->\n"; $langs->load('link'); $title = $langs->trans("LinkANewFile"); $out .= load_fiche_titre($title, null, null); $out .= '<form name="' . $htmlname . '_link" id="' . $htmlname . '_link" action="' . $url . '" method="POST">'; $out .= '<input type="hidden" id="' . $htmlname . '_link_section_dir" name="link_section_dir" value="">'; $out .= '<input type="hidden" id="' . $htmlname . '_link_section_id" name="link_section_id" value="' . $sectionid . '">'; $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; $out .= '<div class="valignmiddle" >'; $out .= '<div class="inline-block" style="padding-right: 10px;">'; if (!empty($conf->global->OPTIMIZEFORTEXTBROWSER)) { $out .= '<label for="link">' . $langs->trans("URLToLink") . ':</label> '; } $out .= '<input type="text" name="link" size="' . $maxlength . '" id="link" placeholder="' . dol_escape_htmltag($langs->trans("URLToLink")) . '">'; $out .= '</div>'; $out .= '<div class="inline-block" style="padding-right: 10px;">'; if (!empty($conf->global->OPTIMIZEFORTEXTBROWSER)) { $out .= '<label for="label">' . $langs->trans("Label") . ':</label> '; } $out .= '<input type="text" name="label" id="label" placeholder="' . dol_escape_htmltag($langs->trans("Label")) . '">'; $out .= '<input type="hidden" name="objecttype" value="' . $object->element . '">'; $out .= '<input type="hidden" name="objectid" value="' . $object->id . '">'; $out .= '</div>'; $out .= '<div class="inline-block" style="padding-right: 10px;">'; $out .= '<input type="submit" class="button" name="linkit" value="' . $langs->trans("ToLink") . '"'; $out .= empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''; $out .= '>'; $out .= '</div>'; $out .= '</div>'; $out .= '<div class="clearboth"></div>'; $out .= '</form><br>'; $parameters = array('socid' => isset($GLOBALS['socid']) ? $GLOBALS['socid'] : '', 'id' => isset($GLOBALS['id']) ? $GLOBALS['id'] : '', 'url' => $url, 'perm' => $perm); $res = $hookmanager->executeHooks('formattachOptions', $parameters, $object); $out .= "\n<!-- End form attach new file -->\n"; } if (empty($res)) { print '<div class="attacharea">'; print $out; print '</div>'; } print $hookmanager->resPrint; return 1; } }
print '</table>'; print '</div>'; } } } print '<script type="text/javascript"> $("div#AShowChoices a").click(function() { $("div#navail_choices").toggle(); if ($("div#navail_choices").css("display") == "none") { $(this).text("' . $langs->trans('ShowNotAvailableOptions') . '"); $(this).parent().children("img").attr("src", "../theme/eldy/img/1downarrow.png"); } else { $(this).text("' . $langs->trans('HideNotAvailableOptions') . '"); $(this).parent().children("img").attr("src", "../theme/eldy/img/1uparrow.png"); } }); /* $(".runupgrade").click(function() { return confirm("' . dol_escape_js($langs->transnoentitiesnoconv("WarningUpgrade"), 0, 1) . '"); }); */ </script>'; dolibarr_install_syslog("--- check: end"); pFooter(true); // Never display next button
if ($object->tva_intra) { $s=''; $s.=$object->tva_intra; $s.='<input type="hidden" id="tva_intra" name="tva_intra" size="12" maxlength="20" value="'.$object->tva_intra.'">'; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { $s.=' '; if ($conf->use_javascript_ajax) { print "\n"; print '<script language="JavaScript" type="text/javascript">'; print "function CheckVAT(a) {\n"; print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n"; print "}\n"; print '</script>'; print "\n"; $s.='<a href="#" onclick="javascript: CheckVAT( $(\'#tva_intra\').val() );">'.$langs->trans("VATIntraCheck").'</a>'; $s = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); } else { $s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; } } print $s; } else {
return true; } else { alert("' . dol_escape_js($langs->transnoentities('InvalidValidatorCP')) . '"); return false; } } else { alert("' . dol_escape_js($langs->transnoentities('NoDateFin')) . '"); return false; } } else { alert("' . dol_escape_js($langs->transnoentities('NoDateDebut')) . '"); return false; } } </script>' . "\n"; // Formulaire de demande print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '" onsubmit="return valider()" name="demandeCP">' . "\n"; print '<input type="hidden" name="action" value="create" />' . "\n"; print '<input type="hidden" name="userID" value="' . $userid . '" />' . "\n"; print '<div class="tabBar">'; print '<span>' . $langs->trans('DelayToRequestCP', $cp->getConfCP('delayForRequest')) . '</span><br /><br />'; print '<table class="border" width="100%">'; print '<tbody>'; print '<tr>'; print '<td class="fieldrequired">' . $langs->trans("User") . '</td>'; print '<td>';
<label>W <input type="text" size="4" id="w" name="w" /></label> <label>H <input type="text" size="4" id="h" name="h" /></label> </div> <input type="hidden" id="file" name="file" value="' . urlencode($original_file) . '" /> <input type="hidden" id="action" name="action" value="confirm_crop" /> <input type="hidden" id="product" name="product" value="' . $id . '" /> <input type="hidden" id="refsizeforcrop" name="refsizeforcrop" value="' . $refsizeforcrop . '" /> <input type="hidden" id="ratioforcrop" name="ratioforcrop" value="' . $ratioforcrop . '" /> <input type="hidden" name="id" value="' . $id . '" /> <br> <input type="submit" id="submitcrop" name="submitcrop" class="button" value="' . dol_escape_htmltag($langs->trans("Recenter")) . '" /> <input type="submit" id="cancelcrop" name="cancel" class="button" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '" /> </form>' . "\n"; print '</fieldset>' . "\n"; print '<br>'; } /* Check that mandatory fields are filled */ print '<script type="text/javascript" language="javascript"> jQuery(document).ready(function() { $("#submitcrop").click(function(e) { var idClicked = e.target.id; if (parseInt(jQuery(\'#w\').val())) return true; alert(\'' . dol_escape_js($langs->trans("ErrorFieldRequired", $langs->trans("Dimension"))) . '\'); return false; }); }); </script>'; llxFooter(); $db->close();
/** * testDolEscapeJs * * @return void */ public function testDolEscapeJs() { $input="x&<b>#</b>,\"'"; // " will be converted into ' $result=dol_escape_js($input); $this->assertEquals("x&<b>#<\/b>,\'\'",$result); }