mateusznitka / protocolsmanager

GLPI Plugin to report users inventory
8 stars 13 forks source link

Add to template user Phone #54

Open verondavidenko opened 2 years ago

verondavidenko commented 2 years ago

Hi, I would like to ask you how i can add the user's phone and other's user data for each new assignment. Thanks

pistokcad commented 2 years ago

You can do it a little php editing. Write on Monday, I'll give a code sample.

verondavidenko @.***> ezt írta (2022. máj. 6. 22:38):

Hi, I would like to ask you how i can add the user's phone and other's user data for each new assignment. Thanks

— Reply to this email directly, view it on GitHubhttps://github.com/mateusznitka/protocolsmanager/issues/54, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARSKV6IJIFQMHYTLIYCBTSLVIV7LBANCNFSM5VJGGJKQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

verondavidenko commented 2 years ago

Hi Mateusznitka/Protocolsmanager

Good! I will write to you on monday.

Thanks.

On Fri, May 6, 2022, 17:57 pistokcad @.***> wrote:

You can do it a little php editing. Write on Monday, I'll give a code sample.

verondavidenko @.***> ezt írta (2022. máj. 6. 22:38):

Hi, I would like to ask you how i can add the user's phone and other's user data for each new assignment. Thanks

— Reply to this email directly, view it on GitHub< https://github.com/mateusznitka/protocolsmanager/issues/54>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/ARSKV6IJIFQMHYTLIYCBTSLVIV7LBANCNFSM5VJGGJKQ

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/mateusznitka/protocolsmanager/issues/54#issuecomment-1120002545, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBX2P5UVUIQ3FTV45UIU4DVIWBTRANCNFSM5VJGGJKQ . You are receiving this because you authored the thread.Message ID: @.***>

pistokcad commented 2 years ago

Hello,

First of all: I'm not programmer, I modified this file with several testig prcess. :) The pastebin is unavailable now, so I can't share the full file - Every line number correspond the original file.

You have to edit this file in protocolmanager\inc:

First step you have to check the database coulum name to your demand. GLPI database --> glpi_users table --> slect the needed column. (phone / phone2 / mobile) - which needed. If you need more or all phone you have to do this several step. In my example I used the database called registration_number. Simply change it to phone or phone2 or mobile. :)

After line 204 I inserted this:

$regnum_db = new User(); $regnum_db->getFromDB($data['id']);

$iterator = $DB->request([ 'FROM' => 'glpi_users', 'WHERE' => ['id' => $id] ]);

$admins = [];

while ($row = $iterator->next()) { $admins[] = [ 'registration_number' => $row['registration_number'] ]; }

//print_r($admins[0][registration_number]); $regisnum=$admins[0][registration_number];

I inserted to line 380: $regisnum = $_POST['regisnum'];

I inserted to linbe 401: $upper_content = str_replace("{registration_number}", $regisnum, $upper_content);

This is the most important thing. In the template I'm using like "hereby I {owner}, registration number {registration number} signed...." --> hereby I pistokcad, registration number 1111/2222/2333 signed....

Also can edit this: template.php (It will chnge the PDF.) Currently I modified the notes of signatures to "behalf of company" - at line 231.

Wolvverine commented 2 years ago

Could you make fork and patch for this, I would like to add here: https://github.com/Wolvverine/protocolsmanager/tree/develop-v10-dompdf

pistokcad commented 2 years ago

Could you make fork and patch for this, I would like to add here: https://github.com/Wolvverine/protocolsmanager/tree/develop-v10-dompdf

I will do it in the near future. I'm on holiday for the next two weeks. (I've never done a fork or patch :) - so I need a little extra time.)

If you have a suggestion for the "would be good" fields - I'll be happy to do it all.

verondavidenko commented 1 year ago

Thanks a lot. ! I will check it. Thanks again.

El lun, 9 may 2022 a las 4:32, pistokcad @.***>) escribió:

Hello,

First of all: I'm not programmer, I modified this file with several testig prcess. :) The pastebin is unavailable now, so I can't share the full file

  • Every line number correspond the original file.

You have to edit this file in protocolmanager\inc:

  • generate.class.php

First step you have to check the database coulum name to your demand. GLPI database --> glpi_users table --> slect the needed column. (phone / phone2 / mobile) - which needed. If you need more or all phone you have to do this several step. In my example I used the database called registration_number. Simply change it to phone or phone2 or mobile. :)

After line 204 I inserted this:

$regnum_db = new User(); $regnum_db->getFromDB($data['id']);

$iterator = $DB->request([ 'FROM' => 'glpi_users', 'WHERE' => ['id' => $id] ]);

$admins = [];

while ($row = $iterator->next()) { $admins[] = [ 'registration_number' => $row['registration_number'] ]; }

//print_r($admins[0][registration_number]); $regisnum=$admins[0][registration_number];

I inserted to line 380: $regisnum = $_POST['regisnum'];

I inserted to linbe 401: $upper_content = str_replace("{registration_number}", $regisnum, $upper_content);

This is the most important thing. In the template I'm using like "hereby I {owner}, registration number {registration number} signed...." --> hereby I pistokcad, registration number 1111/2222/2333 signed....

Also can edit this: template.php (It will chnge the PDF.) Currently I modified the notes of signatures to "behalf of company" - at line 231.

— Reply to this email directly, view it on GitHub https://github.com/mateusznitka/protocolsmanager/issues/54#issuecomment-1120746835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBX2P76C5OSZHL6FNS6UVLVJC5R5ANCNFSM5VJGGJKQ . You are receiving this because you authored the thread.Message ID: @.***>