[Giorgio Pioda]
> Hi,
> 
> comparing the squeeze and the wheezy versions of class_csvimport.inc
> I've found some inconsistency of the latter version between line 177
> and line 199 (missing brackets and maybe also some missing arguments
> for a function).
> 
> I backported two little pieces of code from squeeze and the
> mass import is now working on gosa 2.7 basis
> 
> Here the modified file:
> 
> http://dati.spse.ch/~gfwp/class_csvimport.inc

[Wolfgang Schweer]
> Seems to work, too. No tweaking of contentcsv.tpl needed any more.

Very good.  This seem to be the change, as reported by using
"svn diff -x --ignore-all-space" after checking out
<URL: https://oss.gonicus.de/repositories/gosa/trunk/gosa-plugins/ldapmanager >
using svn.

CC to the BTS report.

Index: addons/ldapmanager/class_csvimport.inc
===================================================================
--- addons/ldapmanager/class_csvimport.inc      (revisjon 21231)
+++ addons/ldapmanager/class_csvimport.inc      (arbeidskopi)
@@ -175,17 +175,25 @@
 
 
             /* Set all submitted vars  */
-            if(is_array($keys))
+           if(is_array($keys)){
               foreach($keys as $key) {
                 if($key != "status"){
                   $this->usertab->$key = $dat[$key];
+                      foreach($this->usertab->by_object as $pname => $plugin){
+                      if(isset($this->usertab->by_object[$pname]->$key)){
+                       $this->usertab->by_object[$pname]->$key = $dat[$key];
                 }
               }
+                                }
+                            }
+                        }
 
             /* Initialize template */
             if($this->csvinfo['tplid']!=0){
-              
$this->usertab->adapt_from_template($this->csvinfo['arrtempls'][$this->csvinfo['tplid']]['dn']);
-              $this->usertab->save_object();
+              $tpl_dn = 
$this->csvinfo['arrtempls'][$this->csvinfo['tplid']]['dn'];
+              
$this->usertab->adapt_from_template($tpl_dn,array("uid","cn","givenName","sn"));
+              $tpl_base  = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), 
'/i')."/", '', $tpl_dn);
+              $this->usertab->by_object['user']->base= $tpl_base;
             } else {
 
               /* Reset vars */
@@ -216,6 +224,7 @@
               msg_dialog::displayChecks($this->usertab->check());
               
$this->csvinfo['sorteddata'][$i]['status']="<b>"._("failed")."</b>";
               $failing = $i+1;
+              //echo "failing: $failing";
               break;
             } else {
               $this->csvinfo['sorteddata'][$i]['status']=_("OK");
Index: addons/ldapmanager/contentimport.tpl
===================================================================
--- addons/ldapmanager/contentimport.tpl        (revisjon 21231)
+++ addons/ldapmanager/contentimport.tpl        (arbeidskopi)
@@ -1,10 +1,3 @@
-<font color='red'>Temporary disabled</font>
-<!--
-
-
-
-
-
 {if $type == FALSE || $LDIFError != FALSE}
 <p style="margin-top:5px;">
   {t}The LDIF import plug-in provides methods to upload a set of entries to 
your running LDAP directory as LDIF. You may use this to add new or modify 
existing entries. Remember that GOsa will not check your LDIF for GOsa 
conformance.{/t}
@@ -62,4 +55,3 @@
 </div>
 
 <input type="hidden" name="ignore">
--->
Index: addons/ldapmanager/contentcsv.tpl
===================================================================
--- addons/ldapmanager/contentcsv.tpl   (revisjon 21231)
+++ addons/ldapmanager/contentcsv.tpl   (arbeidskopi)
@@ -1,5 +1,3 @@
-<font color='red'>Temporary disabled</font>
-<!--
 <p>
   {t}The CSV import plug-in provides methods to generate user accounts from a 
file containing Comma Separated Values. The administrator can decide which 
columns should be transfered to which attribute. Note that you must have at 
least the UID, GIVENNAME and SURNAME set.{/t}
 </p>
@@ -122,4 +120,3 @@
   {/if}
 </div>
 <input type="hidden" name="ignore">
--->

I guess the next step is to build a package with this patch and see if
it still fix the problem.

-- 
Happy hacking
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to