PHPRad Classic Initial 2.7.3 Forum

PHPRad Forum => Issues => Topic started by: dobsun on April 03, 2020, 10:27:11 PM

Title: I intend to buy, but some issues?
Post by: dobsun on April 03, 2020, 10:27:11 PM
OK, So I would like to build simple store, web based inventory DB, with POS, with add product, add to cart, add sale, something practical, calculating quantity, to be able to export few .pdf files, send to email, auto store issued docs and some other options...
 
 have downloaded trial 2.7.2

1st issue? I got this msg:
trial software failed to start
string was not recognized as a valid DateTime
something went wrong. please visit phprad.com for more info
is it ok?

2nd issue:
my understanding of php and JS is basic!  Here I found a lot of functions and is hard to see hole picture
Do you have more documentation for the structure? more details of the functions? 

3th issue:
search issue : so i have product table and category table,
relation is made and so category_id, calls category_name  in product.list
why search option is not searching by category?

4th:
I have few good working script for add to cart and I'm submitting by link in product.list , so $_session[product_id]  is made, but there is some delay, needs refresh.... may by due to form issue  ... or my function_count_cart is not loading first time...
question is : Are providing similar solutions for add to cart?  or we should find our self how to solve? Do you have tutorial?
Do you provide projects as simple store, simple inventory, invoice etc...?

5th:
export to word/pdf gives blank pages? why?
Title: Re: I intend to buy, but some issues?
Post by: willvin on April 06, 2020, 01:31:37 AM
@dobsun‍ 
1st issue? I got this msg:

Provide a screenshot of the message.

2nd issue:
At the top of the phprad app, you will see a View Helper with a list of variables/functions and their explanations.


3th issue:
Because of issues encountered in previous versions of phprad due to search on a master-details page.

4th:
Not clear enough.

5th:
From my end everything works fine please make sure the page you are exporting contains data and that you are using default settings to make sure the issue is not with your export configuration.
Title: Re: I intend to buy, but some issues?
Post by: dobsun on April 06, 2020, 01:42:39 PM
@wilvin
1# see attached
2# I saw that, ok
3# So how to search, in both tables then? combined table?
4#  I want to make function_add_ to_document by session to submit information from different tables like: company_table(name,adress,email) , condition_table(case1,case2...n), product_table(prod_1,prod_2...n), partner_table(name,info,etc) and so that info will go to form_page by button "add"  right next to view,edit,delete in list.php.
question is :  Do you have function for add to session like that or  function_add_to_cart.... ?
I just like to keep in the framework in order, to keep updating site in future...
5# export to word/pdf give error see attached, excel is OK, csv gives monkeys for all Cyrillic... my BD_collation  utf8_general_ci
Title: Re: I intend to buy, but some issues?
Post by: willvin on April 06, 2020, 03:03:09 PM
@dobsun
1# Go to C:\ProgramData\RadSystems\PHPRad\1.0.0.0\ and delete this files( PHPRadClassicDefaultSettings-2.7.1.bin and PHPRadClassicDefaultSettings.bin) if they exists and start the phprad app.
3# please use the join configuration in list page properties to join tables and configure search on them.
4# yes there is a function for it, if you read through the view helper you will see that there is a function called set_cookie($name,$value,$days=30), get_cookie($name)and clear_cookie($name) with their explanation on how to use it.
5# follow this https://phprad.com/forum/index.php?topic=748.0 (https://phprad.com/forum/index.php?topic=748.0) to solve the issue.
Title: Re: I intend to buy, but some issues?
Post by: dobsun on April 06, 2020, 08:09:51 PM
@wilvin
1#after delete file  PHPRadClassicDefaultSettings-2.7.1.bin come back over and over... /I will manage with that ...will see logs,services, reinstall.../
3#ok
4#ok
5# I will look on that, but not sure will work, as Cyrillic here came from mysql_db, not from language.ini

