|
@@ -94,16 +94,20 @@ public class DeliveryAddress extends Controller {
|
|
|
public String isdefault() throws YosException {
|
|
|
|
|
|
Long contactsid = content.getLongValue("contactsid");
|
|
|
+ boolean isdefault = content.getBooleanValue("isdefault");
|
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_enterprise_contacts");
|
|
|
- updateSQL.setSiteid(siteid);
|
|
|
- updateSQL.setWhere("createuserid", userid);
|
|
|
- updateSQL.setValue("isdefault", 0);
|
|
|
- updateSQL.update();
|
|
|
+ if (isdefault) {
|
|
|
+ updateSQL.setSiteid(siteid);
|
|
|
+ updateSQL.setWhere("createuserid", userid);
|
|
|
+ updateSQL.setValue("isdefault", 0);
|
|
|
+ updateSQL.update();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
updateSQL = SQLFactory.createUpdateSQL(this, "sys_enterprise_contacts");
|
|
|
updateSQL.setSiteid(siteid);
|
|
|
updateSQL.setWhere("contactsid", contactsid);
|
|
|
- updateSQL.setValue("isdefault", 1);
|
|
|
+ updateSQL.setValue("isdefault", isdefault);
|
|
|
updateSQL.update();
|
|
|
|
|
|
return getSucReturnObject().toString();
|