Highlighting Specific Records

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Highlighting Specific Records

Post by ronwill » 2018-10-29 15:45

Hi All,

I've been using this code from the AppGini Tutorials in my hooks for an invoice:

// modify the status field of the table view query to display 'Due' invoices in bold red
// $oldArray=$options->QueryFieldsTV;
// $options->QueryFieldsTV='';
// foreach($oldArray as $field => $caption){
// if($field=='`commercial`.`status`'){
// $options->QueryFieldsTV['IF(`commercial`.`status`=\'Due\', \'<b style="color: red; background: white">Due</b>\', IF(`commercial`.`status`=\'Paid\', \'<b style="color: green; background: white">Paid</b>\', `commercial`.`status`))']=$caption;
// }
// else{
// $options->QueryFieldsTV[$field]=$caption;
// }
// }

It's been working fine without any issues until I upgraded from PHP5.6 to PHP7.2 as recommended by my service provider. After upgrade I get a stream of error messages:

Warning: Illegal string offset '`commercial`.`id`' in /homepages/5/d106639433/htdocs/web4u0/hooks/commercial.php on line 37
Warning: Illegal string offset 'IF( CHAR_LENGTH(`webdata1`.`user`), CONCAT_WS('', `webdata1`.`user`), '') /* clientusername */' in /homepages/5/d106639433/htdocs/web4u0/hooks/commercial.php on line 37
Warning: Illegal string offset 'IF( CHAR_LENGTH(`webdata1`.`title`) || CHAR_LENGTH(`webdata1`.`company`), CONCAT_WS('', `webdata1`.`title`, ' - ', `webdata1`.`company`), '') /* Client */' in /homepages/5/d106639433/htdocs/web4u0/hooks/commercial.php on line 37


I've stepped back to PHP7.1 same errors, then PHP7.0 and working again


Just thought I'd point this out in case anyone else uses same code from shown above in any of their projects.

Does anyone have a fix for this?

PHP7.0 has PHP community support until 12/2018 - so bit of time yet!!


Cheers, Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Highlighting Specific Records

Post by pbottcher » 2018-10-29 16:11

Hi,

can you try to initialize your arrary and see.

Change
$options->QueryFieldsTV='';
to
$options->QueryFieldsTV=[];
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Highlighting Specific Records

Post by ronwill » 2018-10-29 16:36

Hi PBöttcher,

Tried your suggestion with both PHP7.1 & PHP7.2 - WORKING ON BOTH

Thank you very much for instant response, suggest the tutorial example is updated to show the same (who does that?)

Thanks again,
Ron :D
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

Post Reply