Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 321 online users. » 3 Member(s) | 318 Guest(s)
|
Latest Threads |
[RESUELTO] - Tipo de impu...
Forum: Administrator Support
Last Post: joebordes
Yesterday, 04:22 PM
» Replies: 18
» Views: 8,679
|
https://cardiavital-erfah...
Forum: Open Discussions
Last Post: bannerliam
Yesterday, 12:09 PM
» Replies: 0
» Views: 21
|
GENDOC imágenes
Forum: Open Discussions
Last Post: joebordes
05-16-2024, 09:58 AM
» Replies: 3
» Views: 66
|
How To Merge 10 Spreadshe...
Forum: Open Discussions
Last Post: stormbreaker
05-16-2024, 06:53 AM
» Replies: 1
» Views: 106
|
Workflow: función para ex...
Forum: User Support
Last Post: Joana
05-14-2024, 02:29 PM
» Replies: 4
» Views: 279
|
loadRelatedListBlock is n...
Forum: Administrator Support
Last Post: raavikant
05-11-2024, 11:57 AM
» Replies: 6
» Views: 2,766
|
Import a big spreasheet
Forum: Open Discussions
Last Post: raavikant
05-04-2024, 06:21 PM
» Replies: 2
» Views: 5,756
|
Workflow send email - mor...
Forum: Open Discussions
Last Post: frelanhardware091
05-04-2024, 12:12 PM
» Replies: 5
» Views: 9,603
|
Actualizar campo relacion...
Forum: User Support
Last Post: joebordes
05-02-2024, 07:48 PM
» Replies: 1
» Views: 97
|
PRODUCTS IN ACCOUNTS BY O...
Forum: User Support
Last Post: joebordes
05-02-2024, 11:28 AM
» Replies: 3
» Views: 486
|
|
|
DASHBOARD |
Posted by: flopezcpa - 04-07-2018, 12:12 PM - Forum: International
- Replies (1)
|
|
Buenos dias, he notado que en el Dashboard, me muestra la cantidad de Cotizaciones Facturas, Cuentaz, etc, que tengo pero en una gráfica, al dar click sobre la gráfica me direcciona al listado, pero me muestra el listado vacio, que puede suceder?
|
|
|
Migrating 'old style' custom validation to a Business Map validation |
Posted by: Guido1982 - 04-06-2018, 07:10 AM - Forum: Administrator Support
- Replies (15)
|
|
I want to migrate a validation I have in a custom validation file to a Business Map Validation. The validation I have now looks like this:
SalesOrderValidation.php
PHP Code:
<?php
global $log,$currentModule,$adb,$current_user;
$screen_values = json_decode($_REQUEST['structure'],true);
$q = "SELECT vtiger_groups.groupname FROM vtiger_groups INNER JOIN vtiger_users2group ON vtiger_groups.groupid = vtiger_users2group.groupid WHERE vtiger_users2group.userid = ?"; $p = array($current_user->id); $r = $adb->pquery($q, $p);
$groups = array();
while ($groupname = $adb->fetch_array($r)) { $groups[] = $groupname['groupname']; }
$q = "SELECT sostatus FROM vtiger_salesorder WHERE salesorderid = ?"; $p = array(vtlib_purify($screen_values['record'])); $r = $adb->pquery($q, $p); $current_status = $adb->query_result($r, 0, 'sostatus');
$q = "SELECT vtiger_role.rolename FROM vtiger_role INNER JOIN vtiger_user2role ON vtiger_role.roleid = vtiger_user2role.roleid WHERE vtiger_user2role.userid = ?"; $p = array($current_user->id); $r = $adb->pquery($q, $p); $rolename = $adb->query_result($r, 0, 'rolename');
if (!in_array('Debiteurenadministratie', $groups) && $current_status == 'Wacht op betaling' && $screen_values['sostatus'] != 'Wacht op betaling') { echo 'U mag de status niet van \'Wacht op betaling\' af halen'; // Translation: You are not allowed to change the status from 'Wacht op betaling' to anything else die(); } else if ($rolename != 'Directeur' && $screen_values['sostatus'] == 'Cancelled' && $current_status != 'Cancelled') { echo 'U mag deze order niet annuleren, alleen de Directeur mag dat'; // Translation: You are not allowed to cancel an order, only the CEO is. die(); }
echo '%%%OK%%%';
This basically checks the user's role and group to see what they can and cannot do to specific SalesOrder statuses. Now I want to migrate this to a Busines map validation. I was thinking along these lines:
Business Map
Code:
<map>
<originmodule>
<originname>SalesOrder</originname>
</originmodule>
<fields>
<field>
<fieldname>sostatus</fieldname>
<validations>
<validation>
<rule>custom</rule>
<restrictions>
<restriction>modules/SalesOrder/ValidateStatus.php</restriction>
<restriction>check_sostatus_permissions</restriction>
<restriction>validate_sostatus_permissions</restriction>
</restrictions>
</validation>
</validations>
</field>
</fields>
</map>
modules/SalesOrder/ValidateStatus.php
PHP Code:
<?php
function validate_sostatus_permissions() {
global $log,$currentModule,$adb,$current_user;
$screen_values = json_decode($_REQUEST['structure'],true);
$q = "SELECT vtiger_groups.groupname FROM vtiger_groups INNER JOIN vtiger_users2group ON vtiger_groups.groupid = vtiger_users2group.groupid WHERE vtiger_users2group.userid = ?"; $p = array($current_user->id); $r = $adb->pquery($q, $p);
$groups = array();
while ($groupname = $adb->fetch_array($r)) { $groups[] = $groupname['groupname']; }
$q = "SELECT sostatus FROM vtiger_salesorder WHERE salesorderid = ?"; $p = array(vtlib_purify($screen_values['record'])); $r = $adb->pquery($q, $p); $current_status = $adb->query_result($r, 0, 'sostatus');
$q = "SELECT vtiger_role.rolename FROM vtiger_role INNER JOIN vtiger_user2role ON vtiger_role.roleid = vtiger_user2role.roleid WHERE vtiger_user2role.userid = ?"; $p = array($current_user->id); $r = $adb->pquery($q, $p); $rolename = $adb->query_result($r, 0, 'rolename');
if (!in_array('Debiteurenadministratie', $groups) && $current_status == 'Wacht op betaling' && $screen_values['sostatus'] != 'Wacht op betaling') { return 'U mag de status niet van \'Wacht op betaling\' af halen'; // Translation: You are not allowed to change the status from 'Wacht op betaling' to anything else die(); } else if ($rolename != 'Directeur' && $screen_values['sostatus'] == 'Cancelled' && $current_status != 'Cancelled') { return 'U mag deze order niet annuleren, alleen de Directeur mag dat'; // Translation: You are not allowed to cancel an order, only the CEO is. die(); }
return true; }
My questions
- Do I have the same 'screen_values' array at my disposal?
- Am I correct to transform my "echo's" into "returns" and expect it to work?
- Am I doing something else terribly wrong?
|
|
|
Importar contactos |
Posted by: construmet4 - 04-04-2018, 11:22 AM - Forum: User Support
- Replies (2)
|
|
Buenos días:
Estoy muy cerca de poner en marcha en producción corebos, pero me hace falta saber si existe alguna forma de importar masivamente contacts, y asignarlos en la importación a cuentas y usuarios. ¿Alguna sugerencia? también me iría bien conocer un modelo de csv para confeccionarlo tal y como ha de ser para importar todos los registros. Muchas gracias
Muchas gracias
|
|
|
|