我正在使用这个包装
我可以成功地为员工添加空白时间表,但当我尝试添加时间表行时,我会收到错误的请求响应。
有人能告诉我正确的方向吗???
我的PHP代码是:
$numberOfUnits = array ("1", "2", "3", "4", "5", "6", "7");
$timesheetLines = new XeroPHPModelsPayrollAUTimesheetTimesheetLine($xero);
$timesheetLines ->setEarningsRateID ($earningsRateID)
->setTrackingItemID (NULL)
->addNumberOfUnit ($numberOfUnits);
$timesheet = new XeroPHPModelsPayrollAUTimesheet($xero);
$timesheet ->setTimesheetID($timesheetID)
->setEmployeeID ($employeeID)
->setStartDate(new DateTime('2018-10-01'))
->setEndDate(new DateTime('2018-10-14'))
->setStatus("DRAFT")
->addTimesheetLine($timesheetLines);
$timesheet->save();
您的开始日期和结束日期显示您正在尝试每两周添加一次数据,即两周。但是,您的numberOfUnits
数组仅包含7个项目。
$numberOfUnits = array ("1", "2", "3", "4", "5", "6", "7");
$timesheetLines = new XeroPHPModelsPayrollAUTimesheetTimesheetLine($xero);
foreach($numberOfUnits as $unit ){
$timesheetLines->addNumberOfUnit($unit)
}