diff --git a/ChangeLog b/ChangeLog index dafb9ae8fa1..0526cd214a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: +- New: Add number of active notification into tab title (like we do for notes and documents) - New: Can add product into category from category card. - New: PDF event report show project and status of event. - New: Can filter on status on interventions. @@ -135,7 +136,14 @@ Dolibarr better: creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. - A lot of pages called fiche.php were renamed into card.php - A lot of pages called liste.php were renamed into list.php - + + + +***** ChangeLog for 3.6.2 compared to 3.6.1 ***** +- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice +- Fix: bug 1588 : relative discount +- Fix: label of input method not tranlated. + ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: - Fix: Can upload files on services. @@ -154,7 +162,13 @@ For users: - Fix: Extrafield feature select from table should try to translate multiple column when not needed - Fix: cents for indian ruppes are calle paisa and paise. - Fix: Invoices payments may be older than invoices. +- Fix: Withdrawal total amount is double - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line +- Fix: Web service categorie WDSL declaration is correct +- Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined +- Fix: Category creation failed and no message output +- Fix: Lanf for Payment Type +- Fix: PHPCheckstyle 1.5.5 ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 0b881cedb35..0e8f2ea0fdd 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -442,6 +442,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 0c929ef5de5..60ff4b125c3 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -65,8 +65,7 @@ if ($action == 'delete') { $accounting = new AccountingAccount($db); if ($action == 'disable') { - $accounting = $accounting->fetch($id); - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_desactivate($id); } @@ -75,10 +74,7 @@ if ($action == 'disable') { setEventMessage($accounting->error, 'errors'); } } else if ($action == 'enable') { - - $accounting = $accounting->fetch($id); - - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_activate($id); } $action = 'update'; @@ -160,7 +156,7 @@ if ($result) { print ''; print ''; - $var = True; + $var = true; while ( $i < min($num, $limit) ) { $obj = $db->fetch_object($resql); diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index ca7e5f84e07..dc8f50241a1 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -99,7 +99,7 @@ print '' print ''; print ''; -$var = True; +$var = true; print ''; print ''; diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index b350aa8e590..9e5c59f4555 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -135,7 +135,7 @@ if ($result) { print '' . "\n"; print ''; - $var = True; + $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 8e548f8992e..e72df6a0431 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -191,7 +191,7 @@ print "
\n"; * Define Chart of accounts */ print '
' . $langs->trans("Modelcsv") . '
'; -$var = True; +$var = true; print ''; print ''; print ''; - $var = True; + $var = true; while ( $i < min($num, 250) ) { $obj = $db->fetch_object($resql); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 3af059cad94..3b68bd6b69e 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -227,9 +227,8 @@ if ($result) { $i ++; } - print ''; - print '
'; @@ -211,7 +211,7 @@ $sql .= " AND fk_pays = " . $mysoc->country_id; dol_syslog('accountancy/admin/index.php:: $sql=' . $sql); $resql = $db->query($sql); -$var = True; +$var = true; if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 5c1cba946ee..402ff72ed84 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -89,7 +89,7 @@ if ($resql) { print '' . $langs->trans("Accountancy_code_sell") . '' . $langs->trans("Accountancy_code_sell_suggest") . '
 
'; + print '
'; print ''; } else { print $db->error(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 4bf603236db..f932fbfc8af 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -208,10 +208,8 @@ if ($result) { $i ++; } - print ' '; - - print ""; - + print ''; + print '
'; print ''; } else { print $db->error(); diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index e043bff88aa..a0bb5c4b605 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -219,6 +219,10 @@ if (function_exists("ldap_connect")) $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); + // Get a gid number for objectclass PosixGroup + if(in_array('posixGroup',$info['objectclass'])) + $info['gidNumber'] = $ldap->getNextGroupGid(); + $result1=$ldap->delete($dn); // To be sure to delete existing records $result2=$ldap->add($dn,$info,$user); // Now the test $result3=$ldap->delete($dn); // Clean what we did diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index f09a526b327..672c92b9508 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -144,6 +144,10 @@ if ($action == 'add' && $user->rights->categorie->creer) $action = 'confirmed'; $_POST["addcat"] = ''; } + else + { + setEventMessage($object->error,'errors'); + } } } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 34adf5d5f68..cd327d785c9 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -770,12 +770,12 @@ else if ($action == 'addline' && $user->rights->propal->creer) { // On defini prix unitaire if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level) { - $pu_ht = $prod->multiprices [$object->thirdparty->price_level]; - $pu_ttc = $prod->multiprices_ttc [$object->thirdparty->price_level]; - $price_min = $prod->multiprices_min [$object->thirdparty->price_level]; - $price_base_type = $prod->multiprices_base_type [$object->thirdparty->price_level]; - $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; - $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; + $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; + $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; + if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 7140dd9d361..cdd5618c6b7 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012-214 Christophe Battarel + * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Marcos García * @@ -802,7 +802,10 @@ class Propal extends CommonObject $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, - $this->lines[$i]->label + $this->lines[$i]->label, + $this->lines[$i]->date_start, + $this->lines[$i]->date_end, + $this->lines[$i]->array_options ); if ($result < 0) @@ -932,6 +935,10 @@ class Propal extends CommonObject $this->db->begin(); + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + // Load source object $objFrom = dol_clone($this); @@ -1070,7 +1077,7 @@ class Propal extends CommonObject $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid'; $sql.= " WHERE p.fk_statut = c.id"; $sql.= " AND p.entity = ".$conf->entity; - if ($ref) $sql.= " AND p.ref='".$this->db->escape($ref)."'"; + if ($ref) $sql.= " AND p.ref='".$ref."'"; else $sql.= " AND p.rowid=".$rowid; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 92fed596819..136ade4df3c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -600,10 +600,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) { // multiprix if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) { - $pu_ht = $prod->multiprices [$object->thirdparty->price_level]; - $pu_ttc = $prod->multiprices_ttc [$object->thirdparty->price_level]; - $price_min = $prod->multiprices_min [$object->thirdparty->price_level]; - $price_base_type = $prod->multiprices_base_type [$object->thirdparty->price_level]; + $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; + $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; + if (isset($prod->multiprices_tva_tx[$object->client->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; + if (isset($prod->multiprices_recuperableonly[$object->client->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } @@ -616,14 +618,20 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { + if ($result >= 0) + { + if (count($prodcustprice->lines) > 0) + { $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; } } + else + { + setEventMessage($prodcustprice->error,'errors'); + } } // if price ht is forced (ie: calculated by margin rate and cost price) @@ -1875,9 +1883,9 @@ if ($action == 'create' && $user->rights->commande->creer) { // Local taxes if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) - $nbrow ++; + $nbrow++; if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0 ) - $nbrow ++; + $nbrow++; print ''; @@ -2529,7 +2537,7 @@ if ($action == 'create' && $user->rights->commande->creer) { if (is_array($contactarr) && count($contactarr) > 0) { foreach ($contactarr as $contact) { - if ($contact ['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label + if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label $contactstatic = new Contact($db); $contactstatic->fetch($contact ['id']); $custcontact = $contactstatic->getFullName($langs, 1); @@ -2537,15 +2545,15 @@ if ($action == 'create' && $user->rights->commande->creer) { } if (! empty($custcontact)) { - $formmail->substit ['__CONTACTCIVNAME__'] = $custcontact; + $formmail->substit['__CONTACTCIVNAME__'] = $custcontact; } } // Tableau des parametres complementaires - $formmail->param ['action'] = 'send'; - $formmail->param ['models'] = 'order_send'; - $formmail->param ['orderid'] = $object->id; - $formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; + $formmail->param['action'] = 'send'; + $formmail->param['models'] = 'order_send'; + $formmail->param['orderid'] = $object->id; + $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; // Init list of files if (GETPOST("mode") == 'init') { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a86162c5775..25c8a1d11c3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011 Jean Heimburger - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Marcos García * @@ -726,7 +726,8 @@ class Commande extends CommonOrder $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, - $this->lines[$i]->label + $this->lines[$i]->label, + $this->lines[$i]->array_options ); if ($result < 0) { @@ -863,6 +864,10 @@ class Commande extends CommonOrder $this->db->begin(); + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + // Load source object $objFrom = dol_clone($this); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index f40277ea34a..333ce5f7908 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -146,7 +146,7 @@ if ($resql) print ''; print "\n"; - $var=True; + $var=true; while ($i < min($num,$conf->liste_limit)) { diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index b7d9be05529..0d2815a6d67 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -187,7 +187,7 @@ if (! empty($conf->commande->enabled)) if ($num) { $i = 0; - $var = True; + $var = true; while ($i < $num) { $var=!$var; @@ -238,7 +238,7 @@ if ($resql) if ($num) { $i = 0; - $var = True; + $var = true; while ($i < $num) { $var=!$var; @@ -308,7 +308,7 @@ if (! empty($conf->commande->enabled)) if ($num) { $i = 0; - $var = True; + $var = true; while ($i < $num) { $var=!$var; @@ -379,7 +379,7 @@ if (! empty($conf->commande->enabled)) if ($num) { $i = 0; - $var = True; + $var = true; while ($i < $num) { $var=!$var; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 49824a7f6cb..1009b030210 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -622,7 +622,7 @@ if (($action != 'create' && $action != 'add') || !$error) print ''; print '
'; - $var=True; + $var=true; $generic_commande = new Commande($db); while ($i < $num) diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 528ed14e849..14751d308c4 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -177,7 +177,7 @@ if ($resql) print ''; print "\n"; - $var=True; + $var=true; while ($i < min($num,$conf->liste_limit)) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a358598264e..9b727f15e5e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1201,8 +1201,8 @@ else if ($action == 'addline' && $user->rights->facture->creer) $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; - //$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; - //$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; + if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 193443dd64d..e07881d73db 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012-2014 Marcos García * Copyright (C) 2013 Cedric Gross * Copyright (C) 2013 Florian Henry @@ -394,7 +394,7 @@ class Facture extends CommonInvoice $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, $this->lines[$i]->label, - '' + $this->lines[$i]->array_options ); if ($result < 0) { @@ -591,6 +591,10 @@ class Facture extends CommonInvoice $this->db->begin(); + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + // Load source object $objFrom = dol_clone($this); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 02674b59745..55ef0a5ef80 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -228,7 +228,7 @@ if ($action == 'create') if (empty($conf->global->PRODUIT_MULTIPRICES)) print '
'; print "\n"; } - $var=True; + $var=true; while ($i < $num) { $objp = $db->fetch_object($result); @@ -447,7 +447,7 @@ else $num = count($object->lines); $i = 0; - $var=True; + $var=true; while ($i < $num) { $var=!$var; @@ -572,7 +572,7 @@ else if ($num > 0) { - $var=True; + $var=true; while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index d3987bcbad8..ea0d896f5d1 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -600,7 +600,7 @@ if ($resql) if ($num > 0) { - $var=True; + $var=true; $total_ht=0; $total_tva=0; $total_ttc=0; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 39dcc6b6427..ba27f5659a9 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -333,7 +333,7 @@ if ($resql) if ($num > 0) { - $var=True; + $var=true; $total_ht=0; $total_tva=0; $total_ttc=0; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 4bfa4d81048..48ca10afd2d 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -491,7 +491,7 @@ if ($object->id > 0) print ''; print ''; print ''; - $var=True; + $var=true; if ($result_sql) { diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 1908b0670ff..fc2943f05e0 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -494,7 +494,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) print ''; if ($num) { - $var = True; + $var = true; $total_ttc = $totalam = $total = 0; $var=true; @@ -908,7 +908,7 @@ if ($resql) print '
'.$langs->trans("CurrentProductPrice").'
'.$langs->trans("WithdrawalReceipt").''.$langs->trans("User").'  
'; print ''; print "\n"; - $var = True; + $var = true; $i = 0; while ($i < $db->num_rows($resql)) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 21b2eb9e154..56278f15c5d 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -509,7 +509,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print "\n"; - $var=True; + $var=true; $total=0; $totalrecu=0; $totalrecucreditnote=0; @@ -687,7 +687,7 @@ if (! GETPOST('action')) { $num = $db->num_rows($resql); $i = 0; - $var=True; + $var=true; print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); print '
'.$langs->trans("TasksToDo").'
 
'; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index a54a0bcd935..7e26fa5789f 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -253,7 +253,7 @@ if ($_GET["action"] == 'create') print ''; print "\n"; - $var=True; + $var=true; $total=0; $totalrecu=0; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index ed5b123d923..87bab387344 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur + * Copyright (C) 2014 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1342,7 +1343,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$CrLf); fputs($this->file, ''.$CrLf); - $sql = "SELECT pl.amount"; + /*$sql = "SELECT pl.amount"; $sql.= " FROM"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql.= " ".MAIN_DB_PREFIX."facture as f,"; @@ -1368,7 +1369,7 @@ class BonPrelevement extends CommonObject else { $result = -2; - } + }*/ } diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index af070901517..afe2c27a3be 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -350,7 +350,7 @@ if ($id > 0) * Payments */ $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; - $sql.= "c.libelle as paiement_type"; + $sql.= "c.code as type_code,c.libelle as paiement_type"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; @@ -383,8 +383,9 @@ if ($id > 0) print "'; print '\n"; - print "\n"; - print '\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "\n"; + print '\n"; print ""; $totalpaye += $objp->amount; $i++; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f3abf9e2bfe..1ba775268a1 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -241,13 +241,20 @@ if (empty($reshook)) $result = $object->delete(); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/contact/list.php'); - exit; + if ($backtopage) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".DOL_URL_ROOT.'/contact/list.php'); + exit; + } } else { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); + setEventMessage($object->error,$object->errors,'errors'); } } @@ -360,7 +367,7 @@ else { if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage?'&backtopage='.$backtopage:''),$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); } } @@ -1082,27 +1089,27 @@ else { if ($user->rights->societe->contact->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } if (! $object->user_id && $user->rights->user->user->creer) { - print ''.$langs->trans("CreateDolibarrLogin").''; + print ''.$langs->trans("CreateDolibarrLogin").''; } if ($user->rights->societe->contact->supprimer) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } // Activer if ($object->statut == 0 && $user->rights->societe->contact->creer) { - print ''.$langs->trans("Reactivate").''; + print ''.$langs->trans("Reactivate").''; } // Desactiver if ($object->statut == 1 && $user->rights->societe->contact->creer) { - print ''.$langs->trans("DisableUser").''; + print ''.$langs->trans("DisableUser").''; } } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9e93523a654..3f81608c415 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -877,20 +877,21 @@ class Contact extends CommonObject * @param int $withpicto Include picto with link * @param string $option Where the link point to * @param int $maxlen Max length of + * @param string $moreparam Add more param into URL * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$maxlen=0) + function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') { global $langs; $result=''; - $lien = ''; + $lien = ''; $lienfin=''; if ($option == 'xxx') { - $lien = ''; + $lien = ''; $lienfin=''; } diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 55a538a2195..89edfcbae8e 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -28,7 +28,7 @@ $extrasize=GETPOST('size'); if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8'; if (GETPOST('type')=='date') $extrasize=''; if (GETPOST('type')=='datetime') $extrasize=''; -if (GETPOST('type')=='select') $extrasize=''; +if (GETPOST('type')=='select') $extrasize=''; // Add attribute @@ -87,7 +87,7 @@ if ($action == 'add') $mesg[]=$langs->trans("ErrorNoValueForRadioType"); $action = 'create'; } - if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param')) + if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param')) { // Construct array for parameter (value of select list) $parameters = GETPOST('param'); @@ -95,7 +95,7 @@ if ($action == 'add') foreach($parameters_array as $param_ligne) { if (!empty($param_ligne)) { - if (preg_match_all('/,/',$param_ligne,$matches)) + if (preg_match_all('/,/',$param_ligne,$matches)) { if (count($matches[0])>1) { $error++; @@ -104,7 +104,7 @@ if ($action == 'add') $action = 'create'; } } - else + else { $error++; $langs->load("errors"); @@ -112,12 +112,12 @@ if ($action == 'add') $action = 'create'; } } - } + } } if (! $error) { - // attrname must be alphabetical and lower case only + // attrname must be alphabetical and lower case only if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname'])) { // Construct array for parameter (value of select list) @@ -139,8 +139,8 @@ if ($action == 'add') list($key,$value) = explode(',',$param_ligne); $params['options'][$key] = $value; } - } - + } + $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params); if ($result > 0) { @@ -164,7 +164,7 @@ if ($action == 'add') $action = 'create'; } } - else + else { setEventMessage($mesg,'errors'); } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 0cd428ebc4f..42c505a54bf 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -154,7 +154,7 @@ class ExtraFields { $table=$elementtype.'_extrafields'; - if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) + if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname)) { if ($type=='boolean') { $typedb='int'; @@ -226,8 +226,7 @@ class ExtraFields // Clean parameters if (empty($pos)) $pos=0; - - if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) + if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname)) { if(is_array($param) and count($param) > 0) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 51b9c5eff46..d4effca3905 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3987,7 +3987,7 @@ class Form { print ''; } - print $langs->trans('Hours'); + print ' '.$langs->trans('HourShort'); if ($minunderhours) print '
'; else print " "; @@ -4000,7 +4000,7 @@ class Form print '>'.$min.''; } print ""; - print $langs->trans('Minutes'). " "; + print ' '.$langs->trans('MinuteShort'). " "; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e473fdc3d98..50c681d8366 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -474,14 +474,14 @@ class FormFile // Model if (! empty($modellist)) { - $out.= ''; } else @@ -492,7 +492,7 @@ class FormFile } // Language code (if multilang) - $out.= ''; + $out.=''; } $this->numoffiles++; @@ -1150,7 +1150,7 @@ class FormFile $nboflinks = count($links); if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - $var = true; + $var = false; foreach ($links as $link) { $var =! $var; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 85b830fdd06..c5ba612b60f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -37,7 +37,7 @@ */ function societe_prepare_head($object) { - global $langs, $conf, $user; + global $db, $langs, $conf, $user; $h = 0; $head = array(); @@ -109,8 +109,29 @@ function societe_prepare_head($object) // Notifications if (! empty($conf->notification->enabled)) { + $nbNote = 0; + $sql = "SELECT COUNT(n.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; + $sql.= " WHERE fk_soc = ".$object->id; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $nbNote=$obj->nb; + $i++; + } + } + else { + dol_print_error($db); + } + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.$object->id; $head[$h][1] = $langs->trans("Notifications"); + if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; $head[$h][2] = 'notify'; $h++; } @@ -676,7 +697,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $contactstatic->lastname = $obj->lastname; $contactstatic->firstname = $obj->firstname; $contactstatic->civility_id = $obj->civility_id; - print $contactstatic->getNomUrl(1); + print $contactstatic->getNomUrl(1,'',0,'&backtopage='.urlencode($backtopage)); print ''; print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e088f764040..5f9c1c4f328 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10,7 +10,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Cédric GROSS * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 746755b824c..e6f6228eec9 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2014 Marcos García @@ -479,6 +479,50 @@ function clean_url($url,$http=1) else return $url; } + + +/** + * Returns an email value with obfuscated parts. + * + * @param string $mail Email + * @param string $replace Replacement character (defaul : *) + * @param int $nbreplace Number of replacement character (default : 8) + * @param int $nbdisplaymail Number of character unchanged (default: 4) + * @param int $nbdisplaydomain Number of character unchanged of domain (default: 3) + * @param bool $displaytld Display tld (default: true) + * @return string Return email with hidden parts or ''; + */ +function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true) +{ + if(!isValidEmail($mail))return ''; + $tab = explode('@', $mail); + $tab2 = explode('.',$tab[1]); + $string_replace = ''; + $mail_name = $tab[0]; + $mail_domaine = $tab2[0]; + $mail_tld = ''; + + for($i=1; $i < count($tab2) && $displaytld ;$i++) + { + $mail_tld .= '.'.$tab2[$i]; + } + + for($i=0; $i < $nbreplace; $i++){ + $string_replace .= $replace; + } + + if(strlen($mail_name) > $nbdisplaymail){ + $mail_name = substr($mail_name, 0, $nbdisplaymail); + } + + if(strlen($mail_domaine) > $nbdisplaydomain){ + $mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain); + } + + return $mail_name . $string_replace . $mail_domaine . $mail_tld; +} + + /** * Return lines of an html table from an array * Used by array2table function only diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8a9ac1385be..50c02125fb7 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -72,6 +72,13 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea curl_setopt($ch, CURLOPT_POST, 1); // POST curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields } + else if ($postorget == 'PUT') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' + if ( ! is_array($param) ) + parse_str($param, $array_param); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields + } else if ($postorget == 'HEAD') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD' diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e9ceb297680..98a2b111c6f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -445,7 +445,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t * * @param string $inc ? * @param string $parent ? - * @param Object $lines ? + * @param Task[] $lines ? * @param int $level ? * @param string $projectsrole ? * @param string $tasksrole ? @@ -455,8 +455,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t */ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) { - global $user, $bc, $langs; - global $form, $projectstatic, $taskstatic; + global $db, $user, $bc, $langs; + global $form, $formother, $projectstatic, $taskstatic; + + if (! is_object($formother)) + { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + $formother = new FormOther($db); + } $lastprojectid=0; @@ -526,7 +532,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr // Progress declared % print ''; // Time spent diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 7533018373a..c633734b227 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2011 Regis Houssin @@ -394,7 +394,7 @@ class modAgenda extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; $this->export_sql_end[$r] .=' Where ac.entity = '.$conf->entity; - $this->export_sql_end[$r] .=' ORDER BY datep'; + $this->export_sql_end[$r] .=' ORDER BY ac.datep'; } diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 43fbe916c47..0d383603a06 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -182,7 +182,7 @@ class modBanque extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON f.rowid = pf.fk_facture'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON f.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' WHERE ba.rowid = b.fk_account AND bch.rowid = b.fk_bordereau and bch.fk_bank_account=ba.rowid'; - $this->export_sql_end[$r] .=' AND b.fk_type = "CHQ"'; + $this->export_sql_end[$r] .=" AND b.fk_type = 'CHQ'"; $this->export_sql_end[$r] .=' AND p.fk_paiement = 7'; $this->export_sql_end[$r] .=' AND ba.entity = '.$conf->entity; $this->export_sql_order[$r] =' ORDER BY b.datev, b.num_releve'; diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 2ffc46b60bb..4906d9e3954 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent * This program is free software; you can redistribute it and/or modify @@ -41,6 +41,8 @@ class modContrat extends DolibarrModules */ function __construct($db) { + global $conf; + $this->db = $db; $this->numero = 54; @@ -114,6 +116,53 @@ class modContrat extends DolibarrModules $this->rights[5][3] = 0; $this->rights[5][4] = 'supprimer'; + // Exports + //-------- + $r=1; + + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='ContractAndServices'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='contract'; + $this->export_permission[$r]=array(array("contrat","export")); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode', + 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode', + 's.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra', + 'co.rowid'=>"contractId",'co.ref'=>"contactRef",'co.datec'=>"contractDateCreation",'co.date_contrat'=>"DateContract",'co.mise_en_service'=>"DateMiseService", + 'co.fin_validite'=>"EndValidity",'co.date_cloture'=>"Cloture",'co.note_private'=>"NotePrivate",'co.note_public'=>"NotePublic", + 'cod.rowid'=>'LineId','cod.label'=>"LineLabel",'cod.description'=>"LineDescription",'cod.price_ht'=>"LineUnitPrice",'cod.tva_tx'=>"LineVATRate", + 'cod.qty'=>"LineQty",'cod.total_ht'=>"LineTotalHT",'cod.total_tva'=>"LineTotalVAT",'cod.total_ttc'=>"LineTotalTTC", + 'cod.date_ouverture'=>"DateStart",'cod.date_ouverture_prevue'=>"DateStartPrevis",'cod.date_fin_validite'=>"EndValidity",'cod.date_cloture'=>"DateEnd", + 'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company', + 's.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company', + 's.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company', + 'co.rowid'=>"Contract",'co.ref'=>"Contract",'co.datec'=>"Contract",'co.date_contrat'=>"Contract",'co.mise_en_service'=>"Contract", + 'co.fin_validite'=>"Contract",'co.date_cloture'=>"Contract",'co.note_private'=>"Contract",'co.note_public'=>"Contract", + 'cod.rowid'=>'contract_line','cod.label'=>"contract_line",'cod.description'=>"contract_line",'cod.price_ht'=>"contract_line",'cod.tva_tx'=>"contract_line", + 'cod.qty'=>"contract_line",'cod.total_ht'=>"contract_line",'cod.total_tva'=>"contract_line",'cod.total_ttc'=>"contract_line", + 'cod.date_ouverture'=>"contract_line",'cod.date_ouverture_prevue'=>"contract_line",'cod.date_fin_validite'=>"contract_line",'cod.date_cloture'=>"contract_line", + 'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); + + $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text', + 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text', + 's.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text', + 'co.ref'=>"Text",'co.datec'=>"Date",'co.date_contrat'=>"Date",'co.mise_en_service'=>"Date", + 'co.fin_validite'=>"Date",'co.date_cloture'=>"Date",'co.note_private'=>"Text",'co.note_public'=>"Text", + 'cod.label'=>"Text",'cod.description'=>"Text",'cod.price_ht'=>"Numeric",'cod.tva_tx'=>"Numeric", + 'cod.qty'=>"Numeric",'cod.total_ht'=>"Numeric",'cod.total_tva'=>"Numeric",'cod.total_ttc'=>"Numeric", + 'cod.date_ouverture'=>"Date",'cod.date_ouverture_prevue'=>"Date",'cod.date_fin_validite'=>"Date",'cod.date_cloture'=>"Date", + 'p.rowid'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); + + + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contrat as co,'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contratdet as cod'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cod.fk_product = p.rowid)'; + $this->export_sql_end[$r] .=' WHERE co.fk_soc = s.rowid and co.rowid = cod.fk_contrat'; + $this->export_sql_end[$r] .=' AND co.entity = '.$conf->entity; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 17915465543..ce621e40a86 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -211,7 +211,7 @@ else { - + rights->cron->ex } else { - if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); - else setEventMessage($langs->trans("JobFinished"),'mesgs'); - $action=''; + $res = $object->reprogram_jobs($user->login); + if ($res > 0) + { + if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); + else setEventMessage($langs->trans("JobFinished"),'mesgs'); + $action=''; + } + else + { + setEventMessage($object->error,'errors'); + $action=''; + } } } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index a9789ec055e..79e5ae5b1a4 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -100,6 +100,21 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex if ($result < 0) { setEventMessage($object->error,'errors'); } + else + { + $res = $object->reprogram_jobs($user->login); + if ($res > 0) + { + if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); + else setEventMessage($langs->trans("JobFinished"),'mesgs'); + $action=''; + } + else + { + setEventMessage($object->error,'errors'); + $action=''; + } + } header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-1'); // Make a call to avoid to run twice job when using back exit; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c2649e5f8df..14ef8738b73 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1453,7 +1453,6 @@ else if ($id || $ref) // Batch number managment if (! empty($conf->productbatch->enabled)) { if (isset($lines[$i]->detail_batch) ) { - $flagBatch = true; print ''; diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php index 9a1142fe5c0..0c2cebc2e27 100644 --- a/htdocs/projet/activity/list.php +++ b/htdocs/projet/activity/list.php @@ -83,6 +83,7 @@ if ($action == 'addtime' && $user->rights->projet->creer) foreach($timespent_duration as $key => $val) { $task->fetch($key); + $task->progress = GETPOST($key . 'progress', 'int'); $task->timespent_duration = $val; $task->timespent_fk_user = $user->id; $task->timespent_date = dol_mktime(12,0,0,$_POST["{$key}month"],$_POST["{$key}day"],$_POST["{$key}year"]); @@ -178,7 +179,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 62052ebaa29..25006a81047 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2014 Marcos García * @@ -42,7 +42,7 @@ class Task extends CommonObject var $fk_task_parent; var $label; var $description; - var $duration_effective; + var $duration_effective; // total of time spent on this task var $planned_workload; var $date_c; var $date_start; @@ -60,6 +60,7 @@ class Task extends CommonObject var $timespent_duration; var $timespent_old_duration; var $timespent_date; + var $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) var $timespent_fk_user; var $timespent_note; @@ -141,8 +142,9 @@ class Task extends CommonObject } } - //Update extrafield - if (!$error) { + // Update extrafield + if (! $error) + { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { $result=$this->insertExtraFields(); @@ -743,18 +745,21 @@ class Task extends CommonObject // Clean parameters if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); - + if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time ("; $sql.= "fk_task"; $sql.= ", task_date"; + $sql.= ", task_datehour"; $sql.= ", task_duration"; $sql.= ", fk_user"; $sql.= ", note"; $sql.= ") VALUES ("; $sql.= $this->id; $sql.= ", '".$this->db->idate($this->timespent_date)."'"; + $sql.= ", '".$this->db->idate($this->timespent_datehour)."'"; $sql.= ", ".$this->timespent_duration; $sql.= ", ".$this->timespent_fk_user; $sql.= ", ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); @@ -785,6 +790,7 @@ class Task extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; $sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'"; + $sql.= ", progress = " . $this->progress; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); @@ -815,6 +821,47 @@ class Task extends CommonObject return $ret; } + /** + * Calculate total of time spent for task + * + * @param int $id Id of object (here task) + * @return array Array of info for task array('min_date', 'max_date', 'total_duration') + */ + function getSummaryOfTimeSpent($id='') + { + global $langs; + + if (empty($id)) $id=$this->id; + + $result=array(); + + $sql = "SELECT"; + $sql.= " MIN(t.task_datehour) as min_date,"; + $sql.= " MAX(t.task_datehour) as max_date,"; + $sql.= " SUM(t.task_duration) as total_duration"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; + $sql.= " WHERE t.fk_task = ".$id; + + dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $obj = $this->db->fetch_object($resql); + + $result['min_date'] = $obj->min_date; + $result['max_date'] = $obj->max_date; + $result['total_duration'] = $obj->total_duration; + + $this->db->free($resql); + return $result; + } + else + { + dol_print_error($this->db); + return $result; + } + } + /** * Load object in memory from database * @@ -876,12 +923,14 @@ class Task extends CommonObject $ret = 0; // Clean parameters + if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); - + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; $sql.= " task_date = '".$this->db->idate($this->timespent_date)."',"; + $sql.= " task_datehour = '".$this->db->idate($this->timespent_datehour)."',"; $sql.= " task_duration = ".$this->timespent_duration.","; $sql.= " fk_user = ".$this->timespent_fk_user.","; $sql.= " note = ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index d9fb4b4dce9..bba783bf51e 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -166,7 +166,7 @@ $sql.= " WHERE p.entity = ".$conf->entity; if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql.= " AND p.fk_statut=1"; -$sql.= " GROUP BY p.title, p.rowid, t.label, t.rowid, u.rowid, t.planned_workload, t.dateo, t.datee"; +$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, u.rowid, t.planned_workload, t.dateo, t.datee"; $sql.= " ORDER BY u.rowid, t.dateo, t.datee"; $userstatic=new User($db); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 7aea9314e5a..eaec5ae0816 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -320,7 +320,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; // Progress - print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index da200d565b6..73400bbcc6e 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -351,8 +351,8 @@ if ($id > 0 || ! empty($ref)) print $form->select_duration('planned_workload',$object->planned_workload,0,'text'); print ''; - // Progress - print ''; @@ -383,7 +383,7 @@ if ($id > 0 || ! empty($ref)) { /* * Fiche tache en mode visu - */ + */ $param=($withproject?'&withproject=1':''); $linkback=$withproject?''.$langs->trans("BackToList").'':''; @@ -440,14 +440,20 @@ if ($id > 0 || ! empty($ref)) print convertSecondToTime($object->planned_workload,'allhourmin'); print ''; - // Progress + // Progress declared print ''; - // Progress + // Progress calculated print ''; // Description @@ -504,7 +510,7 @@ if ($id > 0 || ! empty($ref)) /* * Documents generes - */ + */ $filename=dol_sanitizeFileName($projectstatic->ref). "/". dol_sanitizeFileName($object->ref); $filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($projectstatic->ref). "/" .dol_sanitizeFileName($object->ref); $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 5c790df32f0..13b1e48f477 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('projects'); @@ -83,11 +84,11 @@ if ($action == 'addtimespent' && $user->rights->projet->creer) else { $object->timespent_note = $_POST["timespent_note"]; + $object->progress = GETPOST('progress', 'int'); $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds $object->timespent_duration+= $_POST["timespent_durationmin"]*60; // We store duration in seconds $object->timespent_date = dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); $object->timespent_fk_user = $_POST["userid"]; - $result=$object->addTimeSpent($user); if ($result >= 0) { @@ -180,18 +181,19 @@ if (! empty($project_ref) && ! empty($withproject)) /* * View -*/ + */ llxHeader("",$langs->trans("Task")); $form = new Form($db); +$formother = new FormOther($db); $userstatic = new User($db); if ($id > 0 || ! empty($ref)) { /* * Fiche projet en mode visu - */ + */ if ($object->fetch($id) >= 0) { $result=$projectstatic->fetch($object->fk_project); @@ -290,9 +292,37 @@ if ($id > 0 || ! empty($ref)) // Label print ''; - // Planned workload - print ''; - + // Date start + print ''; + + // Date end + print ''; + + // Planned workload + print ''; + + // Progress declared + print ''; + + // Progress calculated + print ''; + // Project if (empty($withproject)) { @@ -307,6 +337,30 @@ if ($id > 0 || ! empty($ref)) print ''; } + // Date start + print ''; + + // Date end + print ''; + + // Planned workload + print ''; + + // Declared progress + print ''; + + // Calculated progress + print ''; + print '
'.$langs->trans("Amount").'
"; print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$objp->paiement_type.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
'; + $out.= ''; $out.= ''.$langs->trans('Model').' '; if (is_array($modellist) && count($modellist) == 1) // If there is only one element { $arraykeys=array_keys($modellist); $modelselected=$arraykeys[0]; } - $out.= $form->selectarray('model',$modellist,$modelselected,$showempty,0,0); + $out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', ''); $out.= ''; + $out.= ''; if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; @@ -508,7 +508,7 @@ class FormFile // Button $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= ''; + $out.= ''; $genbutton = 'trans("None").'
'.$langs->trans("None").'
'.$obj->poste.''; - print $lines[$i]->progress.' %'; + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); print '"> remise_client); ?>">%remise_percent); ?>">% '; $detail = ''; foreach ($lines[$i]->detail_batch as $dbatch) { @@ -1543,14 +1542,7 @@ else if ($id || $ref) if ($user->rights->expedition->supprimer) { - if (empty($conf->productbatch->enabled) || (!empty($conf->productbatch->enabled) && !$conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !isset($flagBatch)) - { - print ''.$langs->trans("Delete").''; - } - else - { - print ''.$langs->trans('Delete').''; - } + print ''.$langs->trans("Delete").''; } print ''; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 019ef22f769..898a65a05b8 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -588,10 +588,9 @@ class Expedition extends CommonObject $cpt = $this->db->num_rows($resql); for ($i = 0; $i < $cpt; $i++) { - if($obj->qty <= 0) continue; - - dol_syslog(get_class($this)."::valid movement index ".$i); $obj = $this->db->fetch_object($resql); + if($obj->qty <= 0) continue; + dol_syslog(get_class($this)."::valid movement index ".$i); //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 9bbc27ca51c..93ea02b0759 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -57,7 +57,7 @@ $hookmanager->initHooks(array('suppliercard','globalcard')); */ $parameters=array('socid'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($action == 'setsupplieraccountancycode') diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f60763ab90a..7983060490d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1970,7 +1970,8 @@ class CommandeFournisseur extends CommonOrder } /** - * Returns the translated input method + * Returns the translated input method of object (defined if $this->methode_commande_id > 0). + * This function make a sql request to get translation. No cache yet, try to not use it inside a loop. * * @return string */ @@ -1980,21 +1981,19 @@ class CommandeFournisseur extends CommonOrder if ($this->methode_commande_id > 0) { - $sql = "SELECT rowid, code, libelle"; + $sql = "SELECT rowid, code, libelle as label"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; $sql.= " WHERE active=1 AND rowid = ".$db->escape($this->methode_commande_id); $query = $db->query($sql); - if ($query && $db->num_rows($query)) { - $result = $db->fetch_object($query); + $obj = $db->fetch_object($query); - $string = $langs->trans($result->code); - - if ($string == $result->code) + $string = $langs->trans($obj->code); + if ($string == $obj->code) { - $string = $obj->libelle != '-' ? $obj->libelle : ''; + $string = $obj->label != '-' ? $obj->label : ''; } return $string; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index fbc1572a2ab..57a89440343 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -149,6 +149,8 @@ UPDATE llx_actioncomm set fk_user_action = fk_user_done where fk_user_done > 0 a UPDATE llx_actioncomm set fk_user_action = fk_user_author where fk_user_author > 0 and (fk_user_action is null or fk_user_action = 0); +UPDATE llx_projet_task_time set task_datehour = task_date where task_datehour IS NULL and task_date IS NOT NULL; + -- Requests to clean old tables or external modules tables diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1256dd533e3..fd2a7d94c76 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -266,6 +266,7 @@ Afternoon=Afternoon Quadri=Quadri MonthOfDay=Month of the day HourShort=H +MinuteShort=mn Rate=Rate UseLocalTax=Include tax Bytes=Bytes @@ -679,7 +680,7 @@ ViewPrivateNote=View notes XMoreLines=%s line(s) hidden PublicUrl=Public URL AddBox=Add box - +SelectElementAndClickRefresh=Select an element and click Refresh # Week day Monday=Monday Tuesday=Tuesday diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e78daeba631..fa959b38277 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1404,6 +1404,7 @@ class Product extends CommonObject $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; $sql.= " datec, tms, import_key, entity, desiredstock, tobatch"; + $sql.= " ,ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id); else @@ -1478,6 +1479,8 @@ class Product extends CommonObject $this->date_modification = $obj->tms; $this->import_key = $obj->import_key; $this->entity = $obj->entity; + + $this->ref_ext = $obj->ref_ext; $this->db->free($resql); @@ -2814,8 +2817,8 @@ class Product extends CommonObject if ($maxlength) $newref=dol_trunc($newref,$maxlength,'middle'); if ($withpicto) { - if ($this->type == 0) $result.=($lien.img_object($langs->trans("ShowProduct").' '.$this->ref,'product').$lienfin.' '); - if ($this->type == 1) $result.=($lien.img_object($langs->trans("ShowService").' '.$this->ref,'service').$lienfin.' '); + if ($this->type == 0) $result.=($lien.img_object($langs->trans("ShowProduct").' '.$this->label,'product').$lienfin.' '); + if ($this->type == 1) $result.=($lien.img_object($langs->trans("ShowService").' '.$this->label,'service').$lienfin.' '); } $result.=$lien.$newref.$lienfin; return $result; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 801573a316f..3ff496356a8 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -410,10 +410,14 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) // Prix mini print '
' . $langs->trans("MinPrice") . ' ' . $i . ''; - if ($object->multiprices_base_type ["$i"] == 'TTC') { + if (empty($object->multiprices_base_type["$i"])) $object->multiprices_base_type["$i"]="HT"; + if ($object->multiprices_base_type["$i"] == 'TTC') + { print price($object->multiprices_min_ttc["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); - } else { - print price($object->multiprices_min["$i"]) . ' ' . $langs->trans(empty($object->multiprices_base_type["$i"])?'HT':$object->multiprices_base_type["$i"]); + } + else + { + print price($object->multiprices_min["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); } print '
'.$langs->trans("LabelTask").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("PlannedWorkload").''.$langs->trans("Progress").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("AddDuration").'
'.$langs->trans("Progress").''; + print '
'.$langs->trans("ProgressDeclared").''; print $formother->select_percent($progress,'progress'); print '
'.$langs->trans("Progress").''; + // Progress declared + print '
'.$langs->trans("ProgressDeclared").''; print $formother->select_percent($object->progress,'progress'); print '
'.$langs->trans("ProgressDeclared").''; print $object->progress.' %'; print '
'.$langs->trans("ProgressCalculated").''; - print $object->progress.' %'; + if ($object->planned_workload) + { + $tmparray=$object->getSummaryOfTimeSpent(); + if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %'; + else print '0 %'; + } + else print ''; print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("PlannedWorkload").''.convertSecondToTime($object->planned_workload,'allhourmin').'
'.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'dayhour'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'dayhour'); + print '
'.$langs->trans("PlannedWorkload").''; + print convertSecondToTime($object->planned_workload,'allhourmin'); + print '
'.$langs->trans("ProgressDeclared").''; + print $object->progress.' %'; + print '
'.$langs->trans("ProgressCalculated").''; + if ($object->planned_workload) + { + $tmparray=$object->getSummaryOfTimeSpent(); + if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration']/$object->planned_workload*100, 2).' %'; + else print '0 %'; + } + else print ''; + print '
'.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'dayhour'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'dayhour'); + print '
'.$langs->trans("PlannedWorkload").''.convertSecondToTime($object->planned_workload,'allhourmin').'
'.$langs->trans("ProgressDeclared").''; + print $object->progress.' %'; + print '
'.$langs->trans("ProgressCalculated").''; + if ($object->planned_workload) print round(100 * $object->duration_effective / $object->planned_workload,2).' %'; + else print ''; + print '
'; dol_fiche_end(); @@ -314,7 +368,7 @@ if ($id > 0 || ! empty($ref)) /* * Add time spent - */ + */ if ($user->rights->projet->creer) { print '
'; @@ -331,6 +385,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Date").''; print ''.$langs->trans("By").''; print ''.$langs->trans("Note").''; + print ''.$langs->trans("ProgressDeclared").''; print ''.$langs->trans("Duration").''; print ' '; print "\n"; @@ -360,9 +415,14 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; + // Progress declared + print ''; + print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress'); + print ''; + // Duration print ''; - print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text'); + print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text'); print ''; print ''; @@ -376,7 +436,7 @@ if ($id > 0 || ! empty($ref)) /* * List of time spent - */ + */ $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; $sql.= ", u.lastname, u.firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index c6909aa7cae..e9e79d52130 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2157,7 +2157,7 @@ else if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) { - print '
'; + print '
'; print ''; // ancre /* @@ -2172,7 +2172,7 @@ else $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); - print '
'; + print '
'; print '
'; diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index eaee979e802..f53775b9b3e 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -62,6 +62,10 @@ if ($action == 'dolibarr2ldap') $result=$ldap->connect_bind(); $info=$fgroup->_load_ldap_info(); + // Get a gid number for objectclass PosixGroup + if(in_array('posixGroup',$info['objectclass'])) + $info['gidNumber'] = $ldap->getNextGroupGid(); + $dn=$fgroup->_load_ldap_dn($info); $olddn=$dn; // We can say that old dn = dn as we force synchro diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 4f1a36c6e04..4d7422109bf 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2008-2011 Juanjo Menent + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,8 +28,8 @@ define("NOLOGIN",1); // This means this output page does not require to be logge require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -if (! empty($conf->ldap->enabled)) - require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; $langs->load("errors"); $langs->load("users"); @@ -130,7 +131,8 @@ if ($action == 'buildnewpassword' && $username) // Success if ($edituser->send_password($user,$newpassword,1) > 0) { - $message = '
'.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'
'; + + $message = '
'.$langs->trans("PasswordChangeRequestSent",$edituser->login,dolObfuscateEmail($edituser->email)).'
'; //$message.=$newpassword; $username=''; } diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 3c723947764..345679f7c9a 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -106,56 +106,41 @@ $server->wsdl->addComplexType( 'tns:categorie' ); -/* - * Tableau des catégories - -$server->wsdl->addComplexType( - 'categories', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - array('id'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:categorie[]') - ), - 'tns:categories' -); + /* + * Image of product */ - -/* - * Les photos de la catégorie (un tableau indéxé qui contient les images avec leur vignette) + $server->wsdl->addComplexType( + 'PhotosArray', + 'complexType', + 'array', + 'sequence', + '', + array( + 'image' => array( + 'name' => 'image', + 'type' => 'tns:image', + 'minOccurs' => '0', + 'maxOccurs' => 'unbounded' + ) + ) + ); + + /* + * An image */ -$server->wsdl->addComplexType( - 'PhotosArray', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:image[]') - ), - '' -); - -/* - * Une photo ( nom image / nom_vignette ) - */ -$server->wsdl->addComplexType( - 'image', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - 'photo' => array('name'=>'photo','type'=>'xsd:string'), - 'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'), - 'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'), - 'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string') - ) -); + $server->wsdl->addComplexType( + 'image', + 'complexType', + 'struct', + 'all', + '', + array( + 'photo' => array('name'=>'photo','type'=>'xsd:string'), + 'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'), + 'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'), + 'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string') + ) + ); /* * Retour diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index c42d62cd3b1..149d867135e 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2014 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by