Merge remote-tracking branch 'upstream/develop' into camelCaps

This commit is contained in:
Frédéric FRANCE 2018-08-14 09:02:12 +02:00
commit d30874750f
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
60 changed files with 74 additions and 68 deletions

View File

@ -34,7 +34,7 @@
/**
* Parent class to manage intervention document templates
* Parent class to manage holidays document templates
*/
abstract class ModelePDFHoliday extends CommonDocGenerator
{
@ -44,16 +44,16 @@ abstract class ModelePDFHoliday extends CommonDocGenerator
/**
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
static function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db, $maxfilenamelength=0)
{
global $conf;
$type = 'contract';
$type = 'holiday';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -65,7 +65,7 @@ abstract class ModelePDFHoliday extends CommonDocGenerator
/**
* Parent class for all contract numbering modules
* Parent class for all holidays numbering modules
*/
class ModelNumRefHolidays
{

View File

@ -192,13 +192,13 @@ class Shipments extends DolibarrApi
foreach($request_data as $field => $value) {
$this->shipment->$field = $value;
}
/*if (isset($request_data["lines"])) {
if (isset($request_data["lines"])) {
$lines = array();
foreach ($request_data["lines"] as $line) {
array_push($lines, (object) $line);
}
$this->shipment->lines = $lines;
}*/
}
if ($this->shipment->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating shipment", array_merge(array($this->shipment->error), $this->shipment->errors));

View File

@ -882,6 +882,6 @@ else
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -193,7 +193,7 @@ class PaiementFourn extends Paiement
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
$sql.= 'ref, entity, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
$sql.= " VALUES ('".$this->db->escape($ref)."', ".$conf->entity.", '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
$sql.= " '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
$resql = $this->db->query($sql);
if ($resql)

View File

@ -2782,5 +2782,4 @@ elseif (! empty($object->id))
// End of page
llxFooter();
$db->close();

View File

@ -203,6 +203,6 @@ if ($id > 0 || ! empty($ref))
}
}
// End of page
llxFooter();
$db->close();

View File

@ -873,6 +873,6 @@ if ($id > 0 || ! empty($ref)) {
}
}
// End of page
llxFooter();
$db->close();

View File

@ -189,6 +189,6 @@ else
exit;
}
// End of page
llxFooter();
$db->close();

View File

@ -432,6 +432,6 @@ print "</table><br>";
print '</div></div></div>';
// End of page
llxFooter();
$db->close();

View File

@ -221,7 +221,6 @@ if (!empty($object->id))
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters);
}
// End of page
llxFooter();
$db->close();

View File

@ -1197,6 +1197,6 @@ else
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -155,7 +155,6 @@ if ($id > 0 || ! empty($ref))
}
}
// End of page
llxFooter();
$db->close();

View File

@ -617,5 +617,6 @@ if (($action != 'create' && $action != 'add') && !$error) {
dol_htmloutput_mesg($mesg, $mesgs);
// End of page
llxFooter();
$db->close();

View File

@ -130,7 +130,6 @@ else
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -3202,7 +3202,6 @@ else
}
}
// End of page
llxFooter();
$db->close();

View File

@ -276,6 +276,6 @@ if ($id > 0 || ! empty($ref))
}
}
// End of page
llxFooter();
$db->close();

View File

@ -260,6 +260,6 @@ else
print $langs->trans('ErrorUnknown');
}
// End of page
llxFooter();
$db->close();

View File

@ -126,6 +126,6 @@ print '</td></tr></table>';
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -1167,7 +1167,6 @@ else
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -214,7 +214,6 @@ if ($object->id > 0)
dol_fiche_end();
}
// End of page
llxFooter();
$db->close();

View File

@ -941,5 +941,6 @@ if (empty($action))
}
}
// End of page
llxFooter();
$db->close();

View File

@ -165,6 +165,6 @@ if ($year)
}
}
// End of page
llxFooter();
$db->close();

View File

@ -313,6 +313,6 @@ if (count($companystatic->SupplierCategories))
//print "</td></tr></table>\n";
print '</div></div></div>';
// End of page
llxFooter();
$db->close();

View File

@ -407,6 +407,6 @@ else
dol_fiche_end();
// End of page
llxFooter();
$db->close();

View File

@ -57,6 +57,6 @@ print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
// End of page
llxFooter();
$db->close();

View File

@ -308,5 +308,6 @@ else
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -191,5 +191,6 @@ else
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -309,6 +309,6 @@ else
}
}
// End of page
llxFooter();
$db->close();

View File

@ -685,9 +685,8 @@ if ($conn_id)
}
}
// End of page
llxFooter();
$db->close();

View File

@ -374,6 +374,6 @@ else
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -295,7 +295,6 @@ else
print $langs->trans("ErrorUnknown");
}
// End of page
llxFooter();
$db->close();

View File

@ -630,8 +630,8 @@ print '</form>';
print '</div>';
}*/
// End of page
llxFooter();
$db->close();

View File

@ -194,6 +194,6 @@ else
print '</table>';
print '</div>';
// Fin de page
$db->close();
// End of page
llxFooter();
$db->close();

View File

@ -138,6 +138,6 @@ print '</tbody>'."\n";
print '</table>'."\n";
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -145,5 +145,6 @@ print '<div class="tabsAction">';
print '<a class="butAction" href="../establishment/card.php?action=create">'.$langs->trans("NewEstablishment").'</a>';
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -108,5 +108,6 @@ print '<div class="center"><input type="submit" class="button" value="' . $langs
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -408,5 +408,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div>';
}
// End of page
llxFooter();
$db->close();

