diff --git a/ChangeLog b/ChangeLog index fd951104b7d..1f07b3dc1de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: +- New: PDF event report show project and status of event. +- New: Onto event summary of elements, end date and status are visible. - New: Can filter on status on interventions. - New: Add help info of field type into dictionary of payment types. - New: Add proposals into referer page of thirdparty. @@ -133,6 +135,7 @@ For users: - Fix: Iban was used instead of Bic into SEPA file. - Fix: Must unaccent strings into SEPA file. - 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. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: @@ -266,9 +269,16 @@ Fix: When disabled, all fields to add time into task line must be disabled. Fix: Missing include files.lib.php in some pages that use dol_delete_recursive Fix: [ bug #1558 ] Product/service edit page title shows new Ref instead of old ref. Fix: [ bug #1553 ] Saving User displays setup removes menu. -Fix: [ bug #1544 ] Can remove date from invoice -Fix: list event view lost type event filter -Fix: Add code save on create event +Fix: [ bug #1544 ] Can remove date from invoice. +Fix: list event view lost type event filter. +Fix: Add code save on create event. +Fix: SQL injection. +Fix: [ bug #1589 ] Menu type in "Edit menu" page is not translated +Fix: [ bug #1591 ] Linked object block shows Total HT/TTC even if not having permission to read them +Fix: [ bug #1577 ] When creating new Private individual third, selected third type is ignored +Fix: [ bug #1555 ] Update accountancy code of products does not throw PRODUCT_MODIFY trigger +Fix: [ bug #1548 ] Supplier payment card shows type in French +Fix: [ bug #1546 ] Incorrect page number when searching in the list of bank transactions ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/build/debian/control b/build/debian/control index d22f556acaa..f4f9e12aa58 100755 --- a/build/debian/control +++ b/build/debian/control @@ -39,7 +39,7 @@ Description: Web based software to manage a company or foundation It's a web software you can install as a standalone program or on any web hosting provider to use it from anywhere with any web browser. . - Dolibarr was designed to be easy to use. Only the features that you need + Dolibarr was designed to be easy to use. Only the features that you need are visible, depending on which modules were activated. . This is an example of most common used modules: diff --git a/build/debian/copyright b/build/debian/copyright index d75283b535a..73109152034 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -61,7 +61,7 @@ License: GPL-3+ Files: htdocs/includes/adodbtime/* Copyright: 2003-2005, John Lim unknown, jackbbs -License: BSD +License: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -272,7 +272,7 @@ Comment: Files: htdocs/includes/jquery/plugins/flot/* Copyright: Flot team -License: Public Domain +License: Public-Domain This work is not subject to copyright in any jurisdiction Comment: Those files are not shipped in the binary package because we configure diff --git a/build/debian/get-orig-source.sh b/build/debian/get-orig-source.sh index 821a639a470..cc22a53c908 100755 --- a/build/debian/get-orig-source.sh +++ b/build/debian/get-orig-source.sh @@ -7,40 +7,20 @@ tmpdir=$(mktemp -d) if [ -n "$1" ]; then uscan_opts="--download-version=$1" fi -#uscan --noconf --force-download --no-symlink --destdir=$tmpdir $uscan_opts +#uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts cd $tmpdir # Other method to download (comment uscan if you use this) -wget http://sourceforge.net/projects/tcpdf/files/tcpdf_6_0_093.zip +wget http://www.dolibarr.org/files/stable/standard/dolibarr-3.5.4.tgz # Rename file to add +dfsg -zipfile=$(echo *.zip) -version=$(echo "$zipfile" | perl -pi -e 's/^tcpdf_//; s/\.zip$//; s/_/./g; s/$/+dfsg/;') - -# Extract the zip file -unzip -q $zipfile -srcdir=$(find . -maxdepth 1 -mindepth 1 -type d | sed -e 's/\.\///') - -if [ ! -d "$srcdir" ]; then - echo "ERROR: Failed to identify the extracted directory in $tmpdir (got $srcdir)" >&2 - rm -rf $tmpdir - exit 1 -fi - -# Cleanup unwanted files -rm -rf $srcdir/fonts/free* - -# Repack as tar.xz -tar Jcf tcpdf_${version}.orig.tar.xz $srcdir +tgzfile=$(echo *.tgz) +version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr-//; s/\.tgz$//; s/_/./g; s/\+nmu1//; ') cd - >/dev/null -if [ -e ../tcpdf_${version}.orig.tar.xz ]; then - echo "Not overwriting ../tcpdf_${version}.orig.tar.xz"; -else - echo "Created ../tcpdf_${version}.orig.tar.xz" - mv $tmpdir/tcpdf_${version}.orig.tar.xz ../ -fi +mv $tmpdir/dolibarr-${version}.tgz ../ +echo "File ../dolibarr-${version}.tgz is ready for git-import-orig" rm -rf $tmpdir diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index ce3ad4905a7..2de6a6e159e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1070,7 +1070,7 @@ class Adherent extends CommonObject if ($rowid) $sql.= " AND d.rowid=".$rowid; elseif ($ref || $fk_soc) { $sql.= " AND d.entity IN (".getEntity().")"; - if ($ref) $sql.= " AND d.rowid='".$ref."'"; + if ($ref) $sql.= " AND d.rowid='".$this->db->escape($ref)."'"; elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'"; } elseif ($ref_ext) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 42d1ed5c9ca..ff015884bbc 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -316,7 +316,7 @@ if ($action == 'create') print ''.$langs->trans('Type').''; if ($parent_rowid) { - print 'Left'; + print $langs->trans('Left'); print ''; } else diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 9ab47249d2a..8ea6063a5e4 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -39,6 +39,7 @@ if ( $_SESSION['uid'] > 0 ) } $usertxt=GETPOST('user','',1); +$err=GETPOST("err"); /* @@ -64,7 +65,7 @@ top_htmlhead('','',0,0,'',$arrayofcss);
-
\n"; ?> +
\n"; ?>
trans("Identification"); ?>
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 7b9705c9429..aa71db608fc 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -466,6 +466,8 @@ class ActionComm extends CommonObject $sql.= ", fk_user_mod = '".$user->id."'"; $sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null"); $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); + if (! empty($this->fk_element)) $sql.= ", fk_element=".($this->fk_element?$this->fk_element:"null"); + if (! empty($this->elementtype)) $sql.= ", elementtype=".($this->elementtype?"'".$this->elementtype."'":"null"); $sql.= " WHERE id=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 694536b6d14..b000d2017d7 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -105,9 +105,14 @@ if ($object->id > 0) $author->fetch($object->author->id); $object->author=$author; - if ($object->contact->id) $object->fetch_contact($object->contact->id); + if ($object->contact->id > 0) $object->fetch_contact($object->contact->id); + if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; } $head=actions_prepare_head($object); + + $now=dol_now(); + $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; + dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action'); // Affichage fiche action en mode visu @@ -138,7 +143,7 @@ if ($object->id > 0) else print dol_print_date($object->datep,'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); print ''; - print ''."\n"; + print ''."\n"; print ''; print ''; print ''; @@ -146,7 +151,7 @@ if ($object->id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar').' '; + print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; print '
'."\n"; print '
'; print ''; @@ -155,7 +160,7 @@ if ($object->id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; print '
'."\n"; print '
'; print ''; @@ -164,9 +169,18 @@ if ($object->id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; print '
'."\n"; - print ''; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; + print '
'."\n"; + print ''; print ''; // Date end @@ -184,7 +198,11 @@ if ($object->id > 0) // Location print ''.$langs->trans("Location").''.$object->location.''; - + // Assigned to + print ''.$langs->trans("ActionAffectedTo").''; + if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1); + print ''; + print '

'; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index a12867c0800..27be46bd9e1 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -101,7 +101,7 @@ if (GETPOST('addassignedtouser')) $action='create'; } // Add action -if ($action == 'add_action') +if ($action == 'add') { $error=0; @@ -317,7 +317,7 @@ if ($action == 'update') $apmin=GETPOST('apmin'); $p2hour=GETPOST('p2hour'); $p2min=GETPOST('p2min'); - $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 if ($aphour == -1) $aphour='0'; @@ -345,6 +345,7 @@ if ($action == 'update') $object->pnote = $_POST["note"]; $object->fk_element = $_POST["fk_element"]; $object->elementtype = $_POST["elementtype"]; + if (! $datef && $percentage == 100) { $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")); @@ -512,7 +513,7 @@ if ($action == 'create') print ''; print ''; - print ''; + print ''; if ($backtopage) print ''; if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous")); @@ -547,6 +548,10 @@ if ($action == 'create') // Date end $datef=($datef?$datef:$object->datef); if (GETPOST('datef','int',1)) $datef=dol_stringtotime(GETPOST('datef','int',1),0); + if (empty($datef) && ! empty($datep) && ! empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS)) + { + $datef=dol_time_plus_duree($datep, $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS, 'h'); + } print ' - + total_ht; } ?> - +
'.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); else if (GETPOST("afaire") == 2) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); @@ -612,7 +617,7 @@ if ($action == 'create') $societe = new Societe($db); $societe->fetch(GETPOST('socid','int')); print $societe->getNomUrl(1); - print ''; + print ''; } else { diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 939d345e2db..8bcd1c7289b 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -209,7 +209,6 @@ if ($type) $param.="&type=".$type; if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' || $action != 'show_peruser') $param.='&action='.$action; $param.="&maxprint=".$maxprint; - $prev = dol_get_first_day_week($day, $month, $year); $prev_year = $prev['prev_year']; $prev_month = $prev['prev_month']; @@ -657,7 +656,7 @@ jQuery(document).ready(function() { if (ids == \'none\') /* No event */ { /* alert(\'no event\'); */ - url = "'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&affectedto="+userid+"&datep="+year+month+day+hour+min+"00" + url = "'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&affectedto="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER["PHP_SELF"].'?year='.$year.'&month='.$month.'&day='.$day).'" window.location.href = url; } else if (ids.indexOf(",") > -1) /* There is several events */ diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 3df7acec765..a9a19f57a9e 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -92,7 +92,7 @@ if ($resql) { $num = $db->num_rows($resql); - print_barre_liste($langs->trans("Actions"), $page, "index.php",'',$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); $i = 0; print ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 2cfa97549b1..bd95e5a67e4 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -351,7 +351,6 @@ else if ($action == 'add' && $user->rights->propal->creer) { } $id = $object->create($user); - if ($id > 0) { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); @@ -435,11 +434,11 @@ else if ($action == 'add' && $user->rights->propal->creer) { if ($reshook < 0) $error ++; } else { - $mesgs [] = $srcobject->error; + setEventMessages($srcobject->error, $srcobject->errors, 'errors'); $error ++; } } else { - $mesgs [] = $object->error; + setEventMessages($object->error, $object->errors, 'errors'); $error ++; } } // Standard creation @@ -448,23 +447,29 @@ else if ($action == 'add' && $user->rights->propal->creer) { $id = $object->create($user); } - if ($id > 0) { + if ($id > 0) + { // Insertion contact par defaut si defini - if (GETPOST('contactidp') > 0) { + if (GETPOST('contactidp') > 0) + { $result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external'); - if ($result < 0) { - $error ++; + if ($result < 0) + { + $error++; setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); } } - if (! $error) { + if (! $error) + { $db->commit(); - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { // Define output language $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) { + if (! empty($conf->global->MAIN_MULTILANGS)) + { $outputlangs = new Translate("", $conf); $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); @@ -475,13 +480,18 @@ else if ($action == 'add' && $user->rights->propal->creer) { header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); exit(); - } else { - $db->rollback(); } - } else { - dol_print_error($db, $object->error); + else + { + $db->rollback(); + $action='create'; + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); - exit(); + $action='create'; } } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1b7f50b8339..bb55cde5103 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -864,20 +864,20 @@ class Propal extends CommonObject { // Call trigger $result=$this->call_trigger('PROPAL_CREATE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } } else - { - $this->error=$this->db->error(); + { + $this->error=$this->db->lasterror(); $error++; } } } else - { - $this->error=$this->db->error(); + { + $this->error=$this->db->lasterror(); $error++; } @@ -895,7 +895,7 @@ class Propal extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); $this->db->rollback(); return -1; } @@ -1011,7 +1011,7 @@ class Propal extends CommonObject // Call trigger $result=$this->call_trigger('PROPAL_CLONE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -1069,7 +1069,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='".$ref."'"; + if ($ref) $sql.= " AND p.ref='".$this->db->escape($ref)."'"; else $sql.= " AND p.rowid=".$rowid; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -1331,7 +1331,7 @@ class Propal extends CommonObject { // Call trigger $result=$this->call_trigger('PROPAL_VALIDATE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -1669,7 +1669,7 @@ class Propal extends CommonObject { // Call trigger $result=$this->call_trigger('PROPAL_REOPEN',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } } @@ -1677,8 +1677,8 @@ class Propal extends CommonObject // Commit or rollback if ($error) { - if (!empty($this->errors)) - { + if (!empty($this->errors)) + { foreach($this->errors as $errmsg) { dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); @@ -1751,7 +1751,7 @@ class Propal extends CommonObject // Call trigger $result=$this->call_trigger('PROPAL_CLOSE_SIGNED',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } else @@ -1773,7 +1773,7 @@ class Propal extends CommonObject // Call trigger $result=$this->call_trigger('PROPAL_CLOSE_REFUSED',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } if ( ! $error ) @@ -2040,7 +2040,7 @@ class Propal extends CommonObject { // Call trigger $result=$this->call_trigger('PROPAL_DELETE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -2520,7 +2520,7 @@ class Propal extends CommonObject { $file = $conf->global->PROPALE_ADDON.".php"; $classname = $conf->global->PROPALE_ADDON; - + // Include file with class foreach ($conf->file->dol_document_root as $dirroot) { @@ -2926,10 +2926,10 @@ class PropaleLigne extends CommonObject // Call trigger $result=$this->call_trigger('LINEPROPAL_INSERT',$user); if ($result < 0) - { + { $this->db->rollback(); - return -1; - } + return -1; + } // End call triggers } @@ -2976,10 +2976,10 @@ class PropaleLigne extends CommonObject // Call trigger $result=$this->call_trigger('LINEPROPAL_DELETE',$user); if ($result < 0) - { + { $this->db->rollback(); return -1; - } + } // End call triggers $this->db->commit(); @@ -3085,11 +3085,11 @@ class PropaleLigne extends CommonObject { // Call trigger $result=$this->call_trigger('LINEPROPAL_UPDATE',$user); - if ($result < 0) - { + if ($result < 0) + { $this->db->rollback(); return -1; - } + } // End call triggers } diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 632dee63965..cb920afd5fc 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -1,6 +1,7 @@ - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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,6 +28,8 @@ id ?>">trans("ShowPropal"),"propal").' '.$object->ref; ?> - + total_ht; } ?> - +
ref_client; ?> date,'day'); ?>total_ht); ?>rights->propale->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?>
trans('TotalHT'); ?>rights->propale->lire) { + echo price($total); + } ?>  
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 2fda0277bec..d73a4c068e1 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1559,7 +1559,7 @@ if ($action == 'create' && $user->rights->commande->creer) { } // Other attributes - $parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); + $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by // hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index de559e2b53f..bae932857fe 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -34,7 +34,7 @@ $langs->load("sendings"); // Security check $socid=0; -$comid = isset($_GET["id"])?$_GET["id"]:''; +$comid = GETPOST("id",'int'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'commande',$comid,''); @@ -47,8 +47,8 @@ $result=restrictedArea($user,'commande',$comid,''); llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); $commande = new Commande($db); -$commande->fetch($_GET["id"]); -$commande->info($_GET["id"]); +$commande->fetch($comid); +$commande->info($comid); $soc = new Societe($db); $soc->fetch($commande->socid); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 814e52884ab..f6cb4a27863 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -45,7 +45,7 @@ $langs->load('companies'); if (! $user->rights->facture->creer) accessforbidden(); -$id = (GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility +$id = (GETPOST('id')?GETPOST('id','int'):GETPOST("facid")); // For backward compatibility $ref = GETPOST('ref','alpha'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index c7d073501a3..d2fe19c5b6f 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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 @@ -22,6 +23,8 @@ >
trans("ShowOrder"),"order").' '.$object->ref; ?> date,'day'); ?>total_ht); ?>rights->commande->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?>
trans('TotalHT'); ?>rights->commande->lire) { + echo price($total); + } ?>  
diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 69962498312..0adf68ca741 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2014 Marcos García * Copyright (C) 2011-2014 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -268,17 +268,22 @@ if ($id > 0 || ! empty($ref)) //Total pages $totalPages = ceil($total_lines/$viewline); - if ($page > 0) - { - $limitsql = ($totalPages - $page) * $viewline; - if ($limitsql < $viewline) $limitsql = $viewline; - $nbline = $limitsql; - } - else - { + if ($totalPages == 0) { $page = 0; - $limitsql = $nbline; + } else { + + if ($page > 0) { + $limitsql = ($totalPages - $page) * $viewline; + if ($limitsql < $viewline) { + $limitsql = $viewline; + } + $nbline = $limitsql; + } else { + $page = 0; + $limitsql = $nbline; + } } + //print $limitsql.'-'.$page.'-'.$viewline; // Onglets @@ -474,7 +479,7 @@ if ($id > 0 || ! empty($ref)) // VAT $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."tva as t ON bu2.url_id = t.rowid"; - + // Salary payment $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_salary'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as sal ON bu3.url_id = sal.rowid"; diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index 9c10a311366..b92aa1eb34a 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -34,7 +34,7 @@ $langs->load("categories"); $langs->load("bills"); $action=GETPOST('action'); -$id=GETPOST('id'); +$id=GETPOST('id','int'); $ref=GETPOST('ref'); // Security check diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2e9db8bc077..7bd05f9f806 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -605,7 +605,7 @@ else if ($action == 'add' && $user->rights->facture->creer) $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) $error ++; - // Replacement invoice + // Replacement invoice if ($_POST['type'] == Facture::TYPE_REPLACEMENT) { $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -716,10 +716,11 @@ else if ($action == 'add' && $user->rights->facture->creer) } - if(GETPOST('invoiceAvoirWithPaymentRestAmount', 'int')==1 && $id>0) { - + if(GETPOST('invoiceAvoirWithPaymentRestAmount', 'int')==1 && $id>0) + { $facture_source = new Facture($db); // fetch origin object if not previously defined - if($facture_source->fetch($object->fk_facture_source)>0) { + if ($facture_source->fetch($object->fk_facture_source)>0) + { $totalpaye = $facture_source->getSommePaiement(); $totalcreditnotes = $facture_source->getSumCreditNotesUsed(); $totaldeposits = $facture_source->getSumDepositsUsed(); @@ -1061,9 +1062,9 @@ else if ($action == 'add' && $user->rights->facture->creer) { $db->rollback(); $action = 'create'; - $_GET ["origin"] = $_POST["origin"]; - $_GET ["originid"] = $_POST["originid"]; - setEventMessage($object->error, 'errors'); + $_GET["origin"] = $_POST["origin"]; + $_GET["originid"] = $_POST["originid"]; + setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index f0fca0b90ff..ae3038a6021 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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 @@ -22,6 +23,8 @@ > trans("ShowBill"),"bill").' '.$object->ref; ?> date,'day'); ?> - total_ht); ?> + rights->facture->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?> total_ht; } ?> trans("TotalHT"); ?> - + rights->facture->lire) { + echo price($total); + } ?>   diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index e8095954a37..25065b24590 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -914,7 +914,7 @@ class BonPrelevement extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; $sql.= " ref, entity, datec"; $sql.= ") VALUES ("; - $sql.= "'".$ref."'"; + $sql.= "'".$this->db->escape($ref)."'"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->idate($now)."'"; $sql.= ")"; diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php index 9521ba7e3d2..a9fb6024992 100644 --- a/htdocs/compta/prelevement/liste.php +++ b/htdocs/compta/prelevement/liste.php @@ -78,19 +78,19 @@ $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND s.rowid = ".$socid; if ($search_line) { - $sql.= " AND pl.rowid = '".$search_line."'"; + $sql.= " AND pl.rowid = '".$db->escape($search_line)."'"; } if ($search_bon) { - $sql.= " AND p.ref LIKE '%".$search_bon."%'"; + $sql.= " AND p.ref LIKE '%".$db->escape($search_bon)."%'"; } if ($search_code) { - $sql.= " AND s.code_client LIKE '%".$search_code."%'"; + $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'"; } if ($search_societe) { - $sql .= " AND s.nom LIKE '%".$search_societe."%'"; + $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'"; } $sql.=$db->order($sortfield,$sortorder); $sql.=$db->plimit($conf->liste_limit+1, $offset); @@ -104,7 +104,7 @@ if ($result) $urladd = "&statut=".$statut; $urladd .= "&search_bon=".$search_bon; - print_barre_liste($langs->trans("WithdrawalsLines"), $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); print"\n\n"; print ''; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index e8e27d957ea..30b36a59775 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -76,7 +76,8 @@ $sql.= " AND pl.fk_prelevement_bons = p.rowid"; $sql.= " AND pl.fk_soc = s.rowid"; $sql.= " AND p.entity = ".$conf->entity; if ($socid) $sql.= " AND s.rowid = ".$socid; -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); +$sql.= " ".$db->order($sortfield, $sortorder); +$sql.= " ".$db->plimit($conf->liste_limit+1, $offset); $result = $db->query($sql); if ($result) diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 62cb7a631cb..42f91e3132b 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -30,7 +30,7 @@ $langs->load("companies"); if (! empty($conf->facture->enabled)) $langs->load("bills"); // Security check -$socid = $_GET["socid"]; +$socid = GETPOST("socid",'int'); if ($user->societe_id > 0) { $action = ''; diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php index 53777ce3e40..51a80d8d994 100644 --- a/htdocs/contact/info.php +++ b/htdocs/contact/info.php @@ -31,22 +31,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; $langs->load("companies"); // Security check -$contactid = isset($_GET["id"])?$_GET["id"]:''; +$contactid = GETPOST("id",'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe'); /* -* View -*/ + * View + */ llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); $contact = new Contact($db); -$contact->fetch($_GET["id"], $user); -$contact->info($_GET["id"]); +$contact->fetch($contactid, $user); +$contact->info($contactid); $head = contact_prepare_head($contact); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index d42db357ffe..b4cf7c20322 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -406,7 +406,7 @@ class Contrat extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; if ($ref) { - $sql.= " WHERE ref='".$ref."'"; + $sql.= " WHERE ref='".$this->db->escape($ref)."'"; $sql.= " AND entity IN (".getEntity('contract').")"; } else $sql.= " WHERE rowid=".$id; @@ -2077,7 +2077,7 @@ class ContratLigne extends CommonObject $sql.= " t.commentaire"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t"; if ($id) $sql.= " WHERE t.rowid = ".$id; - if ($ref) $sql.= " WHERE t.rowid = '".$ref."'"; + if ($ref) $sql.= " WHERE t.rowid = '".$this->db->escape($ref)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 234f986a00c..53af58a2415 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $langs->load("contracts"); // Security check -$contratid = isset($_GET["id"])?$_GET["id"]:''; +$contratid = GETPOST("id",'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contrat',$contratid,''); @@ -41,8 +41,8 @@ $result = restrictedArea($user, 'contrat',$contratid,''); llxHeader(); $contrat = new Contrat($db); -$contrat->fetch($_GET["id"]); -$contrat->info($_GET["id"]); +$contrat->fetch($contratid); +$contrat->info($contratid); $head = contract_prepare_head($contrat); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9d15e3d57c8..1059d1af07d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1141,7 +1141,6 @@ abstract class CommonObject } } - /** * Save a new position (field rang) for details lines. * You can choose to set position for lines with already a position or lines without any position defined. @@ -2085,7 +2084,7 @@ abstract class CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE entity IN (".getEntity($this->element, 1).")"; if (! empty($id)) $sql.= " AND rowid = ".$id; - if (! empty($ref)) $sql.= " AND ref = '".$ref."'"; + if (! empty($ref)) $sql.= " AND ref = '".$this->db->escape($ref)."'"; $resql = $this->db->query($sql); if ($resql) @@ -3460,6 +3459,7 @@ abstract class CommonObject include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf); + if ($result < 0) { if (!empty($this->errors)) @@ -3471,6 +3471,7 @@ abstract class CommonObject $this->errors=$interface->errors; } } + return $result; } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index ed32fcc9f0d..696a70867cf 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -187,6 +187,7 @@ class FormActions print ''; print ''; print ''; + print ''; print ''; print "\n"; @@ -204,7 +205,15 @@ class FormActions print ''; print ''; print ''; - print ''; + print ''; print ''; + print ''; print ''; } print '
'.$langs->trans('Action').''.$langs->trans('Date').''.$langs->trans('By').''.$langs->trans('Status').'
'.$ref.''.$label.''.dol_print_date($action->datep,'day').''.dol_print_date($action->datep,'dayhour'); + if ($action->datef) + { + $tmpa=dol_getdate($action->datep); + $tmpb=dol_getdate($action->datef); + if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) print '-'.dol_print_date($action->datef,'hour'); + else print '-'.dol_print_date($action->datef,'dayhour'); + } + print ''; if (! empty($action->author->id)) { @@ -214,6 +223,12 @@ class FormActions print $userstatic->getNomUrl(1); } print ''; + if (! empty($action->author->id)) + { + print $action->getLibStatut(3); + } + print '
'; @@ -226,7 +241,7 @@ class FormActions /** * Output list of type of event * - * @param string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx' + * @param string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx') * @param string $htmlname Nom champ formulaire * @param string $excludetype Type to exclude * @param string $onlyautoornot Group list by auto events or not: We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) @@ -235,7 +250,7 @@ class FormActions */ function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0) { - global $langs,$user,$form; + global $langs,$user,$form,$conf; if (! is_object($form)) $form=new Form($db); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 27be0636fdf..f158a86f5da 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -520,7 +520,7 @@ class FormCompany * @param string $htmlname Name of HTML form * @param array $limitto Disable answers that are not id in this array list * @param int $forceid This is to force another object id than object->id - * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param array $events More js events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param string $moreparam String with more param to add into url when noajax search is used. * @return int The selected third party ID */ @@ -573,13 +573,13 @@ class FormCompany var obj = '.json_encode($events).'; $.each(obj, function(key,values) { if (values.method.length) { - getMethod'.$htmlname.'(values); + runJsCodeForEvent'.$htmlname.'(values); } }); }); // Function used to execute events when search_htmlname change - function getMethod'.$htmlname.'(obj) { + function runJsCodeForEvent'.$htmlname.'(obj) { var id = $("#'.$htmlname.'").val(); var method = obj.method; var url = obj.url; @@ -612,8 +612,8 @@ class FormCompany } print "\n".''."\n"; - print ''; - print ''; + //print ''; + //print '
'; + //print ''; + //print ''; - print ''; - print '
'; if ($obj->rowid == 0) { print ''; @@ -623,10 +623,10 @@ class FormCompany print ''; } print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength); - print '
'; - print "\n"; + //print '
'; + //print "\n"; return $socid; } else diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php new file mode 100644 index 00000000000..2caeb30a6dc --- /dev/null +++ b/htdocs/core/class/html.formintervention.class.php @@ -0,0 +1,139 @@ + + * + * 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/core/class/html.formintervention.class.php + * \ingroup core + * \brief File of class with all html predefined components + */ + +/** + * Class to manage generation of HTML components for contract module + */ +class FormIntervention +{ + var $db; + var $error; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } + + + /** + * Show a combo list with contracts qualified for a third party + * + * @param int $socid Id third party (-1=all, 0=only interventions not linked to a third party, id=intervention not linked or linked to third party id) + * @param int $selected Id intervention preselected + * @param string $htmlname Nom de la zone html + * @param int $maxlength Maximum length of label + * @param int $showempty Show empty line + * @return int Nbre of project if OK, <0 if KO + */ + function select_interventions($socid=-1, $selected='', $htmlname='interventionid', $maxlength=16, $showempty=1) + { + global $db,$user,$conf,$langs; + + $out=''; + + $hideunselectables=false; + + // Search all contacts + $sql = 'SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut'; + $sql.= ' FROM '.MAIN_DB_PREFIX .'fichinter as f'; + $sql.= " WHERE f.entity = ".$conf->entity; + if ($socid != '') + { + if ($socid == '0') $sql.= " AND (f.fk_soc = 0 OR f.fk_soc IS NULL)"; + else $sql.= " AND f.fk_soc = ".$socid; + } + + dol_syslog(get_class($this)."::select_intervention", LOG_DEBUG); + $resql=$db->query($sql); + if ($resql) + { + $out.=' '. $langs->trans("ProjectReportDate"); diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 12d7dca69eb..1b915ceca19 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -43,9 +43,9 @@ $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; if (!$user->rights->projet->lire) accessforbidden(); -$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; -$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; -$page = isset($_GET["page"])? $_GET["page"]:$_POST["page"]; +$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder"); +$page = GETPOST("page"); $page = is_numeric($page) ? $page : 0; $page = $page == -1 ? 0 : $page; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 71e2f73ce29..0aa9f0e5979 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -130,16 +130,10 @@ if ($object->client) $obj = $db->fetch_object($resql); $nbFactsClient = $obj->nb; $thirdTypeArray['customer']=$langs->trans("customer"); -<<<<<<< HEAD if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); if ($conf->ficheinter>enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); -======= - if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->trans('Orders'); - if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->trans('Proposals'); - if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->trans('Invoices'); ->>>>>>> branch 'develop' of git@github.com:Dolibarr/dolibarr.git } if ($object->fournisseur) @@ -185,9 +179,10 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $documentstatic=new Fichinter($db); - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, '; - $tables_from = MAIN_DB_PREFIX."fichinter as f,".MAIN_DB_PREFIX."fichinterdet as d"; - $where = " WHERE d.fk_fichinter = f.rowid AND f.entity = ".$conf->entity; + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, '; + $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. + $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; + $where.= " AND f.entity = ".$conf->entity; $dateprint = 'f.datec'; $doc_number='f.ref'; } @@ -195,7 +190,7 @@ if ($type_element == 'invoice') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $documentstatic=new Facture($db); - $sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as dateprint, '; + $sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, '; $tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture = f.rowid"; @@ -208,7 +203,7 @@ if ($type_element == 'propal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $documentstatic=new Propal($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as datePrint, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as datePrint, c.fk_statut as status, '; $tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_propal = c.rowid"; @@ -221,7 +216,7 @@ if ($type_element == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $documentstatic=new Commande($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, '; $tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; @@ -234,7 +229,7 @@ if ($type_element == 'supplier_invoice') { // Supplier : Show products from invoices. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $documentstatic=new FactureFournisseur($db); - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, '; + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, '; $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture_fourn = f.rowid"; @@ -246,7 +241,7 @@ if ($type_element == 'supplier_order') { // Supplier : Show products from orders. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $documentstatic=new CommandeFournisseur($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; @@ -281,7 +276,7 @@ if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; if ($sprod_fulldescr) $sql.= " AND (d.description LIKE '%".$sprod_fulldescr."%' OR p.label LIKE '%".$sprod_fulldescr."%')"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); - +//print $sql; // Define type of elements $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), 2); @@ -301,6 +296,7 @@ print ''."\n"; print ''; print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); // Filters @@ -312,6 +308,8 @@ print ''; +print ''; print ''; @@ -328,16 +326,26 @@ if ($sql_select) $i = 0; while (($objp = $db->fetch_object($resql)) && $i < $conf->liste_limit ) { - $var=!$var; - print ""; - print '"; + print ''; print ''; + // Status + print ''; + print '
'; // date print $formother->select_month($month?$month:-1,'month',1); $formother->select_year($year?$year:-1,'year',1, 20, 1); print ''; +print ''; print ''; print '
'; $documentstatic->id=$objp->doc_id; $documentstatic->ref=$objp->doc_number; $documentstatic->type=$objp->type; + $documentstatic->fk_statut=$objp->status; + $documentstatic->fk_status=$objp->status; + $documentstatic->statut=$objp->status; + $documentstatic->status=$objp->status; + + $var=!$var; + print "
'; print $documentstatic->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dateprint),'day').''; + print $documentstatic->getLibStatut(2); + print ''; // Define text, description and type @@ -434,15 +442,17 @@ if ($sql_select) } else { - //if (! empty($objp->fk_parent_line)) echo img_picto('', 'rightarrow'); - if ($type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); + if (! empty($objp->label) || ! empty($objp->description)) + { + if ($type==1) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); - if (! empty($objp->label)) { - $text.= ' '.$objp->label.''; - echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); - } else { - echo $text.' '.dol_htmlentitiesbr($objp->description); + if (! empty($objp->label)) { + $text.= ' '.$objp->label.''; + echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); + } else { + echo $text.' '.dol_htmlentitiesbr($objp->description); + } } // Show range diff --git a/htdocs/societe/localtaxes.php b/htdocs/societe/localtaxes.php deleted file mode 100644 index 95c02122d25..00000000000 --- a/htdocs/societe/localtaxes.php +++ /dev/null @@ -1,267 +0,0 @@ - - * - * 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 . - */ - -/** - * \file htdocs/societe/localtaxes.php - * \ingroup societe - * \brief Page of third party localtaxes rates - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - -$langs->load("companies"); - -// Security check -$socid = GETPOST('socid','int'); -$vatid = GETPOST('vatid','int'); -$action = GETPOST('action','alpha'); - -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'societe', $socid, '&societe'); - -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('localtaxesthirdparty')); - - -/* - * Actions - */ - -$parameters=array('id'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); - - -/* - * View - */ - -$contactstatic = new Contact($db); -$form = new Form($db); - -if ($socid) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - - $langs->load("companies"); - - - $soc = new Societe($db); - $result = $soc->fetch($socid); - llxHeader("",$langs->trans("LocalTaxes"),''); - - if (! empty($conf->notification->enabled)) $langs->load("mails"); - $head = societe_prepare_head($soc); - - dol_fiche_head($head, 'localtaxes', $langs->trans("ThirdParty"),0,'company'); - - print ''; - - print ''; - - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field - { - print ''; - } - - if ($soc->client) - { - print ''; - } - - if ($soc->fournisseur) - { - print ''; - } - - if (! empty($conf->barcode->enabled)) - { - print ''; - } - - print ""; - - // Zip / Town - print '"; - print '"; - - // Country - if ($soc->country) { - print ''; - } - - // EMail - print ''; - - // Web - print ''; - - // Phone / Fax - print ''; - print ''; - - - if ($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; - } - elseif($mysoc->localtax2_assuj=="1") - { - print ''; - } - - print '
'.$langs->trans("ThirdPartyName").''; - print $form->showrefnav($soc,'socid','',0,'rowid','nom'); - print '
'.$langs->trans('Prefix').''.$soc->prefix_comm.'
'; - print $langs->trans('CustomerCode').''; - print $soc->code_client; - if ($soc->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print '
'; - print $langs->trans('SupplierCode').''; - print $soc->code_fournisseur; - if ($soc->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print '
'.$langs->trans('Gencod').''.$soc->barcode.'
".$langs->trans('Address').""; - dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id); - print "
'.$langs->trans('Zip').''.$soc->zip."'.$langs->trans('Town').''.$soc->town."
'.$langs->trans('Country').''; - $img=picto_from_langcode($soc->country_code); - print ($img?$img.' ':''); - print $soc->country; - print '
'.$langs->trans('EMail').''; - print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL'); - print '
'.$langs->trans('Web').''; - print dol_print_url($soc->url); - print '
'.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'
'.$langs->transcountry('LocalTax1IsUsed',$mysoc->country_code).''; - print yn($soc->localtax1_assuj); - print '
'.$langs->transcountry('LocalTax2IsUsed',$mysoc->country_code).''; - print yn($soc->localtax2_assuj); - print '
'.$langs->transcountry('LocalTax1IsUsed',$mysoc->country_code).''; - print yn($soc->localtax1_assuj); - print '
'.$langs->transcountry('LocalTax2IsUsed',$mysoc->country_code).''; - print yn($soc->localtax2_assuj); - print '
'; - - dol_fiche_end(); - - - print ''; - print ''; - print ''; - print ''; - - // Localtaxes - - print ''; - - print ''; - - // Description - print ''; - - // VAT - print ''; - - // Localtax 1 - if ($mysoc->localtax1_assuj=="1" && $soc->localtax1_assuj) - print ''; - - if ($mysoc->localtax2_assuj=="1" && $soc->localtax2_assuj) - print ''; - - //print ''; - if ($user->rights->societe->creer) - print ''; // No width to allow autodim - - print "\n"; - - - $sql = "SELECT DISTINCT t.rowid, t.note, t.taux, t.localtax1, t.localtax2, t.recuperableonly"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; - $sql.= " WHERE t.fk_pays = c.rowid"; - $sql.= " AND t.active = 1"; - $sql.= " AND c.code IN ('".$mysoc->country_code."')"; - $sql.= " ORDER BY t.taux ASC, t.recuperableonly ASC"; - - $resql=$db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num) - { - $var=True; - for ($i = 0; $i < $num; $i++) - { - $var=!$var; - - - $obj = $db->fetch_object($resql); - - if ($action == 'edit' && $obj->rowid==$vatid && $user->rights->societe->creer) - { - print ''; - - print ''; - print ''; - - if ($mysoc->localtax1_assuj=="1" && $soc->localtax1_assuj) - print ''; - if ($mysoc->localtax2_assuj=="1" && $soc->localtax2_assuj) - print ''; - - print ''; - print ''; - } - else - { - print ''; - - print ''; - print ''; - if ($mysoc->localtax1_assuj=="1" && $soc->localtax1_assuj) - print ''; - if ($mysoc->localtax2_assuj=="1" && $soc->localtax2_assuj) - print ''; - print ''; - print "\n"; - } - } - } - } - - print '
'.$langs->trans('Description').''.$langs->trans('VAT').' (%)'.$langs->transcountry('LocalTax1',$mysoc->country_code).' (%)'.$langs->transcountry('LocalTax2',$mysoc->country_code).' (%)
'.$obj->note.''.$obj->taux.''; - print '
'.$obj->note.''.$obj->taux.''.$obj->localtax1.''.$obj->localtax2.''; - if ($user->rights->societe->creer) - { - // TODO Comment this because the action to save is not supported - //print 'id.'&vatid='.$obj->rowid.'">'.img_edit().''; - } - print '
'; - - print ''; -} - - -llxFooter(); - -$db->close(); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 2f933a7861c..8317a628c6a 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -181,14 +181,7 @@ if (empty($reshook)) $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); - if (GETPOST("private") == 1) - { - $object->typent_id = dol_getIdFromCode($db,'TE_PRIVATE','c_typent'); - } - else - { - $object->typent_id = GETPOST('typent_id', 'int'); - } + $object->typent_id = GETPOST('typent_id'); $object->client = GETPOST('client', 'int'); $object->fournisseur = GETPOST('fournisseur', 'int'); @@ -1112,7 +1105,7 @@ else dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); - + // Load object modCodeTiers $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') @@ -1148,9 +1141,9 @@ else { $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed(); } - + $object->oldcopy=dol_clone($object); - + if (GETPOST('nom')) { // We overwrite with values if posted @@ -1182,7 +1175,7 @@ else $object->barcode = GETPOST('barcode', 'san_alpha'); $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); $object->default_lang = GETPOST('default_lang', 'san_alpha'); - + $object->tva_assuj = GETPOST('assujtva_value', 'int'); $object->tva_intra = GETPOST('tva_intra', 'san_alpha'); $object->status = GETPOST('status', 'int'); @@ -1269,7 +1262,7 @@ else print ''; print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; - + print ''; // Name diff --git a/htdocs/theme/amarok/img/object_address.png b/htdocs/theme/amarok/img/object_address.png new file mode 100644 index 00000000000..b20734da69a Binary files /dev/null and b/htdocs/theme/amarok/img/object_address.png differ diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index d5c5d71e328..ffe6336bc41 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -942,7 +942,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print "\n"; - if ($conf->salaries->enabled) + if ($conf->salaries->enabled && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); @@ -1268,7 +1268,7 @@ else print ''; print "\n"; - if ($conf->salaries->enabled) + if ($conf->salaries->enabled && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); @@ -1957,11 +1957,11 @@ else print ''; print "\n"; - $langs->load("salaries"); - - if ($conf->salaries->enabled) + if ($conf->salaries->enabled && ! empty($user->rights->salaries->read)) { - // THM + $langs->load("salaries"); + + // THM print ''; print '
'.$langs->trans("THM").''; print '';