diff --git a/.travis.yml b/.travis.yml index ca2574bc846..5bc5f49b2e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -128,7 +128,7 @@ script: - php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log - php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log - - cat upgrade370380.log +# - cat upgrade370380.log - php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log # - cat upgrade370380-2.log - cd ../.. diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 7f814a826df..2cc29a14a9a 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -8,7 +8,7 @@ This files describe steps made by Dolibarr packaging team to make a beta version of Dolibarr, step by step. - Check all files are commited. -- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base x.y origin/develop`..x.y --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'" +- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base (x.y)-1 origin/develop`..x.y(.z) --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'" - Update version number with x.y.z-w in htdocs/filefunc.inc.php - Update version number with x.y.z-w in build/debian/changelog - Commit all changes. @@ -29,7 +29,7 @@ This files describe steps made by Dolibarr packaging team to make a complete release of Dolibarr, step by step. - Check all files are commited. -- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base x.y origin/develop`..x.y --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'" +- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base (x.y)-1 origin/develop`..x.y(.z) --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'" - Update version number with x.y.z in htdocs/filefunc.inc.php - Update version number with x.y.z in build/debian/changelog - Commit all changes. diff --git a/dev/ansible/README.md b/dev/ansible/README.md index aeed9fc6983..e498ebc3340 100644 --- a/dev/ansible/README.md +++ b/dev/ansible/README.md @@ -3,7 +3,7 @@ This is a quick tutorial: * Install ansible: -> apt-get install +> apt-get install ansible * Add ip of server to manage into /etc/ansible/hosts diff --git a/dev/fixaltlanguages.sh b/dev/fixaltlanguages.sh index bfb9aa900b6..7f42be5b954 100755 --- a/dev/fixaltlanguages.sh +++ b/dev/fixaltlanguages.sh @@ -49,7 +49,7 @@ then if [ -d $reflang ] then echo "***** Process language "$aa"_"$bb" - Search original into "$reflang - echo $dirshort est une langue alternative de $reflang + echo $dirshort is an alternative language of $reflang echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2 ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2 for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done diff --git a/dev/translation/strip_language_file.php b/dev/translation/strip_language_file.php index 6102ed3826c..d612ff66abf 100755 --- a/dev/translation/strip_language_file.php +++ b/dev/translation/strip_language_file.php @@ -314,7 +314,7 @@ foreach($filesToProcess as $fileToProcess) continue; } - // String exists in both files and does not match + // String exists in both files and value into alternative language differs from main language but also from english files if ( (! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key] && ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key]) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index a24ed34e052..e25ceb976ff 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * * 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 @@ -205,36 +205,42 @@ if ($action == 'create') { print '
'; print '' . "\n"; print '' . "\n"; - + + dol_fiche_head(); + print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print '
' . $langs->trans("NumMvts") . '' . $next_num_mvt . '
' . $langs->trans("Docdate") . ''; print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print '
' . $langs->trans("Codejournal") . '' . $html->selectarray('code_journal', $code_journal_array) . '
' . $langs->trans("Docref") . '
' . $langs->trans("Doctype") . '
'; - print '
'; - print ''; - + + dol_fiche_end(); + + print '
'; + print '     '; + print '
'; + print '
'; } else diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 487f4dc2719..d3d6ff8a945 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * * 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 @@ -44,7 +44,6 @@ if ($user->societe_id > 0) /* * Actions */ - if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { if (! GETPOST('cancel', 'alpha')) { @@ -63,6 +62,10 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { } } +/* + * View + */ + llxHeader("", "", "FicheVentilation"); if ($cancel == $langs->trans("Cancel")) { @@ -108,6 +111,8 @@ if (! empty($id)) { $linkback=''.$langs->trans("Back").''; print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'title_setup'); + dol_fiche_head(); + print ''; // Ref facture @@ -120,13 +125,13 @@ if (! empty($id)) { print ''; print ''; print ''; print '
' . $langs->trans("Line") . '' . nl2br($objp->description) . '
' . $langs->trans("Account") . ''; - print $objp->account_number . '-' . $objp->label; - print '
' . $langs->trans("NewAccount") . ''; print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); print '
'; + + dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -144,4 +149,4 @@ if (! empty($id)) { } llxFooter(); -$db->close(); +$db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index df635155416..5a1ffc30bb7 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -1,9 +1,9 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -172,8 +172,8 @@ if ($resql) { while ( $i < $num ) { $row = $db->fetch_row($resql); - - print '' . length_accountg($row[0]) . ''; + $var=!$var; + print '' . length_accountg($row[0]) . ''; print '' . $row[1] . ''; print '' . price($row[2]) . ''; print '' . price($row[3]) . ''; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 3a368f8d3ad..7941a7df4a8 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -43,7 +43,7 @@ $search_facture = GETPOST('search_facture','alpha'); $search_label = GETPOST('search_label','alpha'); $search_desc = GETPOST('search_desc','alpha'); $search_amount = GETPOST('search_amount','alpha'); -$search_acount = GETPOST('search_account','alpha'); +$search_account = GETPOST('search_account','alpha'); // Security check if ($user->societe_id > 0) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index fc3157c318a..75e54b2a590 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -555,9 +555,9 @@ else $h=0; $head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal; $head[$h][1] = $langs->trans("Report"); - $head[$h][2] = 'report'; + $head[$h][2] = 'card'; - dol_fiche_head($head, $hselected); + dol_fiche_head($head, 'card', $langs->trans("BankJournal"), 0, 'payment'); print '
'; print ''; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 51d09428c25..42837680428 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -1,11 +1,11 @@ * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -34,31 +34,32 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; // Langs -$langs->load("compta"); $langs->load("bills"); -$langs->load("other"); -$langs->load("main"); $langs->load("accountancy"); -$action = GETPOST('action'); -$id = GETPOST('id', 'int'); +$action = GETPOST('action', 'alpha'); $codeventil = GETPOST('codeventil'); +$id = GETPOST('id'); // Security check if ($user->societe_id > 0) accessforbidden(); -if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) -{ - $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; - $sql .= " SET fk_code_ventilation = " . $codeventil; - $sql .= " WHERE rowid = " . $id; - - dol_syslog('accountancy/journal/sellsjournal.php:: $sql=' . $sql); - - $resql = $db->query($sql); - if (! $resql) { - setEventMessage($db->lasterror(), 'errors'); +if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { + if (! GETPOST('cancel', 'alpha')) + { + $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; + $sql .= " SET fk_code_ventilation = " . $codeventil; + $sql .= " WHERE rowid = " . $id; + + dol_syslog('accountancy/supplier/card.php:: $sql=' . $sql); + $resql = $db->query($sql); + if (! $resql) { + setEventMessage($db->lasterror(), 'errors'); + } + } else { + header("Location: ./lines.php"); + exit(); } } @@ -78,7 +79,7 @@ $form = new Form($db); $facturefournisseur_static = new FactureFournisseur($db); $formventilation = new FormVentilation($db); -if ($_GET["id"]) { +if (! empty($id)) { $sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, "; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label"; $sql .= ", aa.account_number, aa.label"; @@ -87,11 +88,14 @@ if ($_GET["id"]) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn "; $sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id; + if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; } + dol_syslog("/accounting/supplier/card.php sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); + if ($result) { $num_lines = $db->num_rows($result); $i = 0; @@ -103,7 +107,10 @@ if ($_GET["id"]) { print ''; print ''; - print_fiche_titre($langs->trans("SuppliersVentilation")); + $linkback=''.$langs->trans("Back").''; + print_fiche_titre($langs->trans('SuppliersVentilation'),$linkback,'title_setup'); + + dol_fiche_head(); print '
'; @@ -119,19 +126,24 @@ if ($_GET["id"]) { print ''; print ''; print ''; - print ''; - print '
' . $langs->trans("ProductLabel") . '' . dol_trunc($objp->product_label, 24) . '
' . $langs->trans("Account") . ''; - print $objp->account_number . '-' . $objp->label; - print '
' . $langs->trans("NewAccount") . ''; print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); print '
 
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + print '
'; } else { - print "Error 1"; + print "Error"; } } else { - print "Error 2"; + print "Error"; } } else { print "Error ID incorrect"; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 3bdf2f45a7c..2c2392bfa27 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -158,8 +158,8 @@ if ($resql) { while ( $i < $num ) { $row = $db->fetch_row($resql); - - print '' . length_accountg($row[0]) . ''; + $var=!$var; + print '' . length_accountg($row[0]) . ''; print '' . $row[1] . ''; print '' . price($row[2]) . ''; print '' . price($row[3]) . ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 9cf77779bf4..0edc9e1142f 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -44,7 +44,7 @@ $search_facture = GETPOST('search_facture','alpha'); $search_label = GETPOST('search_label','alpha'); $search_desc = GETPOST('search_desc','alpha'); $search_amount = GETPOST('search_amount','alpha'); -$search_acount = GETPOST('search_account','alpha'); +$search_account = GETPOST('search_account','alpha'); // Security check if ($user->societe_id > 0) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 100d1e23e74..924d9bc4481 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1045,7 +1045,7 @@ else { if ($object->photo) print "
\n"; print ''; - if ($object->photo) print ''; + if ($object->photo) print ''; print ''; print ''; print '
'.$langs->trans("Delete").'