View File

@ -53,5 +53,6 @@ if ($id)
print '</div>';
}
// End of page
llxFooter();
$db->close();

View File

@ -397,8 +397,6 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
print '</div></div></div>';
// End of page
llxFooter();
$db->close();

View File

@ -1915,9 +1915,8 @@ if ($step == 6 && $datatoimport)
print '<br>';
// End of page
llxFooter();
$db->close();

View File

@ -134,7 +134,6 @@ print '</table>';
//print '</div></div></div>';
// End of page
llxFooter();
$db->close();

View File

@ -781,6 +781,6 @@ else
}
}
// End of page
llxFooter();
$db->close();

View File

@ -805,6 +805,6 @@ if ($id > 0)
}
}
// End of page
llxFooter();
$db->close();

View File

@ -210,6 +210,7 @@ print '</br>';
print '<div align="center"><input class="button" type="submit" value="'.$langs->trans("Save").'"></div>';
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -163,7 +163,6 @@ else
print $langs->trans("ErrorUnknown");
}
// End of page
llxFooter();
$db->close();

View File

@ -202,6 +202,6 @@ else
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -113,5 +113,6 @@ print '</td></tr></table>';
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -129,6 +129,7 @@ if ($id > 0)
dol_fiche_end();
}
// End of page
llxFooter();
$db->close();

View File

@ -292,8 +292,6 @@ if (empty($action) && ! empty($user->rights->loan->delete))
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -278,5 +278,6 @@ dol_fiche_end();
print '<br>';
// End of page
llxFooter();
$db->close();

View File

@ -268,6 +268,7 @@ $(document).ready(function() {
});
</script>'."\n";
// End of page
llxFooter();
$db->close();

View File

@ -321,5 +321,6 @@ print '</form>';
$db->free($result);
// End of page
llxFooter();
$db->close();

View File

@ -383,5 +383,6 @@ $(document).ready(function() {
</script>
';
// End of page
llxFooter();
$db->close();

View File

@ -367,5 +367,6 @@ $(document).ready(function() {
</script>
';
// End of page
llxFooter();
$db->close();

View File

@ -273,5 +273,6 @@ print '
</script>
';
// End of page
llxFooter();
$db->close();

View File

@ -282,5 +282,6 @@ print '
</script>
';
// End of page
llxFooter();
$db->close();

View File

@ -441,14 +441,15 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
$service = 'StripeLive';
$servicestatus = 1;
}
$stripeacc = null; // No Oauth/connect use for public pages
$thirdparty = new Societe($db);
$thirdparty->fetch($thirdparty_id);
// Create Stripe customer
include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
$stripe = new Stripe($db);
$stripe = new Stripe($db);
$stripeacc = $stripe->getStripeAccount($service);
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
// Create Stripe card from Token
@ -473,7 +474,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
'customer' => $customer->id,
'source' => $card,
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
));
),array("idempotency_key" => "$ref","stripe_account" => "$stripeacc"));
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge))
{
@ -507,7 +508,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
'description' => 'Stripe payment: '.$FULLTAG,
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])),
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
));
),array("idempotency_key" => "$ref","stripe_account" => "$stripeacc"));
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge))
{

View File

@ -493,9 +493,10 @@ class Website extends CommonObject
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @param string $newref New ref
* @param string $newlang New language
* @return mixed New object created, <0 if KO
*/
public function createFromClone($user, $fromid, $newref)
public function createFromClone($user, $fromid, $newref, $newlang='')
{
global $hookmanager, $langs;
global $dolibarr_main_data_root;
@ -572,7 +573,7 @@ class Website extends CommonObject
dol_delete_file($filetplold);
// Create new file
$objectpagenew = $objectpageold->createFromClone($user, $pageid, $objectpageold->pageurl, '', 0, $object->id);
$objectpagenew = $objectpageold->createFromClone($user, $pageid, $objectpageold->pageurl, '', 0, $object->id, 1);
//print $pageid.' = '.$objectpageold->pageurl.' -> '.$objectpagenew->id.' = '.$objectpagenew->pageurl.'<br>';
if (is_object($objectpagenew) && $objectpagenew->pageurl)
{

View File

@ -362,10 +362,11 @@ class WebsitePage extends CommonObject
* @param string $newref New ref/alias of page
* @param string $newlang New language
* @param int $istranslation 1=New page is a translation of the cloned page.
* @param int $newwebsite 0=Same web site, 1=New web site
* @param int $newwebsite 0=Same web site, >0=Id of new website
* @param int $keeptitleunchanged 1=Keep title unchanged
* @return mixed New object created, <0 if KO
*/
public function createFromClone(User $user, $fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0)
public function createFromClone(User $user, $fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0, $keeptitleunchanged=0)
{
global $hookmanager, $langs;
$error = 0;
@ -385,7 +386,7 @@ class WebsitePage extends CommonObject
$object->ref = $newref;
$object->pageurl = $newref;
$object->aliasalt = '';
$object->title = $langs->trans("CopyOf").' '.$object->title;
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
if (! empty($newlang)) $object->lang=$newlang;
if ($istranslation) $object->fk_page = $fromid;
else $object->fk_page = 0;

View File

@ -1115,6 +1115,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
$object = $objectnew;
$id = $object->id;
$pageid = $object->fk_default_home;
$websitekey = GETPOST('siteref','aZ09');
}
}