Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.9.1 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

Create the request sql with php ocs inventory

Hello everywhere,

In my database, I have add two columns, the first one is “Notes” and the second “Annotation” (I’m French) in tables “hardware”. The columns “Notes” make the status of the PC (storage, production or broke) and the columns “Annotation”, a little describe of the user (Maintenance Office).

 I’m wrote two request.

First request (for the columns “Notes”):

UPDATE hardware

LEFT JOIN itmgmt_comments on itmgmt_comments.HARDWARE_ID=hardware.ID

SET hardware.Notes=itmgmt_comments.COMMENTS 

WHERE hardware.ID=itmgmt_comments.HARDWARE_ID and itmgmt_comments.COMMENTS

LIKE ('%en stock%') or itmgmt_comments.COMMENTS LIKE ('%en prod%') or itmgmt_comments.COMMENTS LIKE ('%a broke%');

Second request (for the columns “Annotations”):

UPDATE hardware

LEFT JOIN itmgmt_comments on itmgmt_comments.HARDWARE_ID=hardware.ID

SET hardware.Annotations=itmgmt_comments.COMMENTS

WHERE hardware.ID=itmgmt_comments.HARDWARE_ID and itmgmt_comments.COMMENTS

 NOT LIKE ('%en stock%') or itmgmt_comments.COMMENTS NOT LIKE ('%en prod%') or itmgmt_comments.COMMENTS NOT LIKE ('%a broke%');

 

The request is work when in I’m directly connect on the database, but now I want create program in php, when you click on the button “OK”, the OCS inventory create the comments in the dashboard and  he add the comments in the columns "Notes" or "Annotations" in view "machine Windows".

Can you help or give a example for the request sql with php?

Best regards

Materials : Server: Ubuntu 18.04, Ocsreports 2.8.1 

 

in Core server development by (210 points)

Please log in or register to answer this question.

 
Powered by Question2Answer
...