'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 05035fa1f9f..ff6c1eb7963 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -107,7 +107,7 @@ if ($sall) foreach ($scrit as $crit) { $sql.=" AND ("; - if (is_numeric($sall)) $sql.= "d.rowid = ".$sall." OR "; + if (is_numeric($sall)) $sql.= "d.rowid = ".$db->escape($sall)." OR "; $sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'"; $sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'"; $sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')"; @@ -115,7 +115,7 @@ if ($sall) } if ($type > 0) { - $sql.=" AND t.rowid=".$type; + $sql.=" AND t.rowid=".$db->escape($type); } if (isset($_GET["statut"]) || isset($_POST["statut"])) { diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index d5c78761989..dccf26e75c0 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -420,7 +420,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; if ($mysoc->country_code) { - print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,$mysoc->country_code); + print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'legal_form'); } else { diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 2c37bcd9e42..9ef2ff7c7e4 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,0,25,0,26); +$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,24,0,22,20,18,21,0,15,0,25,0,26); // Name of SQL tables of dictionaries $tabname=array(); @@ -832,7 +832,7 @@ if ($id) $fieldlist=explode(',',$tabfield[$id]); // Line for title - print ''; + print ''; foreach ($fieldlist as $field => $value) { // Determine le nom du champ par rapport aux noms possibles diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 2b50008d58a..53937687b57 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -121,7 +121,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml'])) $pathtodelete=$listofpaths[$keytodelete]; $filetodelete=$listofnames[$keytodelete]; $result = dol_delete_file($pathtodelete,1); - if ($result >= 0) + if ($result) { setEventMessage($langs->trans("FileWasRemoved"), $filetodelete); diff --git a/htdocs/admin/tools/index.php b/htdocs/admin/tools/index.php index ae1fad8c272..4ea716c322b 100644 --- a/htdocs/admin/tools/index.php +++ b/htdocs/admin/tools/index.php @@ -53,7 +53,9 @@ print '

'; // Show logo -print '
'; +//print '
'; +print '
'; // For a reason I don't know, the div class="center does not works, we must keep the
+ llxFooter(); $db->close(); diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index 9003a92cddf..e40caa3e36e 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -89,7 +89,7 @@ if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allf // If (file that is not logfile) or (if logfile with option logfile) if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile') { - $count+=dol_delete_file($filesarray[$key]['fullname']); + $count+=(dol_delete_file($filesarray[$key]['fullname'])?1:0); } } } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index aa34c83523c..fcb3444be10 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent @@ -151,7 +151,7 @@ if ($action == 'add') exit; } - $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status + $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters $datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); @@ -671,7 +671,7 @@ if ($action == 'create') } // Assigned to - print ''.$langs->trans("ActionAffectedTo").''; + print ''.$langs->trans("ActionAffectedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { @@ -727,7 +727,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("ActionOnContact").''; - $form->select_contacts(GETPOST('socid','int'),GETPOST('contactid'),'contactid',1); + $form->select_contacts(GETPOST('socid','int'), GETPOST('contactid'), 'contactid', 1, '', '', 0, 'minwidth200'); print ''; @@ -739,7 +739,7 @@ if ($action == 'create') // Projet associe $langs->load("projects"); - print ''.$langs->trans("Project").''; + print ''.$langs->trans("Project").''; $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); if ($numproject==0) @@ -768,7 +768,7 @@ if ($action == 'create') print ''; // Description - print ''.$langs->trans("Description").''; + print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_6,90); $doleditor->Create(); @@ -915,7 +915,7 @@ if ($id > 0) } // Assigned to - print ''.$langs->trans("ActionAssignedTo").''; + print ''.$langs->trans("ActionAssignedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { @@ -968,7 +968,7 @@ if ($id > 0) // Contact print ''.$langs->trans("Contact").''; - $form->select_contacts($object->socid, $object->contactid,'contactid',1); + $form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200'); print ''; } @@ -981,7 +981,7 @@ if ($id > 0) // Projet associe $langs->load("project"); - print ''.$langs->trans("Project").''; + print ''.$langs->trans("Project").''; $numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid'); if ($numprojet==0) { @@ -1004,7 +1004,7 @@ if ($id > 0) } // Description - print ''.$langs->trans("Description").''; + print ''.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); @@ -1168,7 +1168,7 @@ if ($id > 0) // Project if (! empty($conf->projet->enabled)) { - print ''.$langs->trans("Project").''; + print ''.$langs->trans("Project").''; if ($object->fk_project) { $project=new Project($db); @@ -1192,7 +1192,7 @@ if ($id > 0) } // Description - print ''.$langs->trans("Description").''; + print ''.$langs->trans("Description").''; print dol_htmlentitiesbr($object->note); print ''; @@ -1267,7 +1267,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; + print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' '; print ''."\n"; print '
'; print ''; @@ -1276,7 +1276,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' '; print '
'."\n"; print '
'; print ''; @@ -1285,7 +1285,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' '; print '
'."\n"; print '
'; print ''; @@ -1294,7 +1294,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' '; print '
'."\n"; print '
'; diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 82d88089684..598b02ef0b8 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Simon TOSSER @@ -143,7 +143,7 @@ if ($object->id > 0) print ''.$langs->trans("Title").''.$object->label.''; // Full day event - print ''.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent).''; + print ''.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).''; // Date start print ''.$langs->trans("DateActionStart").''; @@ -235,7 +235,7 @@ if ($object->id > 0) // Project if (! empty($conf->projet->enabled)) { - print ''.$langs->trans("Project").''; + print ''.$langs->trans("Project").''; if ($object->fk_project) { $project=new Project($db); @@ -274,7 +274,7 @@ if ($object->id > 0) } - print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; + print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; print ''; @@ -294,7 +294,7 @@ if ($object->id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; + print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' '; print ''."\n"; print '
'; print ''; @@ -303,7 +303,7 @@ if ($object->id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' '; print '
'."\n"; print '
'; print ''; @@ -312,7 +312,7 @@ if ($object->id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' '; print '
'."\n"; print '
'; print ''; @@ -321,7 +321,7 @@ if ($object->id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' '; print '
'."\n"; print '
'; diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php index c49881ba542..6759ae22196 100644 --- a/htdocs/comm/askpricesupplier/card.php +++ b/htdocs/comm/askpricesupplier/card.php @@ -1737,7 +1737,7 @@ if ($action == 'create') $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; // Define output language $outputlangs = $langs; @@ -1763,7 +1763,7 @@ if ($action == 'create') exit(); } $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; } print '
'; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 5be006c0053..47accf6b9a0 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -640,7 +640,6 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - // Go back to draft if ($action == 'modif' && $user->rights->propal->creer) { @@ -2312,7 +2311,7 @@ if ($action == 'create') $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; // Define output language $outputlangs = $langs; @@ -2337,7 +2336,7 @@ if ($action == 'create') exit(); } $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; } print '
'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4b7d0104ec9..5a4b434286c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2325,7 +2325,7 @@ if ($action == 'create' && $user->rights->commande->creer) $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; // Define output language $outputlangs = $langs; @@ -2350,7 +2350,7 @@ if ($action == 'create' && $user->rights->commande->creer) exit(); } $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; } print '
'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 88d6bb587e4..410377c5683 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1759,10 +1759,8 @@ if (empty($reshook)) $upload_dir = $conf->facture->dir_output; $file = $upload_dir . '/' . GETPOST('file'); $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) - setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else - setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); $action = ''; } } @@ -2479,7 +2477,7 @@ if ($action == 'create') // Button "Create Draft" print '
'; print ''; - print '     '; + print '     '; print ''; print '
'; @@ -3754,7 +3752,7 @@ if ($action == 'create') } print '
'; - //Select mail models is same action as presend + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } @@ -3834,7 +3832,7 @@ if ($action == 'create') $i ++; } print ''; - print '
 
'; + print '
     
'; print ''; $db->free($resqlorderlist); } else { @@ -3887,7 +3885,7 @@ if ($action == 'create') $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; // Define output language $outputlangs = $langs; @@ -3912,13 +3910,15 @@ if ($action == 'create') exit(); } $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); - $file = $fileparams ['fullname']; + $file = $fileparams['fullname']; } print '
'; print_titre($langs->trans($titreform)); // Cree l'objet formulaire mail + dol_fiche_head(); + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); @@ -3990,7 +3990,7 @@ if ($action == 'create') print $formmail->get_form(); - print '
'; + dol_fiche_end(); } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a347ccdbca8..075173d31c9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3203,7 +3203,7 @@ class Facture extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); - $response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; + $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1'; $response->img=img_object($langs->trans("Bills"),"bill"); while ($obj=$this->db->fetch_object($resql)) diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 4028849b5fa..5d8d22cfa9d 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -84,6 +84,8 @@ class FactureStats extends Stats $this->where.=" AND f.fk_soc = ".$this->socid; } if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid; + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $this->where.= " AND f.type IN (0,1,2)"; + else $this->where.= " AND f.type IN (0,1,2,3)"; } @@ -206,7 +208,7 @@ class FactureStats extends Stats $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->where; $sql.= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid"; $sql.= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'"; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 6c82dcd4d8a..2668f0f1af6 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -2,10 +2,11 @@ /* Copyright (C) 2002-2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015 Alexandre Spangaro * * 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 @@ -128,6 +129,8 @@ if ($action == 'create') print ''; print ''; print ''; + + dol_fiche_head(); $rowspan=4; if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++; @@ -139,7 +142,7 @@ if ($action == 'create') // Third party print ''.$langs->trans("Customer").''.$object->client->getNomUrl(1,'customer').''; print ''; - //print $langs->trans("NotePrivate"); + print $langs->trans("Comment"); print ''; // Title @@ -371,10 +374,15 @@ if ($action == 'create') print ''; print ''; } - print '
'; - print "\n"; print "\n"; + dol_fiche_end(); + + print '
'; + print '     '; + print ''; + print '
'; + print "\n"; } else { @@ -432,7 +440,7 @@ else $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id,'none'); print ""; - print ''.$langs->trans("Note").''.nl2br($object->note_private).""; + print ''.$langs->trans("Comment").''.nl2br($object->note_private).""; print ""; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 3d3a8ab2197..11296bda93e 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -775,7 +775,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $i = 0; print ''; - print ''; + print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 58865c38540..98fe402266c 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -6,7 +6,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2014 Raphaël Doursenaud - * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> + * 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 @@ -403,6 +403,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; + dol_fiche_head(); + print '
'.$langs->trans("BillsCustomersUnpaid",$num).' '.$num.'
'.$langs->trans("BillsCustomersUnpaid",$num).' '.$num.''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("Received").'
'; // Third party @@ -462,6 +464,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print '
'; + dol_fiche_end(); + /* * List of unpaid invoices */ diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php new file mode 100644 index 00000000000..71f10388ace --- /dev/null +++ b/htdocs/compta/salaries/document.php @@ -0,0 +1,136 @@ + + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005 Simon TOSSER + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Alexandre Spangaro + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/compta/salaries/document.php + * \ingroup salaries + * \brief Page of linked files onto salaries + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; + +$langs->load("other"); +$langs->load("salaries"); +$langs->load("companies"); + +$id = GETPOST('id','int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); + +// Security check +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'salaries', $id, ''); + + +// Get parameters +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if ($page == -1) { $page = 0; } +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="name"; + + +$object = new PaymentSalary($db); +$object->fetch($id, $ref); + +$upload_dir = $conf->salaries->dir_output.'/'.dol_sanitizeFileName($object->id); +$modulepart='salaries'; + + +/* + * Actions + */ + +include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; + + +/* + * View + */ + +$form = new Form($db); + +llxHeader("","",$langs->trans("SalaryPayment")); + + +if ($object->id) +{ + $object->fetch_thirdparty(); + + $head=salaries_prepare_head($object); + + dol_fiche_head($head, 'documents', $langs->trans("SalaryPayment"), 0, 'payment'); + + + // Construit liste des fichiers + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $totalsize=0; + foreach($filearray as $key => $file) + { + $totalsize+=$file['size']; + } + + + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Societe + //print ""; + + print ''; + print ''; + print '
'.$langs->trans("Ref").''; + print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + print '
".$langs->trans("Company")."".$object->client->getNomUrl(1)."
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; + + print ''; + + $modulepart = 'salaries'; + $permission = $user->rights->salaries->write; + $param = '&id=' . $object->id; + include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; + +} +else +{ + print $langs->trans("ErrorUnknown"); +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 740f6f3bf5e..4d638e23cf7 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -501,7 +501,7 @@ if ($id > 0) } // Emettre paiement - if ($object->paye == 0 && ((price2num($object->amount) < 0 && round($resteapayer) < 0) || (price2num($object->amount) > 0 && round($resteapayer) > 0)) && $user->rights->tax->charges->creer) + if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer) { print "id&action=create\">".$langs->trans("DoPayment").""; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 3d75c4a2036..588ce2b01ff 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -201,8 +201,12 @@ if (empty($reshook)) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - if ($ret < 0) $error++; - + if ($ret < 0) + { + $error++; + $action = 'create'; + } + if (! GETPOST("lastname")) { $error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 72590c82e82..ca85995a7d3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -629,6 +629,13 @@ class Contact extends CommonObject } } + // Retreive all extrafield for contact + // fetch optionals attributes and labels + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); + return 1; } else @@ -1101,4 +1108,4 @@ class Contact extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } -} \ No newline at end of file +} diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 72eee453c9f..11d46ad3fc4 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -159,7 +159,7 @@ else if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")"; } -if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; +if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_firstlast_only) { @@ -256,11 +256,11 @@ if ($result) { $contactstatic=new Contact($db); - $param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); - $param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); - if (!empty($search_categ)) $param.='&search_categ='.$search_categ; - if ($search_status != '') $param.='&search_status='.$search_status; - if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); + $param ='&begin='.htmlspecialchars($begin).'&view='.htmlspecialchars($view).'&userid='.htmlspecialchars($userid).'&contactname='.htmlspecialchars($sall); + $param.='&type='.htmlspecialchars($type).'&view='.htmlspecialchars($view).'&search_lastname='.htmlspecialchars($search_lastname).'&search_firstname='.htmlspecialchars($search_firstname).'&search_societe='.htmlspecialchars($search_societe).'&search_email='.htmlspecialchars($search_email); + if (!empty($search_categ)) $param.='&search_categ='.htmlspecialchars($search_categ); + if ($search_status != '') $param.='&search_status='.htmlspecialchars($search_status); + if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".htmlspecialchars($search_priv); $num = $db->num_rows($result); $i = 0; @@ -269,7 +269,7 @@ if ($result) print '
'; print ''; - print ''; + print ''; print ''; print ''; @@ -317,36 +317,36 @@ if ($result) // Ligne des champs de filtres print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { print ''; - print ''; + print ''; print ''; } print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->skype->enabled)) { print ''; - print ''; + print ''; print ''; } print ' '; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index dd48b27684f..192a2d16b17 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -823,10 +823,8 @@ else if ($action == 'remove_file' && $user->rights->contrat->creer) { $upload_dir = $conf->contrat->dir_output; $file = $upload_dir . '/' . GETPOST('file'); $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) - setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); - else - setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); } } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 25b5d80fa98..669f2b09775 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -100,7 +100,8 @@ $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " AND c.entity = ".$conf->entity; -if ($socid) $sql.= " AND s.rowid = ".$socid; +if ($socid) $sql.= " AND s.rowid = ".$db->escape($socid); +if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($search_name) { $sql .= natural_search('s.nom', $search_name); @@ -112,7 +113,7 @@ if (!empty($search_ref_supplier)) { $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); } -if ($search_sale > 0) +if ($search_sale > 0) { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; } @@ -131,7 +132,7 @@ if ($resql) $i = 0; print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png'); - + print ''; print ''; @@ -144,7 +145,7 @@ if ($resql) $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user); $moreforfilter.='       '; } - + if ($moreforfilter) { print ''; @@ -152,13 +153,14 @@ if ($resql) print $moreforfilter; print ''; } - + print ''; - $param='&search_contract='.$search_contract; - $param.='&search_name='.$search_name; - $param.='&search_ref_supplier='.$search_ref_supplier; + + $param='&search_contract='.$search_contract; + $param.='&search_name='.$search_name; + $param.='&search_ref_supplier='.$search_ref_supplier; $param.='&search_sale=' .$search_sale; - + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder); @@ -175,13 +177,13 @@ if ($resql) print ''; print ''; print ''; print ''; print ''; print ''; //print ''; @@ -202,7 +204,7 @@ if ($resql) print ''; print ''; //print ''; - + // Sales Rapresentatives print ''; - - + + print ''; //print ''; print ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0bd0625ee5d..10f91a07631 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -525,9 +525,9 @@ abstract class CommonObject * Return array with list of possible values for type of contacts * * @param string $source 'internal', 'external' or 'all' - * @param string $order Sort order by : 'code' or 'rowid' - * @param string $option 0=Return array id->label, 1=Return array code->label - * @param string $activeonly 0=all status of contact, 1=only the active + * @param string $order Sort order by 'code' or 'rowid' + * @param int $option 0=Return array id->label, 1=Return array code->label + * @param int $activeonly 0=all status of contact, 1=only the active * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ @@ -541,7 +541,7 @@ abstract class CommonObject $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; - if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active type + if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types if (! empty($source) && $source != 'all') $sql.= " AND tc.source='".$source."'"; if (! empty($code)) $sql.= " AND tc.code='".$code."'"; $sql.= " ORDER by tc.".$order; @@ -626,12 +626,12 @@ abstract class CommonObject } /** - * Charge le contact d'id $id dans this->contact + * Load object contact with id=$this->contactid into $this->contact * * @param int $contactid Id du contact. Use this->contactid if empty. * @return int <0 if KO, >0 if OK */ - function fetch_contact($contactid='') + function fetch_contact($contactid=null) { if (empty($contactid)) $contactid=$this->contactid; @@ -858,14 +858,14 @@ abstract class CommonObject /** * Update a specific field into database * - * @param string $field Field to update - * @param mixed $value New value - * @param string $table To force other table element or element line (should not be used) - * @param int $id To force other object id (should not be used) - * @param string $format Data format ('text', 'date'). 'text' is used if not defined - * @param string $id_field To force rowid field name. 'rowid' is used it not defined - * @param string $user Update last update fields also if user object provided - * @return int <0 if KO, >0 if OK + * @param string $field Field to update + * @param mixed $value New value + * @param string $table To force other table element or element line (should not be used) + * @param int $id To force other object id (should not be used) + * @param string $format Data format ('text', 'date'). 'text' is used if not defined + * @param string $id_field To force rowid field name. 'rowid' is used it not defined + * @param User|string $user Update last update fields also if user object provided + * @return int <0 if KO, >0 if OK */ function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='') { @@ -1655,10 +1655,10 @@ abstract class CommonObject * @param int $exclspec >0 = Exclude special product (product_type=9) * @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total * @param int $nodatabaseupdate 1=Do not update database. Update only properties of object. - * @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object. For this, we need seller object. + * @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object and for this, we need seller object. * @return int <0 if KO, >0 if OK */ - function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller='') + function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null) { global $conf; @@ -2684,9 +2684,9 @@ abstract class CommonObject * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. * * @param string $action Action code - * @param string $seller Object of seller third party - * @param string $buyer Object of buyer third party - * @param string $selected Object line selected + * @param Societe $seller Object of seller third party + * @param Societe $buyer Object of buyer third party + * @param int $selected Object line selected * @param int $dateSelector 1=Show also date range input fields * @return void */ @@ -2799,16 +2799,16 @@ abstract class CommonObject * Return HTML content of a detail line * TODO Move this into an output class file (htmlline.class.php) * - * @param string $action GET/POST action - * @param CommonObjectLine $line Selected object line to output - * @param string $var Is it a an odd line (true) - * @param int $num Number of line (0) - * @param int $i I - * @param int $dateSelector 1=Show also date range input fields - * @param string $seller Object of seller third party - * @param string $buyer Object of buyer third party - * @param string $selected Object line selected - * @param object $extrafieldsline Object of extrafield line attribute + * @param string $action GET/POST action + * @param CommonObjectLine $line Selected object line to output + * @param string $var Is it a an odd line (true) + * @param int $num Number of line (0) + * @param int $i I + * @param int $dateSelector 1=Show also date range input fields + * @param Societe $seller Object of seller third party + * @param Societe $buyer Object of buyer third party + * @param int $selected Object line selected + * @param object $extrafieldsline Object of extrafield line attribute * @return void */ function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0) @@ -3086,7 +3086,7 @@ abstract class CommonObject /** * get Margin info * - * @param string $force_price True of not + * @param boolean $force_price True of not * @return mixed Array with info */ function getMarginInfos($force_price=false) @@ -3212,7 +3212,7 @@ abstract class CommonObject /** * Show the array with all margin infos * - * @param string $force_price Force price + * @param boolean $force_price Force price * @return void */ function displayMarginInfos($force_price=false) @@ -3304,7 +3304,7 @@ abstract class CommonObject /** * Add resources to the current object : add entry into llx_element_resources - *Need $this->element & $this->id + * Need $this->element & $this->id * * @param int $resource_id Resource id * @param string $resource_element Resource element @@ -3726,7 +3726,7 @@ abstract class CommonObject { $attributeKey = substr($key,8); // Remove 'options_' prefix $attributeType = $extrafields->attribute_type[$attributeKey]; - $attributeSize = $extrafields->attribute_size[$attributeKey]; + //$attributeSize = $extrafields->attribute_size[$attributeKey]; Not required to insert an extrafield value. Only used for definition. $attributeLabel = $extrafields->attribute_label[$attributeKey]; $attributeParam = $extrafields->attribute_param[$attributeKey]; switch ($attributeType) @@ -3751,19 +3751,19 @@ abstract class CommonObject case 'datetime': $this->array_options[$key]=$this->db->idate($this->array_options[$key]); break; - case 'link': - $param_list=array_keys($attributeParam ['options']); - // 0 : ObjectName - // 1 : classPath - $InfoFieldList = explode(":", $param_list[0]); - dol_include_once($InfoFieldList[1]); - $object = new $InfoFieldList[0]($this->db); - if ($value) - { - $object->fetch(0,$value); - $this->array_options[$key]=$object->id; - } - break; + case 'link': + $param_list=array_keys($attributeParam ['options']); + // 0 : ObjectName + // 1 : classPath + $InfoFieldList = explode(":", $param_list[0]); + dol_include_once($InfoFieldList[1]); + $object = new $InfoFieldList[0]($this->db); + if ($value) + { + $object->fetch(0,$value); + $this->array_options[$key]=$object->id; + } + break; } } $this->db->begin(); @@ -3771,6 +3771,7 @@ abstract class CommonObject $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); $this->db->query($sql_del); + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; foreach($this->array_options as $key => $value) { @@ -3825,7 +3826,7 @@ abstract class CommonObject * * @return string */ - function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='') + function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='') { global $_POST, $conf; diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 4b934b331f3..fdd0fc2732c 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -91,7 +91,14 @@ class dolprintIPP } } // Getting Jobs - $ipp->getJobs(false,0,'completed',false); + try { + $ipp->getJobs(false,0,'completed',false); // May return errors if setup not correct + } + catch(Exception $e) + { + print $e->getMessage(); + } + print '
'; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print '  '.$obj->ref_supplier.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''.dol_print_date($obj->datec).''; if($obj->socid) @@ -237,8 +239,8 @@ if ($resql) print ' '; } print ''.dol_print_date($db->jdate($obj->date_contrat)).''.$staticcontrat->LibStatut($obj->statut,3).''.($obj->nb_initial>0?$obj->nb_initial:'').'
'; print ''; print ""; @@ -102,19 +109,22 @@ class dolprintIPP print ""; print "\n"; $jobs = $ipp->jobs_attributes; - $var = True; + $var = true; //print '
'.print_r($jobs,true).'
'; - foreach ($jobs as $value ) + if (is_array($jobs)) { - $var=!$var; - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + foreach ($jobs as $value) + { + $var=!$var; + print ""; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } } print "
IdCancel
'.$value->job_id->_value0.''.$value->job_originating_user_name->_value0.''.$value->printer_uri->_value0.''.$value->job_name->_value0.''.$value->job_state->_value0.''.$value->job_uri->_value0.'
'.$value->job_id->_value0.''.$value->job_originating_user_name->_value0.''.$value->printer_uri->_value0.''.$value->job_name->_value0.''.$value->job_state->_value0.''.$value->job_uri->_value0.'
"; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e2313d157d5..34abeeb8c6e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -39,7 +39,7 @@ class ExtraFields var $attribute_type; // Tableau contenant le nom des champs en clef et le label de ces champs en value var $attribute_label; - // Tableau contenant le nom des champs en clef et la taille de ces champs en value + // Tableau contenant le nom des champs en clef et la taille/longueur max de ces champs en value var $attribute_size; // Tableau contenant le nom des choix en clef et la valeur de ces choix en value var $attribute_choice; @@ -124,6 +124,7 @@ class ExtraFields if (empty($label)) return -1; if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; // Create field into database except for separator type which is not stored in database if ($type != 'separate') @@ -169,6 +170,7 @@ class ExtraFields private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list=0) { if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; @@ -248,6 +250,7 @@ class ExtraFields global $conf; if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; // Clean parameters if (empty($pos)) $pos=0; @@ -308,6 +311,7 @@ class ExtraFields function delete($attrname, $elementtype='member') { if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; @@ -342,6 +346,7 @@ class ExtraFields global $conf; if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) { @@ -389,6 +394,7 @@ class ExtraFields function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='') { if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; @@ -486,6 +492,8 @@ class ExtraFields // Clean parameters if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; + if (empty($list)) $list=0; if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) @@ -570,6 +578,7 @@ class ExtraFields if ( empty($elementtype) ) return array(); if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; $array_name_label=array(); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 47810e204bd..ee7742660c1 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -116,9 +116,9 @@ class HookManager * @param array $parameters Array of parameters * @param Object $object Object to use hooks on * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) - * @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 means KO. - * For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints. - * Can also return some values into an array ->results. + * @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO. + * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. + * All types can also return some values into an array ->results. * $this->error or this->errors are also defined by class called by this function if error. */ function executeHooks($method, $parameters=false, &$object='', &$action='') @@ -135,7 +135,8 @@ class HookManager array( 'addMoreActionsButtons', 'addStatisticLine', - 'doActions', + 'deleteFile', + 'doActions', 'formCreateThirdpartyOptions', 'formObjectOptions', 'formattachOptions', @@ -147,7 +148,7 @@ class HookManager 'formatEvent' ) )) $hooktype='addreplace'; - // Deprecated hook types + // Deprecated hook types ('returnvalue') if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks. if ($method == 'insertExtraFields') { @@ -195,7 +196,7 @@ class HookManager if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; } - // Generic hooks that return a string or array (printSearchForm, printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) + // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) else { // TODO. this should be done into the method of hook by returning nothing diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b4e5a8a0ec0..53f77262db1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -415,7 +415,7 @@ class Form if ($direction > 0) { $s.='<'.$tag.$paramfortooltipimg; if ($tag == 'td') { - $s .= ' valign="top" width="14"'; + $s .= ' valign="middle" width="14"'; } $s.= '>'.$img.''; } @@ -503,7 +503,7 @@ class Form $resql=$this->db->query($sql); if ($resql) { - $out.= ''; $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -531,7 +531,7 @@ class Form if (empty($row['favorite']) && $atleastonefavorite) { $atleastonefavorite=0; - $out.= ''; + $out.= ''; } if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) ) { @@ -554,6 +554,10 @@ class Form dol_print_error($this->db); } + // Make select dynamic + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out .= ajax_combobox('select'.$htmlname); + return $out; } @@ -1451,7 +1455,7 @@ class Form $out.=''; $out.=''; $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); - $out.=''; + $out.=' '; } $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) @@ -2825,7 +2829,7 @@ class Form /** * Creates HTML units selector (code => label) * - * @param string $selected Preselected code ('km', 'm', 'l', 'p', ...) + * @param string $selected Preselected Unit ID * @param string $htmlname Select name * @param int $showempty Add a nempty line * @return string HTML select @@ -2846,13 +2850,13 @@ class Form while($res = $this->db->fetch_object($resql)) { - if ($selected == $res[0]) + if ($selected == $res->rowid) { - $return.=''; + $return.=''; } else { - $return.=''; + $return.=''; } } $return.=''; @@ -4343,8 +4347,8 @@ class Form $(document).ready(function () { $(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({ dir: \'ltr\', - width: \'off\', - minimumInputLength: 0 + width: \'resolve\', /* off or resolve */ + minimumInputLength: '.$minLengthToAutocomplete.' }); }); '; @@ -4701,15 +4705,15 @@ class Form * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. * * @param object $object Object to show - * @param string $paramid Name of parameter to use to name the id into the URL link - * @param string $morehtml More html content to output just before the nav bar + * @param string $paramid Name of parameter to use to name the id into the URL link + * @param string $morehtml More html content to output just before the nav bar * @param int $shownav Show Condition (navigation is shown if value is 1) - * @param string $fieldid Nom du champ en base a utiliser pour select next et previous - * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous - * @param string $morehtmlref Code html supplementaire a afficher apres ref - * @param string $moreparam More param to add in nav link url. + * @param string $fieldid Nom du champ en base a utiliser pour select next et previous + * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous + * @param string $morehtmlref Code html supplementaire a afficher apres ref + * @param string $moreparam More param to add in nav link url. * @param int $nodbprefix Do not include DB prefix to forge table name - * @return string Portion HTML avec ref + boutons nav + * @return string Portion HTML avec ref + boutons nav */ function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0) { @@ -4788,11 +4792,14 @@ class Form * @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto') * @param object $object Object containing data to retrieve file name * @param int $width Width of photo + * @param int $height Height of photo (auto if 0) + * @param int $caneditfield Add edit fields + * @param string $photologo CSS name to use on img for photo * @return string HTML code to output photo */ - static function showphoto($modulepart,$object,$width=100) + static function showphoto($modulepart,$object,$width=100,$height=0,$caneditfield=0,$cssclass='photowithmargin') { - global $conf; + global $conf,$langs; $entity = (! empty($object->entity) ? $object->entity : $conf->entity); $id = (! empty($object->id) ? $object->id : $object->rowid); @@ -4819,7 +4826,7 @@ class Form if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo; if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; - }else { + } else { $dir=$conf->$modulepart->dir_output; if ($object->photo) $file=get_exdir($id, 2, 0, 0, $adherent, 'member').'photos/'.$object->photo; if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility @@ -4833,28 +4840,47 @@ class Form { // TODO Link to large image $ret.=''; - $ret.=''; + $ret.='Photo'; $ret.=''; } else if ($altfile && file_exists($dir."/".$altfile)) { $ret.=''; - $ret.=''; + $ret.='Photo alt'; $ret.=''; } else - { - if (! empty($conf->gravatar->enabled) && $email) + { + $nophoto='/theme/common/nophoto.jpg'; + if (in_array($modulepart,array('userphoto','contact'))) // For module thar are "physical" users + { + $nophoto='/theme/common/user_anonymous.png'; + if ($object->gender == 'man') $nophoto='/theme/common/user_man.png'; + if ($object->gender == 'woman') $nophoto='/theme/common/user_woman.png'; + } + + if (! empty($conf->gravatar->enabled) && $email) { global $dolibarr_main_url_root; $ret.=''; - $ret.='Photo found on Gravatar'; // gravatar need md5 hash + $ret.='Photo found on Gravatar'; // gravatar need md5 hash } else - { - $ret.='No photo'; + { + $ret.='No photo'; } } + + if ($caneditfield) + { + if ($object->photo) $ret.="
\n"; + $ret.=''; + if ($object->photo) $ret.=''; + $ret.=''; + $ret.=''; + $ret.='
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; + } + } else dol_print_error('','Call of showphoto with wrong parameters'); diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index e5d8fa5688e..d3ffa569a7a 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -105,6 +105,10 @@ class FormAdmin } $out.= ''; + // Make select dynamic + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out.= ajax_combobox($htmlname); + return $out; } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 4f600ac0705..05200feee30 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -210,6 +210,7 @@ class FormCompany * @param string $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param string $htmlname Id of department * @return string String with HTML select + * @see select_country */ function select_state($selected='',$country_codeid=0, $htmlname='state_id') { @@ -234,7 +235,7 @@ class FormCompany $result=$this->db->query($sql); if ($result) { - if (!empty($htmlname)) $out.= ''; if ($country_codeid) $out.= ''; $num = $this->db->num_rows($result); $i = 0; @@ -277,13 +278,17 @@ class FormCompany } } if (! empty($htmlname)) $out.= ''; - if (! empty($htmlname) && $user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + if (! empty($htmlname) && $user->admin) $out.= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } else { dol_print_error($this->db); } + // Make select dynamic + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlname); + return $out; } @@ -431,9 +436,10 @@ class FormCompany * @param string $selected Preselected code of juridical type * @param int $country_codeid 0=list for all countries, otherwise list only country requested * @param string $filter Add a SQL filter on list + * @param string $htmlname HTML name of select * @return string String with HTML select */ - function select_juridicalstatus($selected='', $country_codeid=0, $filter='') + function select_juridicalstatus($selected='', $country_codeid=0, $filter='', $htmlname='forme_juridique_code') { global $conf,$langs,$user; $langs->load("dict"); @@ -454,7 +460,7 @@ class FormCompany if ($resql) { $out.= '
'; - $out.= ''; if ($country_codeid) $out.= ''; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select. $num = $this->db->num_rows($resql); @@ -488,7 +494,7 @@ class FormCompany // Show break when we are in multi country mode if (empty($country_codeid) && $val['country_code']) { - $out.= '\n"; + $out.= '\n"; $country=$val['country']; } } @@ -508,6 +514,11 @@ class FormCompany } $out.= ''; if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + + // Make select dynamic + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlname); + $out.= '
'; } else diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 8013896d7bd..8ebdc547cc8 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -421,6 +421,15 @@ function actions_prepare_head($object) $head[$h][2] = 'card'; $h++; + // Tab to link resources + if ($conf->resource->enabled) + { + $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id; + $head[$h][1] = $langs->trans("Resources"); + $head[$h][2] = 'resources'; + $h++; + } + // Attached files require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $upload_dir = $conf->agenda->dir_output . "/" . $object->id; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 0b119ada66a..47c4773cf62 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -328,14 +328,17 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; - $msg = '