From 80c671658182e3599b1f660d5006228559c0e345 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 25 Sep 2012 14:46:40 +0200 Subject: [PATCH 1/4] add ability to remove a product tab if it's defined in a module description --- htdocs/core/lib/product.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index f025a34e045..837277c9858 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -132,6 +132,8 @@ function product_prepare_head($object, $user) } } + complete_head_from_modules($conf,$langs,$object,$head,$h,'product', 'remove'); + return $head; } From e9128db1aa411612d441916e4699ec8de004aea5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 25 Sep 2012 18:37:37 +0200 Subject: [PATCH 2/4] Fix: add todo for free tag treatment --- ...face_20_modPaypal_PaypalWorkflow.class.php | 81 ++++++++++--------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php index ab78856e65f..9b0c2034927 100755 --- a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php +++ b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php @@ -102,47 +102,54 @@ class InterfacePaypalWorkflow if ($action == 'PAYPAL_PAYMENT_OK') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object->source." ref=".$object->ref); - - if ($object->source == 'membersubscription') + + if (! empty($object->source)) { - //require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherents.class.php"); - - // TODO add subscription treatment + if ($object->source == 'membersubscription') + { + //require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherents.class.php'; + + // TODO add subscription treatment + } + else + { + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $soc = new Societe($this->db); + + // Parse element/subelement (ex: project_task) + $element = $path = $filename = $object->source; + if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs)) + { + $element = $path = $regs[1]; + $filename = $regs[2]; + } + // For compatibility + if ($element == 'order') { + $path = $filename = 'commande'; + } + if ($element == 'invoice') { + $path = 'compta/facture'; $filename = 'facture'; + } + + dol_include_once('/'.$path.'/class/'.$filename.'.class.php'); + + $classname = ucfirst($filename); + $obj = new $classname($this->db); + + $ret = $obj->fetch('',$object->ref); + if ($ret < 0) return -1; + + // Add payer id + $soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid); + + // Add transaction id + $obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]); + } } else { - require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); - - $soc = new Societe($this->db); - - // Parse element/subelement (ex: project_task) - $element = $path = $filename = $object->source; - if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs)) - { - $element = $path = $regs[1]; - $filename = $regs[2]; - } - // For compatibility - if ($element == 'order') { - $path = $filename = 'commande'; - } - if ($element == 'invoice') { - $path = 'compta/facture'; $filename = 'facture'; - } - - dol_include_once('/'.$path.'/class/'.$filename.'.class.php'); - - $classname = ucfirst($filename); - $obj = new $classname($this->db); - - $ret = $obj->fetch('',$object->ref); - if ($ret < 0) return -1; - - // Add payer id - $soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid); - - // Add transaction id - $obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]); + // TODO add free tag treatment } } From d6243a33afb5f78d0b66147e475f0a3ff84864b2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 26 Sep 2012 12:05:23 +0200 Subject: [PATCH 3/4] Fix: hide menu if empty --- htdocs/core/menus/standard/eldy.lib.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f2ca35611f9..ace308db4bd 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1373,8 +1373,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $num=count($menu_array); for ($i = 0; $i < $num; $i++) { + $showmenu=true; + if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) { + $showmenu=false; + } + $alt++; - if (empty($menu_array[$i]['level'])) + if (empty($menu_array[$i]['level']) && $showmenu) { if (($alt%2==0)) { @@ -1409,11 +1414,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) { print ''."\n"; } - else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + else if ($showmenu) { print ''."\n"; } - print ''."\n"; + if ($showmenu) + print ''."\n"; } // Menu niveau > 0 if ($menu_array[$i]['level'] > 0) @@ -1428,7 +1434,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) if (! strstr($menu_array[$i]['titre'],''; print ''."\n"; } - else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + else if ($showmenu) { print ''."\n"; } @@ -1437,7 +1443,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) // If next is a new block or end if (empty($menu_array[$i+1]['level'])) { - print ''."\n"; + if ($showmenu) + print ''."\n"; print "\n"; } } From 1185e0f731f4b5c8aa4fa3f5ecc08072eefe3cdb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 26 Sep 2012 12:14:08 +0200 Subject: [PATCH 4/4] Fix: multicompany transverse mode compatibility --- htdocs/user/class/user.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 688dd8b0f45..dc185404cb8 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -512,7 +512,7 @@ class User extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= ", ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " WHERE r.id = ur.fk_id"; - $sql.= " AND r.entity in (0,".(!empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; + $sql.= " AND r.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " AND ur.fk_user= ".$this->id; $sql.= " AND r.perms IS NOT NULL"; if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'"; @@ -557,11 +557,14 @@ class User extends CommonObject $sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,"; $sql.= " ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " WHERE r.id = gr.fk_id"; + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) { + $sql.= " AND gu.entity IN (0,".$conf->entity.")"; + } else { + $sql.= " AND r.entity = ".$conf->entity; + } $sql.= " AND gr.fk_usergroup = gu.fk_usergroup"; $sql.= " AND gu.fk_user = ".$this->id; $sql.= " AND r.perms IS NOT NULL"; - $sql.= " AND r.entity = ".$conf->entity; - $sql.= " AND gu.entity IN (0,".$conf->entity.")"; if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'"; dol_syslog(get_class($this).'::getrights sql='.$sql, LOG_DEBUG); @@ -1418,7 +1421,7 @@ class User extends CommonObject } if (! empty($dolibarr_main_force_https) || (! empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on')) $urlwithouturlroot=preg_replace('/http:/i','https:',$urlwithouturlroot); - + // TODO Use outputlangs to translate messages if (! $changelater) {