Thank you !
BR,
Dobrin
Title: Re: I intend to buy, but some issues?
Post by: dobsun on April 06, 2020, 08:37:18 PM
5# NO export to pdf/doc in Cyrillic is not solved by language.ini ... see attached
....is there so restrictions as allowed_charset?
Title: Re: I intend to buy, but some issues?
Post by: willvin on April 07, 2020, 12:41:57 PM
@dobsun‍ please use an external browser to test for the error
Title: Re: I intend to buy, but some issues?
Post by: dobsun on April 07, 2020, 10:32:47 PM
@wilvin
hi,
the aim of my project is to issue documents, so pdf export is key for me
pdf export is working fine in english/latin but not in Cyrillic?
I have try to identify where to look and few possible problems:
#browsers - same story, all browsers give same error
#collation - I have try that: changing collation in the db, but no...
#php version - 7.4.1. all looks fine for me
#font issue - ? what font uses, are they Cyrillic compatible? where to look
#report_layout.php - Maybe the key is here? - I wrote some Cyrillic  manually ... for test:  there was no error, but pdf was with monkey on that place?  css?
#maybe we should look in Warning msg:  DOMDocumentFragment::appendXML(), Warning: DOMNode::appendChild()....
https://stackoverflow.com/questions/4645738/domdocument-appendxml-with-special-characters - some talks about...

I've study your code to find a way, but to complex for me, I'm lost
Title: Re: I intend to buy, but some issues?
Post by: willvin on April 08, 2020, 11:21:43 AM
@dobsun‍ thanks for the info, I will pass it across to the dev team.
But first, do the following and let me know how it goes.
open this file system/BaseView.php with a code editor, locate line 743, you should see the following:
Code: [Select]
$fragment->appendXML($html);
replace it with this:
Code: [Select]
$fragment->nodeValue = $html;
Title: Re: I intend to buy, but some issues?
Post by: dobsun on April 08, 2020, 03:09:46 PM
@willvin
nodeValue - not working for  both English and cyr
I'm almost sure it is a font problem, but I don't know how to import Cyrillic font in dompdf
https://stackoverflow.com/questions/27780035/itextpdf-html-to-pdf-containing-cyrillic-letters
I seeking for arial cyrillic and so: here is working link:  https://code.google.com/archive/p/ipwn/downloads
https://stackoverflow.com/questions/990181/dompdf-problem-with-cyrillic-characters
http://fabrikar.com/forums/index.php?threads/fatal-error-class-dompdf-options.47068/#post-243961
 how to import? I saw the folder, but is not simple copy in...
Strange is that, it is the same problem for *.doc
Title: Re: I intend to buy, but some issues?
Post by: willvin on April 09, 2020, 08:19:46 PM
@dobsun‍ Following the second answer from here https://stackoverflow.com/questions/990181/dompdf-problem-with-cyrillic-characters (https://stackoverflow.com/questions/990181/dompdf-problem-with-cyrillic-characters), add this code
Code: [Select]
body { font-family: DejaVu Sans; }
to your custom css and preview.
If you want to follow the steps stated here https://stackoverflow.com/questions/990181/dompdf-problem-with-cyrillic-characters (https://stackoverflow.com/questions/990181/dompdf-problem-with-cyrillic-characters), this is where you can locate the DOMPDF folder in phprad vendor\dompdf\dompdf.
Title: Re: I intend to buy, but some issues?
Post by: dobsun on April 09, 2020, 10:45:03 PM
@wilvin
hi,
yes, I try dejavu sans in report_layout.php... not working, modify css in dompdf -not working
I'm lost !
For testing I create ppm with two tables alphabet english and bulgarian see attached
export to pdf english is OK, bulgarian is not
Title: Re: I intend to buy, but some issues?
Post by: dobsun on April 14, 2020, 09:46:54 PM
@wilvin
Hi,
little success !
in report_layout.php
<meta http-equiv="content-type" content="text/html; charset=utf-8">
in .htaccess
AddDefaultCharset UTF-8

export to word document is working perfect!
export to pdf document is working, at least no errors,  but we have ? ? ? ? ? ? instead of cyrillic !
help me find a solution for that?
Title: Re: I intend to buy, but some issues?
Post by: willvin on April 15, 2020, 08:45:38 AM
@dobsun‍ I will look into that and get back to you.
Title: Re: I intend to buy, but some issues?
Post by: dobsun on April 15, 2020, 09:37:09 AM
@willvin
fixed, finally ! I was trying with DejaVu Sans before then with Arial so when I back to DejaVu Sans it worked!

If other have similar issue  ? ? ? ? ? ? instead of cyrillic or empty pages  or Warning msg:  DOMDocumentFragment::appendXML(), Warning: DOMNode::appendChild()....when exporting to PDF/WORD,
please do the following:

