Merge branch 'pre-stable' into stable
SMTPMail Sendmail_Core: align blind_copy and reply_to Unit test : test changes 10.2 Sendmail : email not fully compliant, replace code with PHPMailer Manage_Table get array with all errors compute.php log exception translation Improve usage in command line Noalyss_debug.js available if debug level > 0 Improve 2FA : show expected code, improve explanation Redirect properly if not config.inc.php file CARD: show only count of available cards in the SELECT Manage_Table in case of exception, check that $S5 exists before throwing message Mantis 0002461: Ajouter une colonne TVA dans la section ARTICLE Appearance : improve responsive appearance for dashboard element CSS: improve appareance card and gestion_title on small screens CSS: improve appareance card and gestion_title on small screens OTP : get options XML : improve invoice appearance XMLReader : correct VAT order Bug 2458: Si on envoie un email depuis Linux , le return-path doit être spécifié ...
This commit is contained in:
commit
1ddfe09c5f
21 changed files with 2498 additions and 5674 deletions
|
|
@ -42,6 +42,23 @@ MaintenanceMode("block.html");
|
||||||
|
|
||||||
|
|
||||||
$http=new HttpInput();
|
$http=new HttpInput();
|
||||||
|
//------------------------------------------------
|
||||||
|
// refresh code from otp-link.php
|
||||||
|
//------------------------------------------------
|
||||||
|
if ($http->post("action","string","xx")=="qr_refresh") {
|
||||||
|
try {
|
||||||
|
|
||||||
|
$authenticator = new \Noalyss\OTP();
|
||||||
|
$secret=$http->post("secret");
|
||||||
|
echo $authenticator->compute_code($secret);
|
||||||
|
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
record_log($exc);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// TVA id or TVA code
|
// TVA id or TVA code
|
||||||
$t=$http->get("t");
|
$t=$http->get("t");
|
||||||
// string qcode card
|
// string qcode card
|
||||||
|
|
|
||||||
|
|
@ -1233,10 +1233,30 @@ div.topmenu {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
text-align:left;
|
text-align:left;
|
||||||
z-index:1;
|
z-index:1;
|
||||||
width:480px;
|
width:100%;
|
||||||
width:30rem;
|
|
||||||
height:auto;
|
height:auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
|
||||||
|
}
|
||||||
|
/* MeDium */
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
#add_todo_list , div.add_todo_list{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* LarGe */
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
#add_todo_list , div.add_todo_list {
|
||||||
|
width:480px;
|
||||||
|
width:30rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* eXtraLarge */
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
|
||||||
|
}
|
||||||
div.welcome {
|
div.welcome {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -3072,7 +3092,6 @@ span.warning {
|
||||||
}
|
}
|
||||||
li.tab_row_selected {
|
li.tab_row_selected {
|
||||||
display:block;
|
display:block;
|
||||||
width:96%;
|
|
||||||
background: #C2E3FC; /* Old browsers */
|
background: #C2E3FC; /* Old browsers */
|
||||||
background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */
|
background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */
|
||||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */
|
||||||
|
|
@ -3171,6 +3190,9 @@ margin-left: 2px;
|
||||||
border-color: #879ed4;
|
border-color: #879ed4;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 20px 15px 15px 20px;
|
||||||
|
margin: 20px 15px 15px 15px;
|
||||||
}
|
}
|
||||||
span.tab_row {
|
span.tab_row {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,8 @@
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// -- if there is not config.inc.php file then redirect to install.php
|
||||||
if (! file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php') )
|
if ( ! file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php') )
|
||||||
{
|
{
|
||||||
echo <<<EOF
|
echo <<<EOF
|
||||||
|
|
||||||
|
|
@ -143,9 +143,6 @@ if (! file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config
|
||||||
window.location="install.php";
|
window.location="install.php";
|
||||||
</script>
|
</script>
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
header("Location: install.php");
|
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2180,7 +2180,7 @@ function view_action(ag_id, dossier, modify) {
|
||||||
}
|
}
|
||||||
var code_html = getNodeText(html[0]);
|
var code_html = getNodeText(html[0]);
|
||||||
code_html = unescape_xml(code_html);
|
code_html = unescape_xml(code_html);
|
||||||
var pos = fixed_position(0, 50) + ";width:90%;left:5%;z-index:"+layer+";";
|
var pos = "position:absolute;"+"top : "+calcy(50)+"px;"+"z-index:"+layer;
|
||||||
add_div({
|
add_div({
|
||||||
id: id,
|
id: id,
|
||||||
cssclass: "inner_box",
|
cssclass: "inner_box",
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,9 @@ function todo_list_show(p_id)
|
||||||
|
|
||||||
|
|
||||||
todo_div.style.top = (posY + offsetY) + 'px';
|
todo_div.style.top = (posY + offsetY) + 'px';
|
||||||
todo_div.style.left = (posX + offsetX + 20) + 'px';
|
if (document.viewport.getWidth()> 970) {
|
||||||
|
todo_div.style.left = (posX + offsetX + 20) + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
var answer = req.responseXML;
|
var answer = req.responseXML;
|
||||||
var tl_id = answer.getElementsByTagName('tl_id');
|
var tl_id = answer.getElementsByTagName('tl_id');
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -532,33 +532,40 @@ abstract class XML_Reader
|
||||||
*/
|
*/
|
||||||
$pdf->setFont("DejaVu", "B", 12);
|
$pdf->setFont("DejaVu", "B", 12);
|
||||||
$pdf->SetTextColor(0,0,127);
|
$pdf->SetTextColor(0,0,127);
|
||||||
$pdf->write_cell(60, 4, _("Articles"));
|
$pdf->write_cell(50, 4, _("Articles"));
|
||||||
$pdf->line_new(6);
|
$pdf->line_new(6);
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
$pdf->setFont("DejaVu", "", 7);
|
$pdf->setFont("DejaVu", "", 7);
|
||||||
$result = $this->get_invoiceLine();
|
$result = $this->get_invoiceLine();
|
||||||
$pdf->write_cell(50, 4, _("Code"), border: 'B');
|
$pdf->write_cell(40, 4, _("Code"), border: 'B');
|
||||||
$pdf->write_cell(60, 4, _("Description"), border: 'B');
|
$pdf->write_cell(50, 4, _("Description"), border: 'B');
|
||||||
$pdf->write_cell(20, 4, _("TVA"), border: 'B', align: 'R');
|
$pdf->write_cell(20, 4, _("TVA"), border: 'B', align: 'R');
|
||||||
$pdf->write_cell(20, 4, _("Prix unitaire"), border: 'B', align: 'R');
|
$pdf->write_cell(20, 4, _("Prix unitaire"), border: 'B', align: 'R');
|
||||||
$pdf->write_cell(20, 4, _("Quantité"), border: 'B', align: 'R');
|
$pdf->write_cell(20, 4, _("Quantité"), border: 'B', align: 'R');
|
||||||
$pdf->write_cell(20, 4, _("Montant HT"), border: 'B', align: 'R');
|
$pdf->write_cell(20, 4, _("Montant HT"), border: 'B', align: 'R');
|
||||||
|
$pdf->write_cell(20, 4, _("TVAC"), border: 'B', align: 'R');
|
||||||
$pdf->line_new();
|
$pdf->line_new();
|
||||||
|
|
||||||
$nb_inline = count($result);
|
$nb_inline = count($result);
|
||||||
for ($i = 0; $i < $nb_inline; $i++)
|
for ($i = 0; $i < $nb_inline; $i++)
|
||||||
{
|
{
|
||||||
if ( $result[$i]['description'] == '') {
|
if ( $result[$i]['description'] == '') {
|
||||||
$pdf->write_multi(110, 4, $result[$i]['name']);
|
$pdf->write_multi(90, 4, $result[$i]['name']);
|
||||||
}else {
|
}else {
|
||||||
$pdf->write_multi(50, 4, $result[$i]['name']);
|
$pdf->write_multi(40, 4, $result[$i]['name']);
|
||||||
$pdf->write_multi(60, 4, $result[$i]['description']);
|
$pdf->write_multi(50, 4, $result[$i]['description']);
|
||||||
}
|
}
|
||||||
$pdf->write_cell(20, 4, $result[$i]['tva_percent'], align: 'R');
|
$pdf->write_cell(20, 4, $result[$i]['tva_percent'], align: 'R');
|
||||||
//$pdf->write_cell(5, 4, $result[$i]['tva_id']);
|
//$pdf->write_cell(5, 4, $result[$i]['tva_id']);
|
||||||
$pdf->write_cell(20, 4, $result[$i]['unit_price'], align: 'R');
|
$pdf->write_cell(20, 4, $result[$i]['unit_price'], align: 'R');
|
||||||
$pdf->write_cell(20, 4, $result[$i]['quantity'], align: 'R');
|
$pdf->write_cell(20, 4, $result[$i]['quantity'], align: 'R');
|
||||||
$pdf->write_cell(20, 4, nbm($result[$i]['amount']), align: 'R');
|
$pdf->write_cell(20, 4, nbm($result[$i]['amount']), align: 'R');
|
||||||
|
/// @var $t (float) amount VAT included
|
||||||
|
$t= bcmul($result[$i]['amount'],
|
||||||
|
bcdiv($result[$i]['tva_percent'],100,4),4);
|
||||||
|
$t=bcadd($result[$i]["amount"],$t,4);
|
||||||
|
$t=round($t,2);
|
||||||
|
$pdf->write_cell(20, 4, nbm($t), align: 'R');
|
||||||
$pdf->line_new();
|
$pdf->line_new();
|
||||||
}
|
}
|
||||||
$pdf->line_new(10);
|
$pdf->line_new(10);
|
||||||
|
|
|
||||||
|
|
@ -101,4 +101,3 @@ define ("DEBUGNOALYSS",0);
|
||||||
// For POSTFIX, when sending email from NOALYSS via sendmail an extra parameter is needed
|
// For POSTFIX, when sending email from NOALYSS via sendmail an extra parameter is needed
|
||||||
// for the Return-Path, the [FROM] will be replaced by the Sendmail_Core->from value
|
// for the Return-Path, the [FROM] will be replaced by the Sendmail_Core->from value
|
||||||
//define("MAIL_EXTRA_PARAM","-f [FROM]")
|
//define("MAIL_EXTRA_PARAM","-f [FROM]")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -369,16 +369,16 @@ define("ARROWUP","⇧");
|
||||||
// Url of NOALYSS (http://...)
|
// Url of NOALYSS (http://...)
|
||||||
//
|
//
|
||||||
if (!defined("NOALYSS_URL")) {
|
if (!defined("NOALYSS_URL")) {
|
||||||
if ( isset ( $_SERVER)) {
|
if ( isset ( $_SERVER['SERVER_NAME'])) {
|
||||||
$protocol = "http";
|
$protocol = "http";
|
||||||
if (isset ($_SERVER['REQUEST_SCHEME'])) {
|
if (isset ($_SERVER['REQUEST_SCHEME'])) {
|
||||||
$protocol = $_SERVER['REQUEST_SCHEME'];
|
$protocol = $_SERVER['REQUEST_SCHEME'];
|
||||||
}
|
}
|
||||||
$base = $protocol . '://' .
|
$base = $protocol . '://' .
|
||||||
$_SERVER['SERVER_NAME'] .
|
$_SERVER['SERVER_NAME'] .
|
||||||
":" . $_SERVER['SERVER_PORT'] .
|
":" . $_SERVER['SERVER_PORT'] .
|
||||||
dirname($_SERVER['PHP_SELF']);
|
dirname($_SERVER['PHP_SELF']);
|
||||||
define("NOALYSS_URL", $base);
|
define("NOALYSS_URL", $base);
|
||||||
}else {
|
}else {
|
||||||
define("NOALYSS_URL","command-line");
|
define("NOALYSS_URL","command-line");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ global $g_user, $g_failed;
|
||||||
*/
|
*/
|
||||||
/* var categorie ISelect select card category */
|
/* var categorie ISelect select card category */
|
||||||
$categorie = new ISelect('cat');
|
$categorie = new ISelect('cat');
|
||||||
$categorie->value = $cn->make_array("select fd_id,fd_label||' ('||(select count(*) from fiche where fiche.fd_id=fiche_def.fd_id)::text||')' from fiche_def order by fd_label");
|
$categorie->value = $cn->make_array("select fd_id,fd_label||' ('||(select count(*) from fiche where fiche.fd_id=fiche_def.fd_id and f_enable='1')::text||')' from fiche_def order by fd_label");
|
||||||
$categorie->selected = $http->get('cat','number',0);
|
$categorie->selected = $http->get('cat','number',0);
|
||||||
|
|
||||||
// var $str_categorie string
|
// var $str_categorie string
|
||||||
|
|
|
||||||
|
|
@ -2785,7 +2785,7 @@ EOF;
|
||||||
echo js_include('noalyss_checkbox.js');
|
echo js_include('noalyss_checkbox.js');
|
||||||
echo js_include('tinymce/tinymce.min.js');
|
echo js_include('tinymce/tinymce.min.js');
|
||||||
|
|
||||||
if (DEBUGNOALYSS > 1) {
|
if (DEBUGNOALYSS > 0) {
|
||||||
echo js_include('noalyss_debug.js');
|
echo js_include('noalyss_debug.js');
|
||||||
}
|
}
|
||||||
echo '<script src="export.php?loadjs=message" type="text/javascript" charset="utf-8"></script>';
|
echo '<script src="export.php?loadjs=message" type="text/javascript" charset="utf-8"></script>';
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,13 @@ class Manage_Table_SQL
|
||||||
$this->cssclass="inner_box";
|
$this->cssclass="inner_box";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief returns an array of errors : key= column name
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
function get_aerror() {
|
||||||
|
return $this->aerror;
|
||||||
|
}
|
||||||
function setCssClass($p_class) {
|
function setCssClass($p_class) {
|
||||||
$this->cssclass=$p_class;
|
$this->cssclass=$p_class;
|
||||||
}
|
}
|
||||||
|
|
@ -1355,7 +1362,7 @@ function check()
|
||||||
$root->appendChild($s2);
|
$root->appendChild($s2);
|
||||||
$root->appendChild($s3);
|
$root->appendChild($s3);
|
||||||
$root->appendChild($s4);
|
$root->appendChild($s4);
|
||||||
$root->appendChild($s5);
|
if ( isset($s5) ) $root->appendChild($s5);
|
||||||
$xml->appendChild($root);
|
$xml->appendChild($root);
|
||||||
}
|
}
|
||||||
return $xml;
|
return $xml;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@
|
||||||
*@brief API for sending email
|
*@brief API for sending email
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
use PHPMailer\PHPMailer\SMTP;
|
||||||
/**
|
/**
|
||||||
*@class Sendmail_Core
|
*@class Sendmail_Core
|
||||||
*@brief API for sending email
|
*@brief API for sending email
|
||||||
|
|
@ -43,19 +44,35 @@ class Sendmail_Core
|
||||||
protected $subject;
|
protected $subject;
|
||||||
protected $message;
|
protected $message;
|
||||||
protected $from;
|
protected $from;
|
||||||
protected $content;
|
protected $header; //!< unused
|
||||||
protected $header;
|
protected $format; //!< PLAIN or HTML, message format
|
||||||
protected $format;
|
|
||||||
|
|
||||||
protected $supplemental_header; //!< $supplemental_header(string) supplemental header to add
|
protected $supplemental_header; //!< $supplemental_header(string) supplemental header to add
|
||||||
protected $supplemental_param; //!< $supplemental_param (string) 5th parameter for mail()
|
protected $supplemental_param; //!< $supplemental_param (string) 5th parameter for mail()
|
||||||
// for postfix, it should be "-f {$this->from}" for the Return-Path
|
// for postfix, it should be "-f {$this->from}" for the Return-Path
|
||||||
|
protected $phpmailer; //!< PHPMailer object;
|
||||||
|
protected $blind_copy; //!< email of blind copy (list of emails separated by comma)
|
||||||
|
protected $reply_to; //!< reply to
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->format='PLAIN';
|
$this->format='PLAIN';
|
||||||
$this->supplemental_header="";
|
$this->supplemental_header="";
|
||||||
$this->supplemental_param=MAIL_EXTRA_PARAM;
|
$this->supplemental_param=MAIL_EXTRA_PARAM;
|
||||||
|
$this->phpmailer = new PHPMailer;
|
||||||
|
$this->phpmailer->CharSet = PHPMailer::CHARSET_UTF8;
|
||||||
|
|
||||||
|
//$this->phpmailer->SMTPDebug = SMTP::DEBUG_CLIENT;
|
||||||
|
$this->phpmailer->SMTPDebug = SMTP::DEBUG_OFF;
|
||||||
|
$this->phpmailer->isSendmail(true);
|
||||||
|
$this->phpmailer->XMailer = "noalyss-email";
|
||||||
|
$this->phpmailer->Host = "localhost";
|
||||||
|
$this->phpmailer->Port = "25";
|
||||||
|
$this->phpmailer->Username = "";
|
||||||
|
$this->phpmailer->Password = "";
|
||||||
|
$this->phpmailer->SMTPAuth = false;
|
||||||
|
$this->afile=[];
|
||||||
|
|
||||||
}
|
}
|
||||||
public function getSupplemental_param()
|
public function getSupplemental_param()
|
||||||
{
|
{
|
||||||
|
|
@ -67,8 +84,18 @@ class Sendmail_Core
|
||||||
$this->supplemental_param = $supplemental_param;
|
$this->supplemental_param = $supplemental_param;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
public function getPhpmailer()
|
||||||
|
{
|
||||||
|
return $this->phpmailer;
|
||||||
|
}
|
||||||
|
|
||||||
public function getSupplemental_header()
|
public function setPhpmailer($phpmailer)
|
||||||
|
{
|
||||||
|
$this->phpmailer = $phpmailer;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSupplemental_header()
|
||||||
{
|
{
|
||||||
return $this->supplemental_header;
|
return $this->supplemental_header;
|
||||||
}
|
}
|
||||||
|
|
@ -172,96 +199,42 @@ class Sendmail_Core
|
||||||
*/
|
*/
|
||||||
function compose()
|
function compose()
|
||||||
{
|
{
|
||||||
$this->verify();
|
$this->phpmailer->setFrom($this->from);
|
||||||
$this->header="";
|
|
||||||
$this->content="";
|
if ( $this->format == "HTML")
|
||||||
|
|
||||||
// a random hash will be necessary to send mixed content
|
|
||||||
$separator = md5(time());
|
|
||||||
|
|
||||||
// carriage return type (we use a PHP end of line constant)
|
|
||||||
$eol = PHP_EOL;
|
|
||||||
|
|
||||||
// main header (multipart mandatory)
|
|
||||||
$this->header = "From: " . $this->from . $eol;
|
|
||||||
$this->header .= "Reply-To: " . $this->from . $eol;
|
|
||||||
$this->header .= "MIME-Version: 1.0" . $eol;
|
|
||||||
$this->header .= $this->add_supplemental_header();
|
|
||||||
if ($this->format == 'PLAIN')
|
|
||||||
{
|
{
|
||||||
$this->header .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" ;
|
$this->phpmailer->Body = $this->message;
|
||||||
// message PLAIN
|
$this->phpmailer->AltBody = \strip_tags($this->message);
|
||||||
$this->content .= "--" . $separator . $eol;
|
$this->phpmailer->isHTML(true);
|
||||||
$this->content .= "Content-Type: text/plain; charset=UTF-8" . $eol;
|
}
|
||||||
$this->content .= "Content-Transfer-Encoding: 8bit" . $eol.$eol ;
|
else
|
||||||
$this->content .= $this->message . $eol ;
|
{
|
||||||
} elseif ($this->format == 'HTML') {
|
$this->phpmailer->Body = $this->message;
|
||||||
$separator_second=md5(rand());
|
$this->phpmailer->isHTML(false);
|
||||||
|
}
|
||||||
$this->header .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" .$eol ;
|
$this->phpmailer->Subject = $this->subject;
|
||||||
// message PLAIN
|
$nb_file=count($this->afile);
|
||||||
$this->content .= "--" . $separator . $eol;
|
for ($i=0;$i<$nb_file;$i++)
|
||||||
$this->content .= "Content-Type: multipart/alternative; boundary=\"" . $separator_second . "\"".$eol ;
|
{
|
||||||
$this->content.= "--$separator_second".$eol;
|
$this->phpmailer->addAttachment($this->afile[$i]->full_name);
|
||||||
$this->content .= "Content-Type: text/plain; charset=UTF-8; format=flowed".$eol;
|
|
||||||
$this->content .= "Content-Transfer-Encoding: 8bit" . $eol.$eol ;
|
|
||||||
$this->content .= strip_tags($this->message) . $eol ;
|
|
||||||
$this->content.=$eol;
|
|
||||||
$this->content.=$eol;
|
|
||||||
$this->content.=$eol;
|
|
||||||
// message HTML
|
|
||||||
$this->content .= "--" . $separator_second.$eol;
|
|
||||||
$this->content .= "Content-Type: text/html; charset=UTF-8" . $eol;
|
|
||||||
$this->content .= "Content-Transfer-Encoding: 8bit" . $eol.$eol ;
|
|
||||||
$this->content .=<<<eof
|
|
||||||
<!DOCTYPE html>{$eol}
|
|
||||||
<html>{$eol}
|
|
||||||
<head>{$eol}
|
|
||||||
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">{$eol}
|
|
||||||
</head>{$eol}
|
|
||||||
<body>
|
|
||||||
{$eol}
|
|
||||||
{$eol}
|
|
||||||
{$eol}
|
|
||||||
eof;
|
|
||||||
$this->content .= $this->message. $eol ;
|
|
||||||
$this->content .=" </body> </html>".$eol;
|
|
||||||
$this->content .= "--" . $separator_second."--" . $eol;
|
|
||||||
|
|
||||||
}else {
|
|
||||||
throw new \Exception('SC172 : unknow format ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty($this->afile ) )
|
$a_email = explode(',', $this->mailto);
|
||||||
|
foreach ($a_email as $item)
|
||||||
{
|
{
|
||||||
// attachment
|
$this->phpmailer->addAddress($item);
|
||||||
for ($i = 0; $i < count($this->afile); $i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
$file = $this->afile[$i];
|
|
||||||
$file_size = filesize($file->full_name);
|
|
||||||
$mimetype=( $file->type=="")?mime_content_type($file->full_name):$file->type;
|
|
||||||
$handle = fopen($file->full_name, "r");
|
|
||||||
if ( $handle == false ){
|
|
||||||
\record_log("SC159 ".var_export($file,true));
|
|
||||||
throw new Exception ('SC159 email not send file not added'.$file->full_name);
|
|
||||||
}
|
|
||||||
$content = fread($handle, $file_size);
|
|
||||||
fclose($handle);
|
|
||||||
$content = chunk_split(base64_encode($content));
|
|
||||||
$this->content .= "--" . $separator . $eol;
|
|
||||||
$this->content .= "Content-Type: " . $mimetype . "; name=\"" . $file->filename . "\"" . $eol;
|
|
||||||
$this->content .= "Content-Disposition: attachment; filename=\"" . $file->filename . "\"" . $eol;
|
|
||||||
$this->content .= "Content-Transfer-Encoding: base64" . $eol;
|
|
||||||
$this->content.=$eol;
|
|
||||||
$this->content .= $content . $eol ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( empty ($this->afile) ) $this->content.=$eol;
|
$a_blind_copy=explode(",",$this->blind_copy??"");
|
||||||
|
$nb_blind_copy=count($a_blind_copy);
|
||||||
$this->content .= "--" . $separator . "--";
|
for ($i=0;$i<$nb_blind_copy;$i++)
|
||||||
$this->supplemental_param= str_replace("[FROM]", $this->from, $this->supplemental_param);
|
{
|
||||||
|
$this->phpmailer->addBCC($a_blind_copy[$i]);
|
||||||
|
}
|
||||||
|
if ( ! empty ($this->reply_to)) {
|
||||||
|
$this->phpmailer->addReplyTo($this->reply_to);
|
||||||
|
}
|
||||||
|
$this->phpmailer->preSend();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -270,17 +243,6 @@ eof;
|
||||||
*/
|
*/
|
||||||
function send()
|
function send()
|
||||||
{
|
{
|
||||||
try {
|
$this->phpmailer->send();
|
||||||
$this->verify();
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
$encoded_subject = mb_encode_mimeheader( $this->subject, 'UTF-8', 'B');
|
|
||||||
|
|
||||||
if (!mail($this->mailto,$encoded_subject, $this->content,$this->header,$this->supplemental_param))
|
|
||||||
{
|
|
||||||
throw new Exception('send failed');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,11 +90,16 @@ class SMTPMail
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $blind_copy
|
* @param string $blind_copy list of emails BCC separated by a comma
|
||||||
*/
|
*/
|
||||||
public function setBlindCopy($blind_copy): SMTPMail
|
public function setBlindCopy($blind_copy): SMTPMail
|
||||||
{
|
{
|
||||||
$this->phpmailer->addBCC($this->blind_copy);
|
$a_blind_copy=explode(",",$blind_copy??"");
|
||||||
|
$nb_blind_copy=count($a_blind_copy);
|
||||||
|
for ($i=0;$i<$nb_blind_copy;$i++)
|
||||||
|
{
|
||||||
|
$this->phpmailer->addBCC($a_blind_copy[$i]);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,15 @@ form {
|
||||||
width:70%;
|
width:70%;
|
||||||
margin-left:15%;
|
margin-left:15%;
|
||||||
}
|
}
|
||||||
|
#otp_code_span {
|
||||||
|
font-size:160%;
|
||||||
|
color:navy;
|
||||||
|
background-color:white;
|
||||||
|
padding:0.8rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<img id="logo_id" src="image/logo10000.png" >
|
<img id="logo_id" src="image/logo10000.png" >
|
||||||
<div class="content">
|
<div class="content" style="display:flex;flex-direction: row;justify-content: space-evenly;">
|
||||||
<?php
|
<?php
|
||||||
use Endroid\QrCode\Color\Color;
|
use Endroid\QrCode\Color\Color;
|
||||||
use Endroid\QrCode\Encoding\Encoding;
|
use Endroid\QrCode\Encoding\Encoding;
|
||||||
|
|
@ -180,10 +186,45 @@ try {
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $writer->write($qrCode);
|
$result = $writer->write($qrCode);
|
||||||
echo '<div style="margin:4rem">';
|
echo '<div id="otp_qrcode" >';
|
||||||
// generate the QRCode
|
// generate the QRCode
|
||||||
echo '<h1>',_("Scanner ceci avec votre application OTP"),'</h1>';
|
echo '<h1>',_("Scanner ceci avec votre application OTP"),'</h1>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo '<p>';
|
||||||
|
echo _("Scanner ce QRCode avec votre application OTP afin de l'ajouter");
|
||||||
|
echo '</p>';
|
||||||
|
echo '<p>';
|
||||||
|
|
||||||
|
echo _("Dans votre application OTP vous devez avoir ce nombre ");
|
||||||
|
|
||||||
|
?>
|
||||||
|
<span id="otp_code_span">
|
||||||
|
<?=$authenticator->compute_code($secret)?>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo '</p>';
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
printf('<img src="data:image/png;base64,%s">', base64_encode($result->getString()));
|
||||||
|
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
record_log($e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="otp_install">
|
||||||
|
<h1><?=_("Installation d'une application OTP")?></h1>
|
||||||
|
<p>
|
||||||
|
<?=_("Si vous n'en avez pas installé sur votre smartphone ou PC, voici notre sélection")?>
|
||||||
|
</p>
|
||||||
|
<h2>
|
||||||
|
<?=_("Android")?>
|
||||||
|
</h2>
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp" target="_blank">FreeOTP (libre)</a>
|
<a href="https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp" target="_blank">FreeOTP (libre)</a>
|
||||||
|
|
@ -195,22 +236,43 @@ try {
|
||||||
<a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">Google Authenticator</a>
|
<a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">Google Authenticator</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<?php
|
<h2>
|
||||||
echo '<p>';
|
<?=_('IPhone')?>
|
||||||
echo _("Scanner ce QRCode avec votre application OTP afin de l'ajouter");
|
|
||||||
|
</h2>
|
||||||
if ( DEBUGNOALYSS > 1) { echo "code attendu",$authenticator->code();}
|
<ol>
|
||||||
echo '</p>';
|
<li>
|
||||||
|
<a href="https://apps.apple.com/fr/app/freeotp-authenticator/id872559395" target="_blank">FreeOTP (libre)</a>
|
||||||
|
</li>
|
||||||
printf('<img src="data:image/png;base64,%s">', base64_encode($result->getString()));
|
</ol>
|
||||||
|
<h2>
|
||||||
} catch (Exception $exc) {
|
PC
|
||||||
record_log($e);
|
</h2>
|
||||||
return;
|
<p>
|
||||||
}
|
|
||||||
?>
|
<?=_("Article à propos de otpclient")?>
|
||||||
|
<a href="https://blog.apps.education.fr/articles/otpclient-un-client-otp-sur-gnulinux-tres-utile2023-01-08t165554043z">
|
||||||
|
OTPClient , un outil très utile sous PC
|
||||||
|
</a>
|
||||||
|
<br/>
|
||||||
|
<?=_('Debian , Ubuntu,...')?>
|
||||||
|
<code>
|
||||||
|
apt install otpclient
|
||||||
|
</code>
|
||||||
|
</p>
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/paolostivanin/OTPClient" target="_blank">Site OTPClient </a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function refresh_code() {
|
||||||
|
new Ajax.Updater("otp_code_span","compute.php",{parameters:{secret:"<?=$secret?>",action:"qr_refresh"}});
|
||||||
|
}
|
||||||
|
setInterval(refresh_code, 500);
|
||||||
|
</script>
|
||||||
|
|
@ -146,8 +146,9 @@ class Ajax_MiscTest extends TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
$_REQUEST = $_POST = $_GET = $query;
|
$_REQUEST = $_POST = $_GET = $query;
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
require NOALYSS_HOME . '/fid.php';
|
include NOALYSS_HOME . '/fid.php';
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
|
@ -155,10 +156,41 @@ class Ajax_MiscTest extends TestCase
|
||||||
{"flabel":"e_march4_label","name":"Inserted by PHPUNIT-Ajax_MiscTest:createCard_MA1 ","ftva_id":"e_march4_tva_id","tva_id":"210A","fPrice_sale":"e_march4_price","sell":"0","fPrice_purchase":"e_march4_price","buy":"0","answer":"ok"}
|
{"flabel":"e_march4_label","name":"Inserted by PHPUNIT-Ajax_MiscTest:createCard_MA1 ","ftva_id":"e_march4_tva_id","tva_id":"210A","fPrice_sale":"e_march4_price","sell":"0","fPrice_purchase":"e_march4_price","buy":"0","answer":"ok"}
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
$this->assertEquals($expected, $content, "Incorrect answer");
|
$this->assertEquals($expected, $content, "Incorrect answer $content");
|
||||||
|
|
||||||
// clean card
|
// clean card
|
||||||
$this->cleanCard($fiche->id);
|
$this->cleanCard($fiche->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testComputeQRCODE()
|
||||||
|
{
|
||||||
|
$_POST['secret']="QJPJXHOJ77B76WYEFURCSHRMVI7JC7FBRJA2QH34T4SXANVQUDYA";
|
||||||
|
$_POST['action']="qr_refresh";
|
||||||
|
ob_start();
|
||||||
|
include NOALYSS_HOME."/compute.php";
|
||||||
|
$x= ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
$this->assertTrue($x==floatval($x),"Invalid return $x");
|
||||||
|
}
|
||||||
|
public function testCompute1()
|
||||||
|
{
|
||||||
|
$_POST=$_REQUEST=$_GET=array (
|
||||||
|
'gDossier' => DOSSIER,
|
||||||
|
'c'=>'PORA',
|
||||||
|
't'=>1,
|
||||||
|
'p'=>600,
|
||||||
|
'q'=>1,
|
||||||
|
'n'=>0,
|
||||||
|
'other_tax_id' => -1
|
||||||
|
);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
include NOALYSS_HOME."/compute.php";
|
||||||
|
$content = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
$expected='{"ctl":0,"htva":600,"tva":126,"tvac":"726.0000","other_tax":0}'."\n";
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $content, "Incorrect answer $content");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -194,17 +194,6 @@ class Acc_DocumentTest extends TestCase {
|
||||||
// return array([1], [2], [3]);
|
// return array([1], [2], [3]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
|
||||||
* @testdox description of the test
|
|
||||||
* @covers Acc_Balance::summary_add
|
|
||||||
* @depend Acc_Balance::summary_init
|
|
||||||
* @backupGlobals enabled
|
|
||||||
* @dataProvider dataExample
|
|
||||||
* @global $g_connection
|
|
||||||
*/
|
|
||||||
function testFunction() {
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @testdox Test the standard invoice, check file
|
* @testdox Test the standard invoice, check file
|
||||||
* @covers Document::generate
|
* @covers Document::generate
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ class Acc_TVATest extends TestCase
|
||||||
return array(
|
return array(
|
||||||
['S',true,null]
|
['S',true,null]
|
||||||
,['Z',true,null]
|
,['Z',true,null]
|
||||||
,['A',false,""]
|
,['A',true,""]
|
||||||
,['K',true,"XX"]
|
,['K',true,"XX"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +159,7 @@ class Acc_TVATest extends TestCase
|
||||||
if ( $result != $check)
|
if ( $result != $check)
|
||||||
{
|
{
|
||||||
print "Error for $peppopl_code\n";
|
print "Error for $peppopl_code\n";
|
||||||
print_r($tva_rate_mtable->aerror);
|
print_r($tva_rate_mtable->get_aerror());
|
||||||
$this->display_error($tva_rate_mtable);
|
$this->display_error($tva_rate_mtable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ class FacturXTest extends TestCase {
|
||||||
function testBuild_Data() {
|
function testBuild_Data() {
|
||||||
$cn=\Dossier::connect();
|
$cn=\Dossier::connect();
|
||||||
$facturx=new \Noalyss\XMLDocument\FacturX($cn);
|
$facturx=new \Noalyss\XMLDocument\FacturX($cn);
|
||||||
|
$data=$facturx->get_data() ;
|
||||||
|
$this->assertTrue($data == []
|
||||||
|
," Build Data fails : get null value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -137,6 +140,6 @@ class FacturXTest extends TestCase {
|
||||||
$customer=$facturx->get_data()['customer'];
|
$customer=$facturx->get_data()['customer'];
|
||||||
$a_error = $facturx->check_customer_data($customer['card_id']);
|
$a_error = $facturx->check_customer_data($customer['card_id']);
|
||||||
print_r($a_error);
|
print_r($a_error);
|
||||||
$this->assertTrue(count($a_error)==6, "nb of error incorrect ,expected 6, received = ".print_r($a_error,true));
|
$this->assertTrue(count($a_error)==5, "nb of error incorrect (JR_INTERNAL=V000002),expected 5, received = ".print_r($a_error,true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ class InvoiceUBL21Test extends TestCase {
|
||||||
function testBuild_Data() {
|
function testBuild_Data() {
|
||||||
$cn = \Dossier::connect();
|
$cn = \Dossier::connect();
|
||||||
$ublinvoice21 = new \Noalyss\XMLDocument\InvoiceUBL21($cn);
|
$ublinvoice21 = new \Noalyss\XMLDocument\InvoiceUBL21($cn);
|
||||||
|
$this->assertTrue($ublinvoice21->get_data()==[],"Data is not empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -170,6 +171,6 @@ class InvoiceUBL21Test extends TestCase {
|
||||||
$ublinvoice21->build_data(2);
|
$ublinvoice21->build_data(2);
|
||||||
$customer = $ublinvoice21->get_data()['customer'];
|
$customer = $ublinvoice21->get_data()['customer'];
|
||||||
$a_error=$ublinvoice21->check_customer_data($customer['card_id']);
|
$a_error=$ublinvoice21->check_customer_data($customer['card_id']);
|
||||||
$this->assertTrue(count($a_error) ==6 , " nb of errors incorrect ".print_r($a_error,true));
|
$this->assertTrue(count($a_error) ==7 , " nb of errors incorrect ".print_r($a_error,true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue