Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 3 online users. » 0 Member(s) | 1 Guest(s) Bing, Google
|
Latest Threads |
Finetuning the way you se...
Forum: coreBOS Development
Last Post: alexandy40d
12-06-2024, 07:38 AM
» Replies: 4
» Views: 8,148
|
MariaDB Version
Forum: Administrator Support
Last Post: joebordes
11-01-2024, 11:49 AM
» Replies: 1
» Views: 659
|
Product Catalog / parts c...
Forum: Modules/Extension Support
Last Post: joebordes
09-15-2024, 09:40 AM
» Replies: 1
» Views: 1,120
|
Challenges and Best Pract...
Forum: coreBOS Development
Last Post: wishforbes
08-30-2024, 04:21 PM
» Replies: 0
» Views: 730
|
PRODUCTS IN ACCOUNTS BY O...
Forum: User Support
Last Post: jonathanmoore858
08-03-2024, 04:14 PM
» Replies: 4
» Views: 2,787
|
Zapier | Integration
Forum: Modules/Extension Support
Last Post: bernardgbailey
07-29-2024, 11:45 PM
» Replies: 7
» Views: 9,874
|
Versión PHP recomendada
Forum: International
Last Post: joebordes
07-04-2024, 05:42 PM
» Replies: 7
» Views: 3,365
|
Could Someone Give me Adv...
Forum: Open Discussions
Last Post: joebordes
06-27-2024, 08:32 AM
» Replies: 1
» Views: 1,717
|
RESTRICTED FILE
Forum: Administrator Support
Last Post: inspectorflint
06-22-2024, 08:08 AM
» Replies: 7
» Views: 5,697
|
GENDOC imágenes
Forum: Open Discussions
Last Post: joebordes
06-02-2024, 05:11 PM
» Replies: 4
» Views: 2,056
|
|
|
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
|
|
|
INSTANCIAS DE COREBOSCRM |
Posted by: flopezcpa - 04-02-2018, 11:57 PM - Forum: International
- Replies (5)
|
|
Buenas noches:
Tal vez sea posible, pero se puede tener varias instancias de Coreboscrm o varias compañias?
Por ejemplo
192.168.2.103/compañia01
192.168.2.102/compañia02
Es Posible?
|
|
|
Abrir un módulo desde addlink action enviando variables |
Posted by: construmet4 - 04-02-2018, 09:59 AM - Forum: User Support
- Replies (8)
|
|
Buenos días:
Necesito abrir un módulo desde el módulo contactos, pero tiene que enviar varias variables desde dicho módulo contacto, para que los valores de :
MODULO CONTACTO Módulo que se ha de abrir
Contact_id = Related_by
Asignado_a = Asignado_a
Nombre de la cuenta = Nombre de la cuenta
Qué variables tengo que poner en la siguiente línea de código para que me pase esos valores?
$mod_acc->addLink('DETAILVIEWBASIC', 'Add call', 'index.php?odule=LlamadasRecibidas=EditView&parent_id=$RECORD$')
|
|
|
Checking for a week number in a workflow expression |
Posted by: Guido1982 - 03-30-2018, 03:27 PM - Forum: Administrator Support
- Replies (19)
|
|
I have the following setup: - SalesOrders have two fields:
- A dropdown with numbers 1 through 52 for the week no's.
- A dropdown with the coming 10 years (so 2018, 2019 and so on).
Now I'd like to setup a workflow that runs once a week. The purpose of this workflow is to:- First check if the selected year is equal to the current one.
- Then check if the week no. is lower then the current week no.
If those conditions are met, an e-mail should be sent out. Can I do this through the workflow expression engine and if so, does anyone have some pointers on the syntax?
|
|
|
|