find report_layout.php
put that in head:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
in <style> find font-family and change to:
font-family: DejaVu Sans;

If your Apache is not accessible put/change this in:
.htaccess
AddDefaultCharset UTF-8

Take care!
Title: Re: I intend to buy, but some issues?
Post by: willvin on April 17, 2020, 06:03:15 PM
@dobsun‍ and anyone that needs a perfect solution, please take the following steps the issue will be fixed in the next phprad update.

add this code
Code: [Select]
<meta charset="UTF-8">
in the head tag before <title><?php echo $this->report_title; ?></title> and replace this
Code: [Select]
 body,
 h1,
 h2,
 h3,
 h4,
 h5,
 h6 {
 margin: 0px;
 padding: 0px;
 font-family: Arial, Helvetica, sans-serif;
 }
with this
Code: [Select]
 body,
 h1,
 h2,
 h3,
 h4,
 h5,
 h6 {
 margin: 0px;
 padding: 0px;
 font-family: "DejaVu Sans";
 }
in app/views/layouts/report_layout.php.

Now replace the following
Code: [Select]
 /**
 * DomDocument Manipulation
 * Set the inner html of a page element
 * @return string
 */
 private function setInnerHTML($element, $html)
 {
 $html = htmlentities($html);
 $fragment = $element->ownerDocument->createDocumentFragment();
 $fragment->appendXML($html);
 $clone = $element->cloneNode(); // Get element copy without children
 $clone->appendChild($fragment);
 $element->parentNode->replaceChild($clone, $element);
 }
with this
Code: [Select]
 /**
 * DomDocument Manipulation
 * Set the inner html of a page element
 * @return string
 */
 private function setInnerHTML($element, $html)
 {
 $html = html_entity_decode($html);
 $html = fixWrongUTF8Encoding($html);
 $fragment = $element->ownerDocument->createDocumentFragment();
 $fragment->appendXML($html);
 $clone = $element->cloneNode(); // Get element copy without children
 $clone->appendChild($fragment);
 $element->parentNode->replaceChild($clone, $element);
 }
in system/BaseView.php.

