print '</tr>'; // Description (must be a textarea and not html must be allowed (used in list view) print '<tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>'; print $langs->trans('Description'); print '</td>'; if ($action != 'editdescription' && $object->statut == 0) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdescription&id='.$object->id.'">'.img_edit($langs->trans('Modify'),1).'</a></td>'; print '</tr></table>'; print '</td><td colspan="3">'; if ($action == 'editdescription') { print '<form name="editdescription" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="action" value="setdescription">'; print '<textarea name="description" wrap="soft" cols="70" rows="'.ROWS_3.'">'.dol_htmlentitiesbr_decode($object->description).'</textarea><br>'; print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; print '</form>'; } else { print dol_nl2br($object->description); } print '</td>'; print '</tr>'; // Project if ($conf->projet->enabled) { $langs->load('projects'); print '<tr>';
} print '</td></tr>'; // EMail print "<tr>" . '<td valign="top"' . ($conf->global->USER_MAIL_REQUIRED ? ' class="fieldrequired"' : '') . '>' . $langs->trans("EMail") . '</td>'; print '<td>'; if ($caneditfield && !$fuser->ldap_sid) { print '<input size="40" type="text" name="email" class="flat" value="' . $fuser->email . '">'; } else { print '<input type="hidden" name="email" value="' . $fuser->email . '">'; print $fuser->email; } print '</td></tr>'; // Signature print "<tr>" . '<td valign="top">' . $langs->trans("Signature") . '</td>'; print '<td>'; print '<textarea name="signature" rows="5" cols="90">' . dol_htmlentitiesbr_decode($fuser->signature) . '</textarea>'; print '</td></tr>'; // openid if (preg_match('/myopenid/', $conf->authmode)) { print "<tr>" . '<td valign="top">' . $langs->trans("url_openid") . '</td>'; print '<td>'; if ($caneditfield && !$fuser->ldap_sid) { print '<input size="40" type="text" name="openid" class="flat" value="' . $fuser->openid . '">'; } else { print '<input type="hidden" name="openid" value="' . $fuser->openid . '">'; print $fuser->openid; } print '</td></tr>'; } // Statut print '<tr><td valign="top">' . $langs->trans("Status") . '</td>';
/** * getMailOnResiliate * * @return string Return mail model */ function getMailOnResiliate() { global $conf; if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { return $this->mail_resiliate; } else { return $conf->global->ADHERENT_MAIL_RESIL; } }
/** * Get the form to input an email * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files * @param addfileaction Name of action when posting file attachments * @param removefileaction Name of action when removing file attachments */ function get_form($addfileaction='addfile',$removefileaction='removefile') { global $conf, $langs, $user; $langs->load("other"); $langs->load("mails"); $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"]); $form=new Form($DB); $out.= "\n<!-- Debut form mail -->\n"; if ($this->withform) { $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 ($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 ($this->withfrom) { if ($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 ($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 ($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 ($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 ($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 (is_array($this->withto)) { if ($this->withtofree) $out.= " ".$langs->trans("or")." "; $out.= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1); } if ($this->withtosocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. { $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 ($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 (is_array($this->withto)) { $out.= " ".$langs->trans("or")." "; $out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1); } if ($this->withtoccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. { $liste=array(); $soc=new Societe($this->db); $soc->fetch($this->withtoccsocid); foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value) { $liste[$key]=$value; } $out.= " ".$langs->trans("or")." "; $out.= $form->selectarray("receivercc", $liste, GETPOST("receivercc"), 1); } } $out.= "</td></tr>\n"; } // CCC if ($this->withtoccc || is_array($this->withtoccc)) { $out.= '<tr><td width="180">'; $out.= $form->textwithpicto($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); $out.= '</td><td>'; if ($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 (is_array($this->withto)) { $out.= " ".$langs->trans("or")." "; $out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1); } if ($this->withtocccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. { $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; } $out.= " ".$langs->trans("or")." "; $out.= $form->selectarray("receiverccc", $liste, 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 ($this->withdeliveryreceipt) { $out.= '<tr><td width="180">'.$langs->trans("DeliveryReceipt").'</td><td>'; if ($this->withdeliveryreceiptreadonly) { $out.= yn($this->withdeliveryreceipt); } else { $out.= $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:0) ,1); } $out.= "</td></tr>\n"; } // Topic if ($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"]:$this->withtopic) .'" />'; } $out.= "</td></tr>\n"; } // Attached files if ($this->withfile) { $out.= '<tr>'; $out.= '<td width="180">'.$langs->trans("MailFile").'</td>'; $out.= '<td>'; // 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 (sizeof($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) // Can add other files { $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").'" />'; } $out.= "</td></tr>\n"; } // Message if ($this->withbody) { $defaultmessage=""; // TODO A partir du type, proposer liste de messages dans table llx_models 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 (! is_numeric($this->withbody)) { $defaultmessage=$this->withbody; } if ($conf->paypal->enabled && $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('order',$this->substit['__ORDERREF__']); $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrderWithPaypalLink",$url); } if ($this->param["models"]=='facture_send') { $url=getPaypalPaymentUrl('invoice',$this->substit['__FACREF__']); $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceWithPaypalLink",$url); } } $defaultmessage=make_substitutions($defaultmessage,$this->substit); if (isset($_POST["message"])) $defaultmessage=$_POST["message"]; $defaultmessage=str_replace('\n',"\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(! empty($conf->global->MAIL_USE_SIGN) && $this->fromid > 0) { $fuser=new User($this->db); $fuser->fetch($this->fromid); if(!empty($fuser->signature)) { $defaultmessage.=dol_htmlentitiesbr_decode($fuser->signature); } } // Editor wysiwyg require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('message',$defaultmessage,'',280,'dolibarr_notes','In',true,false,$this->withfckeditor,8,72); $out.= $doleditor->Create(1); } $out.= "</td></tr>\n"; } if ($this->withform) { $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) $out.= '</form>'."\n"; $out.= "<!-- Fin form mail -->\n"; return $out; }
/** * Write content of pages * * @param $pdf * @param $outputlangs * @return int 1 */ function _pages(&$pdf, $outputlangs) { $height=3; // height for text separation $pagenb=1; $y=$this->_pagehead($pdf, $outputlangs, $pagenb); $y++; $pdf->SetFont('','',8); $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; $sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " c.libelle,"; $sql.= " u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid"; $sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'"; $sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'"; $sql.= " ORDER BY a.datep DESC"; dol_syslog("Rapport.pdf::_page sql=".$sql); $resql=$this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); $i = 0; $y0=$y1=$y2=$y3=0; while ($i < $num) { $obj = $this->db->fetch_object($resql); $y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3); // Calculate height of text $text=dol_trunc(dol_htmlentitiesbr_decode($obj->note),150); //print 'd'.$text; exit; $nboflines=dol_nboflines($text); $heightlinemax=max(2*$height,$nboflines*$height); // Check if there is enough space to print record if ((1+$y+$heightlinemax) >= ($this->page_hauteur - $this->marge_haute)) { // We need to break page $pagenb++; $y=$this->_pagehead($pdf, $outputlangs, $pagenb); $y++; $pdf->SetFont('','',8); } $y++; $pdf->SetXY($this->marge_gauche, $y); $pdf->MultiCell(22, $height, dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour"), 0, 'L', 0); $y0 = $pdf->GetY(); $pdf->SetXY(26, $y); $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->societe),32), 0, 'L', 0); $y1 = $pdf->GetY(); $pdf->SetXY(60,$y); $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->libelle),32), 0, 'L', 0); $y2 = $pdf->GetY(); $pdf->SetXY(106,$y); $pdf->MultiCell(94, $height, $outputlangs->convToOutputCharset($text), 0, 'L', 0); $y3 = $pdf->GetY(); //$pdf->MultiCell(94,2,"y=$y y3=$y3",0,'L',0); $i++; } } return 1; }
} } print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>'; print '<td class="valeur">'; if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','',true); $doleditor->Create(); } else { print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">'; print dol_htmlentitiesbr_decode($object->note); print '</textarea>'; } print '</td>'; print "</tr>\n"; print '<tr><td align="center" colspan="2"><input class="button" value="'.$langs->trans("Save").'" type="submit"></td></tr>'; print "</table>\n"; print '</form>'; print '</div>'; } } } $db->close();
/** * Write content of pages * * @param PDF $pdf Object pdf * @param Translate $outputlangs Object langs * @return int 1 */ function _pages(&$pdf, $outputlangs) { global $conf; $height = 3; // height for text separation $pagenb = 1; $y = $this->_pagehead($pdf, $outputlangs, $pagenb); $y++; $pdf->SetFont('', '', 8); $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql .= " a.id, a.datep as dp, a.datep2 as dp2,"; $sql .= " a.fk_contact, a.note, a.percent as percent, a.label,"; $sql .= " c.code, c.libelle,"; $sql .= " u.login"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_actioncomm as c, " . MAIN_DB_PREFIX . "user as u, " . MAIN_DB_PREFIX . "actioncomm as a"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON a.fk_soc = s.rowid"; $sql .= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid"; $sql .= " AND a.datep BETWEEN '" . $this->db->idate(dol_get_first_day($this->year, $this->month, false)) . "'"; $sql .= " AND '" . $this->db->idate(dol_get_last_day($this->year, $this->month, false)) . "'"; $sql .= " AND a.entity = " . $conf->entity; $sql .= " ORDER BY a.datep DESC"; dol_syslog(get_class($this) . "::_page sql=" . $sql); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); $i = 0; $y0 = $y1 = $y2 = $y3 = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); $y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3); // Calculate height of text $text = ''; if (!preg_match('/^' . preg_quote($obj->label) . '/', $obj->note)) { $text = $obj->label . "\n"; } $text .= $obj->note; $text = dol_trunc(dol_htmlentitiesbr_decode($text), 150); //print 'd'.$text; exit; $nboflines = dol_nboflines($text); $heightlinemax = max(2 * $height, $nboflines * $height); // Check if there is enough space to print record if (1 + $y + $heightlinemax >= $this->page_hauteur - $this->marge_haute) { // We need to break page $pagenb++; $y = $this->_pagehead($pdf, $outputlangs, $pagenb); $y++; $pdf->SetFont('', '', 8); } $y++; // Date $pdf->SetXY($this->marge_gauche, $y); $pdf->MultiCell(22, $height, dol_print_date($this->db->jdate($obj->dp), "day") . "\n" . dol_print_date($this->db->jdate($obj->dp), "hour"), 0, 'L', 0); $y0 = $pdf->GetY(); // Third party $pdf->SetXY(26, $y); $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->societe), 32), 0, 'L', 0); $y1 = $pdf->GetY(); // Action code $code = $obj->code; if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if ($code == 'AC_OTH') { $code = 'AC_MANUAL'; } if ($code == 'AC_OTH_AUTO') { $code = 'AC_AUTO'; } } $pdf->SetXY(60, $y); $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Action" . $code)), 32), 0, 'L', 0); $y2 = $pdf->GetY(); // Description of event $pdf->SetXY(106, $y); $pdf->MultiCell(94, $height, $outputlangs->convToOutputCharset($text), 0, 'L', 0); $y3 = $pdf->GetY(); $i++; } } return 1; }