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/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/comm/action/card.php b/htdocs/comm/action/card.php index 8a80408fe49..fcb3444be10 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -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")); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 9d25daa8091..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) { 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/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 '