and finally, add this function
Code: [Select]
function fixWrongUTF8Encoding($String) { 
 $fix_accent_list = array(
 // 3 char errors first
 '‚' => '‚', '„' => '„', '…' => '…', '‡' => '‡',
 '‰' => '‰', '‹' => '‹', '‘' => '‘', '’' => '’',
 '“' => '“', '•' => '•', '–' => '–', '—' => '—',
 'â„¢' => '™', '›' => '›', '€' => '€',
 // 2 char errors
 'Â'  => 'Â', 'Æ’'  => 'ƒ', 'Ã'  => 'Ã', 'Ä'  => 'Ä',
 'Ã…'  => 'Å', 'â€'  => '†', 'Æ'  => 'Æ', 'Ç'  => 'Ç',
 'ˆ'  => 'ˆ', 'È'  => 'È', 'É'  => 'É', 'Ê'  => 'Ê',
 'Ë'  => 'Ë', 'Å’'  => 'Œ', 'ÃŒ'  => 'Ì', 'Ž'  => 'Ž',
 'ÃŽ'  => 'Î', 'Ñ'  => 'Ñ', 'Ã’'  => 'Ò', 'Ó'  => 'Ó',
 'â€'  => '”', 'Ô'  => 'Ô', 'Õ'  => 'Õ', 'Ö'  => 'Ö',
 '×'  => '×', 'Ëœ'  => '˜', 'Ø'  => 'Ø', 'Ù'  => 'Ù',
 'Å¡'  => 'š', 'Ú'  => 'Ú', 'Û'  => 'Û', 'Å“'  => 'œ',
 'Ãœ'  => 'Ü', 'ž'  => 'ž', 'Þ'  => 'Þ', 'Ÿ'  => 'Ÿ',
 'ß'  => 'ß', '¡'  => '¡', 'á'  => 'á', '¢'  => '¢',
 'â'  => 'â', '£'  => '£', 'ã'  => 'ã', '¤'  => '¤',
 'ä'  => 'ä', 'Â¥'  => '¥', 'Ã¥'  => 'å', '¦'  => '¦',
 'æ'  => 'æ', '§'  => '§', 'ç'  => 'ç', '¨'  => '¨',
 'è'  => 'è', '©'  => '©', 'é'  => 'é', 'ª'  => 'ª',
 'ê'  => 'ê', '«'  => '«', 'ë'  => 'ë', '¬'  => '¬',
 'ì'  => 'ì', '®'  => '®', 'î'  => 'î', '¯'  => '¯',
 'ï'  => 'ï', '°'  => '°', 'ð'  => 'ð', '±'  => '±',
 'ñ'  => 'ñ', '²'  => '²', 'ò'  => 'ò', '³'  => '³',
 'ó'  => 'ó', '´'  => '´', 'ô'  => 'ô', 'µ'  => 'µ',
 'õ'  => 'õ', '¶'  => '¶', 'ö'  => 'ö', '·'  => '·',
 '÷'  => '÷', '¸'  => '¸', 'ø'  => 'ø', '¹'  => '¹',
 'ù'  => 'ù', 'º'  => 'º', 'ú'  => 'ú', '»'  => '»',
 'û'  => 'û', '¼'  => '¼', 'ü'  => 'ü', '½'  => '½',
 'ý'  => 'ý', '¾'  => '¾', 'þ'  => 'þ', '¿'  => '¿',
 'ÿ'  => 'ÿ', 'À'  => 'À',
 // 1 char errors last
 'Ã' => 'Á', 'Å' => 'Š', 'Ã' => 'Í', 'Ã' => 'Ï',
 'Ã' => 'Ð', 'Ã' => 'Ý', 'Ã' => 'à', 'í' => 'í'
 );
 
 //Cyrillic/Russian characters
 $Cyrillic = [
 'а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п',
 'р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я',
 'А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П',
 'Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я'
 ];
 
 //Cyrillic/Russian characters in UTF-8
 $UTF8Equivalent = ['а','б','в','г','д','е','Ñ‘','ж','з','и','й','к','л','м','н','о','п','Ñ€','с','Ñ‚','у','Ñ„','Ñ…','ц','ч','ш','щ','ÑŠ','Ñ‹','ÑŒ','э','ÑŽ','я', 'А','Б','Ð’','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','Ðœ','Н','О','П', 'Ð ','С','Т','У','Ф','Ð¥','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я'
 ];

 //we get our accent characters and its utf-8 equivalent characters
 $error_chars = array_keys($fix_accent_list);
 $real_chars  = array_values($fix_accent_list);
 
 //we relpace the weird utf-8 accent characters with its appropriate characters
 $String = str_replace($UTF8Equivalent, $Cyrillic, $String);   

 //we replace the weird utf-8 cyrillic characters with its appropriate characters and return it.
 return str_replace($error_chars, $real_chars, $String);
}
to helpers/functions.php.

Now preview and enjoy ;) .


Title: Re: I intend to buy, but some issues?
Post by: Mohammed A. ALmosawi on June 07, 2020, 04:58:45 PM
Hi Willvin,
I'm Using Arabic lang.
I tried exactly as in this post , for print function works perfectly after I add to  Print_layout.php the following
Code: [Select]
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
And
Code: [Select]
font-family: "DejaVu Sans";
and other function Pdf & word stop gave me the error  DOMDocumentFragment::appendXML():,
BUT it not display  correctly , in Arabic,  letters are tied together not separate also its display in  RTL as in the attached .
Pict1 the way it should work ,
Pict1 (https://drive.google.com/file/d/1oAskkW-xIywJllXuHbzuPyHKzyy4oSDY/view?usp=sharing)
Pict2 the way it currently work _Wrong way.
Pict2 (https://drive.google.com/file/d/1GC28F4AQ302oZyFPzKE47pirtxcazWq7/view?usp=sharing)
thanx .

 
Title: Re: I intend to buy, but some issues?
Post by: Euder on July 09, 2020, 07:00:42 PM
Hi Wilvin,

It is working perfectly when printing but when gerenating PDF, we´ve got the message below:

Warning: DOMDocumentFragment::appendXML(): Entity: line 6622: parser error : xmlParseEntityRef: no name in C:\xampp\htdocs\raiodesol\system\BaseView.php on line 744

Warning: DOMDocumentFragment::appendXML(): <span data-value="ELIAS DESOUZA & in C:\xampp\htdocs\raiodesol\system\BaseView.php on line 744

Can you help me to fix it?

Thanks!
Title: Re: I intend to buy, but some issues?
Post by: willvin on July 10, 2020, 07:54:12 AM
@Euder‍ did you follow the complete steps?
Title: Re: I intend to buy, but some issues?
Post by: Euder on July 10, 2020, 02:07:15 PM
Hi Wilvin!

I´ve found the error. Let me explain because it could be helpful for others developers:

I was trying to print a page with a custom view. I revised the HTML-Php code in the custom view and I found an error when closing an <a> tag. Apparently, when I see the page in the browser there was no error but when printing this error was propagated to the function that manipulates de DOM.

So, your recommendation above ran perfectly.

Thanks!!
Title: Re: I intend to buy, but some issues?
Post by: gioco on March 31, 2021, 01:24:32 PM
Partially working. Now the error is disappeared, but the export is empty.
Title: Re: I intend to buy, but some issues?
Post by: Ilham on December 01, 2021, 05:11:36 PM
Please sir where to find report_layout.php?
Title: Re: I intend to buy, but some issues?
Post by: fabiohdpaiva on February 10, 2023, 04:22:00 PM
I'm Brazilian, sorry for my English.

Problem solved for those who don't need Cyrillic characters.

In Functions.php add this:

Code: [Select]
function fixWrongUTF8Encoding($String) {
 $fix_accent_list = array(
     ''     => '&nbsp;',
     '>'    => '&gt;',
     '<'    => '&lt;',
     '&'    => '&amp;',
     '"'    => '&quot;'
 );
 
 
 //we get our accent characters and its utf-8 equivalent characters
 $error_chars = array_keys($fix_accent_list);
 $real_chars  = array_values($fix_accent_list);
 

 return str_replace($error_chars, $real_chars, $String);
}

In BaseView.php replace this

Code: [Select]
private function setInnerHTML($element, $html)
 {
 $html = htmlentities($html);
 $fragment = $element->ownerDocument->createDocumentFragment();
 $fragment->appendXML($html);
 $clone = $element->cloneNode(); // Get element copy without children
 $clone->appendChild($fragment);
 $element->parentNode->replaceChild($clone, $element);
 }

with this

Code: [Select]
private function setInnerHTML($element, $html)
     {
        
         $html = fixWrongUTF8Encoding($html);
         $html = html_entity_decode($html);
         $fragment = $element->ownerDocument->createDocumentFragment();
         $fragment->appendXML($html);
         $clone = $element->cloneNode(); // Get element copy without children
         $clone->appendChild($fragment);
         $element->parentNode->replaceChild($clone, $element);
     }

You don't need to change anything in the report_layout.php file.

I hope it helped you.
Title: Re: I intend to buy, but some issues?
Post by: nascoli on February 12, 2023, 11:21:01 PM
Thank you!


I'm Brazilian, sorry for my English.

Problem solved for those who don't need Cyrillic characters.

In Functions.php add this:

Code: [Select]
function fixWrongUTF8Encoding($String) {
 $fix_accent_list = array(
     ''     => '&nbsp;',
     '>'    => '&gt;',
     '<'    => '&lt;',
     '&'    => '&amp;',
     '"'    => '&quot;'
 );
 
 
 //we get our accent characters and its utf-8 equivalent characters
 $error_chars = array_keys($fix_accent_list);
 $real_chars  = array_values($fix_accent_list);
 

 return str_replace($error_chars, $real_chars, $String);
}

In BaseView.php replace this

Code: [Select]
private function setInnerHTML($element, $html)
 {
 $html = htmlentities($html);
 $fragment = $element->ownerDocument->createDocumentFragment();
 $fragment->appendXML($html);
 $clone = $element->cloneNode(); // Get element copy without children
 $clone->appendChild($fragment);
 $element->parentNode->replaceChild($clone, $element);
 }

with this

Code: [Select]
private function setInnerHTML($element, $html)
     {
        
         $html = fixWrongUTF8Encoding($html);
         $html = html_entity_decode($html);
         $fragment = $element->ownerDocument->createDocumentFragment();
         $fragment->appendXML($html);
         $clone = $element->cloneNode(); // Get element copy without children
         $clone->appendChild($fragment);
         $element->parentNode->replaceChild($clone, $element);
     }

You don't need to change anything in the report_layout.php file.

I hope it helped you.